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-2021 KiCad Developers, see AUTHORS.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  */
25 #ifndef LIB_CIRCLE_H
26 #define LIB_CIRCLE_H
28 #include <lib_item.h>
31 class LIB_CIRCLE : public LIB_ITEM
32 {
33 public:
34  LIB_CIRCLE( LIB_SYMBOL* aParent );
36  // Do not create a copy constructor. The one generated by the compiler is adequate.
40  wxString GetClass() const override
41  {
42  return wxT( "LIB_CIRCLE" );
43  }
45  wxString GetTypeName() const override
46  {
47  return _( "Circle" );
48  }
50  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
51  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
53  int GetPenWidth() const override;
55  const EDA_RECT GetBoundingBox() const override;
57  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
59  void BeginEdit( const wxPoint& aStartPoint ) override;
60  void CalcEdit( const wxPoint& aPosition ) override;
62  void Offset( const wxPoint& aOffset ) override;
64  void MoveTo( const wxPoint& aPosition ) override;
66  wxPoint GetPosition() const override { return m_Pos; }
68  void SetEnd( const wxPoint& aPosition ) { m_EndPos = aPosition; }
69  wxPoint GetEnd() const { return m_EndPos; }
71  void MirrorHorizontal( const wxPoint& aCenter ) override;
72  void MirrorVertical( const wxPoint& aCenter ) override;
73  void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
75  void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
76  const TRANSFORM& aTransform ) const override;
78  int GetWidth() const override { return m_Width; }
79  void SetWidth( int aWidth ) override { m_Width = aWidth; }
81  void SetRadius( int aRadius ) { m_EndPos = wxPoint( m_Pos.x + aRadius, m_Pos.y ); }
82  int GetRadius() const;
84  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
86  BITMAPS GetMenuImage() const override;
88  EDA_ITEM* Clone() const override;
90 private:
99  int compare( const LIB_ITEM& aOther,
100  LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
102  void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
103  const TRANSFORM& aTransform ) override;
105  wxPoint m_Pos; // Position or centre (Arc and Circle) or start point (segments).
106  wxPoint m_EndPos; // A point on the circumference of the circle.
107  int m_Width; // Line width.
108 };
111 #endif // LIB_CIRCLE_H
Definition: lib_circle.cpp:40
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: lib_circle.cpp:49
wxPoint GetPosition() const override
Definition: lib_circle.h:66
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_circle.cpp:157
wxPoint m_Pos
Definition: lib_circle.h:105
The base class for create windows for drawing purpose.
int GetWidth() const override
Definition: lib_circle.h:78
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_circle.cpp:89
Define a library symbol object.
Definition: lib_symbol.h:96
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void BeginEdit(const wxPoint &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_circle.cpp:280
wxPoint GetEnd() const
Definition: lib_circle.h:69
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
The list of flags used by the compare function.
Definition: lib_item.h:81
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_circle.cpp:146
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_circle.cpp:274
void SetRadius(int aRadius)
Definition: lib_circle.h:81
int GetPenWidth() const override
Definition: lib_circle.cpp:189
#define _(s)
int GetRadius() const
Definition: lib_circle.cpp:261
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: lib_circle.cpp:267
wxString GetClass() const override
Return the class name.
Definition: lib_circle.h:40
Definition: eda_units.h:38
Base plotter engine class.
Definition: plotter.h:121
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_circle.cpp:95
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_circle.cpp:135
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) const override
Plot the draw item using the plot object.
Definition: lib_circle.cpp:166
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: lib_circle.cpp:237
Handle the component boundary box.
Definition: eda_rect.h:42
void print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the item to aDC.
Definition: lib_circle.cpp:195
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_circle.cpp:122
void SetWidth(int aWidth) override
Definition: lib_circle.h:79
wxString GetTypeName() const override
Provide a user-consumable name of the object type.
Definition: lib_circle.h:45
wxPoint m_EndPos
Definition: lib_circle.h:106
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_circle.cpp:129
void CalcEdit(const wxPoint &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_circle.cpp:286
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_circle.cpp:222
void SetEnd(const wxPoint &aPosition)
Definition: lib_circle.h:68