KiCad PCB EDA Suite
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004 Jean-Pierre Charras,
5  * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  *
20  * or you may search the website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
29 #ifndef _LIB_CIRCLE_H_
30 #define _LIB_CIRCLE_H_
32 #include <lib_draw_item.h>
35 class LIB_CIRCLE : public LIB_ITEM
36 {
37  int m_Radius;
38  wxPoint m_Pos; // Position or centre (Arc and Circle) or start point (segments).
39  int m_Width; // Line width.
41  void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
42  COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
43  const TRANSFORM& aTransform ) override;
45  void calcEdit( const wxPoint& aPosition ) override;
47 public:
48  LIB_CIRCLE( LIB_PART * aParent );
50  // Do not create a copy constructor. The one generated by the compiler is adequate.
54  wxString GetClass() const override
55  {
56  return wxT( "LIB_CIRCLE" );
57  }
60  bool Save( OUTPUTFORMATTER& aFormatter ) override;
62  bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ) override;
64  bool HitTest( const wxPoint& aPosition ) const override;
66  bool HitTest( const wxPoint& aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
68  int GetPenSize( ) const override;
70  const EDA_RECT GetBoundingBox() const override;
72  void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
74  void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ) override;
76  bool ContinueEdit( const wxPoint aNextPoint ) override;
78  void EndEdit( const wxPoint& aPosition, bool aAbort = false ) override;
80  void SetOffset( const wxPoint& aOffset ) override;
82  bool Inside( EDA_RECT& aRect ) const override;
84  void Move( const wxPoint& aPosition ) override;
86  wxPoint GetPosition() const override { return m_Pos; }
88  void MirrorHorizontal( const wxPoint& aCenter ) override;
90  void MirrorVertical( const wxPoint& aCenter ) override;
92  void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
94  void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
95  const TRANSFORM& aTransform ) override;
97  int GetWidth() const override { return m_Width; }
99  void SetWidth( int aWidth ) override { m_Width = aWidth; }
101  void SetRadius( int aRadius ) { m_Radius = aRadius; }
103  int GetRadius() const { return m_Radius; }
105  wxString GetSelectMenuText() const override;
107  BITMAP_DEF GetMenuImage() const override;
109  EDA_ITEM* Clone() const override;
111 private:
121  int compare( const LIB_ITEM& aOther ) const override;
122 };
125 #endif // _LIB_CIRCLE_H_
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
int GetPenSize() const override
Function GetPenSize.
Definition: lib_circle.cpp:201
bool Load(LINE_READER &aLineReader, wxString &aErrorMsg) override
Definition: lib_circle.cpp:67
PNG memory record (file in memory).
Definition: bitmap_types.h:38
void drawGraphic(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform) override
Function drawGraphic.
Definition: lib_circle.cpp:207
void calcEdit(const wxPoint &aPosition) override
Calculates the attributes of an item at aPosition when it is being edited.
Definition: lib_circle.cpp:347
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_circle.h:86
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
wxPoint m_Pos
Definition: lib_circle.h:38
int GetWidth() const override
Function GetWidth return the width of the draw item.
Definition: lib_circle.h:97
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_circle.cpp:116
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool Save(OUTPUTFORMATTER &aFormatter) override
Function Save writes draw item object to aFormatter in component library "*.lib" format.
Definition: lib_circle.cpp:58
bool ContinueEdit(const wxPoint aNextPoint) override
Continue an edit in progress at aPosition.
Definition: lib_circle.cpp:328
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
Definition: lib_circle.cpp:91
void SetOffset(const wxPoint &aOffset) override
Function Offset sets the drawing object by aOffset from the current position.
Definition: lib_circle.cpp:141
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
void MirrorVertical(const wxPoint &aCenter) override
Function MirrorVertical mirrors the draw object along the MirrorVertical (Y) axis about aCenter point...
Definition: lib_circle.cpp:168
int compare(const LIB_ITEM &aOther) const override
Function compare provides the draw object specific comparison called by the == and < operators...
Definition: lib_circle.cpp:122
void SetRadius(int aRadius)
Definition: lib_circle.h:101
Class LIB_PART defines a library part object.
Definition: base_struct.h:158
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: lib_circle.cpp:298
virtual void Rotate()
Rotate the draw item.
void EndEdit(const wxPoint &aPosition, bool aAbort=false) override
End an object editing action.
Definition: lib_circle.cpp:337
void Move(const wxPoint &aPosition) override
Function Move moves a draw object to aPosition.
Definition: lib_circle.cpp:154
wxString GetClass() const override
Function GetClass returns the class name.
Definition: lib_circle.h:54
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_circle.cpp:289
int GetRadius() const
Definition: lib_circle.h:103
Base plotter engine class.
Definition: plot_common.h:86
int m_Radius
Definition: lib_circle.h:37
Definition: lib_circle.cpp:47
void MirrorHorizontal(const wxPoint &aCenter) override
Function MirrorHorizontal mirrors the draw object along the horizontal (X) axis about aCenter point...
Definition: lib_circle.cpp:160
Class EDA_RECT handles the component boundary box.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
bool Inside(EDA_RECT &aRect) const override
Function Inside tests if any part of the draw object is inside rectangle bounds of aRect...
Definition: lib_circle.cpp:147
void SetWidth(int aWidth) override
Function SetWidth sets the width of the draw item to aWidth.
Definition: lib_circle.h:99
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo displays basic info (type, part and convert) about the current item in messa...
Definition: lib_circle.cpp:268
int m_Width
Definition: lib_circle.h:39
void BeginEdit(STATUS_FLAGS aEditMode, const wxPoint aStartPoint=wxPoint(0, 0)) override
Begin an editing a component library draw item in aEditMode at aPosition.
Definition: lib_circle.cpp:304
const EDA_RECT GetBoundingBox() const override
Definition: lib_circle.cpp:254
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
Plot the draw item using the plot object.
Definition: lib_circle.cpp:184
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39