KiCad PCB EDA Suite
class_edge_mod.h
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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
31 #ifndef CLASS_EDGE_MOD_H_
32 #define CLASS_EDGE_MOD_H_
33 
34 
35 #include <wx/gdicmn.h>
36 
37 #include <class_drawsegment.h>
38 
39 
40 class LINE_READER;
41 class MSG_PANEL_ITEM;
42 
43 
44 class EDGE_MODULE : public DRAWSEGMENT
45 {
46 public:
47  EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT );
48 
49  // Do not create a copy constructor & operator=.
50  // The ones generated by the compiler are adequate.
51 
52  ~EDGE_MODULE();
53 
54  static inline bool ClassOf( const EDA_ITEM* aItem )
55  {
56  return aItem && PCB_MODULE_EDGE_T == aItem->Type();
57  }
58 
64  void Move( const wxPoint& aMoveVector ) override;
65 
72  void Mirror( const wxPoint aCentre, bool aMirrorAroundXAxis );
73 
79  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
80 
89  void Flip( const wxPoint& aCentre ) override;
90 
91  void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
92  const wxPoint& GetStart0() const { return m_Start0; }
93 
94  void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
95  const wxPoint& GetEnd0() const { return m_End0; }
96 
103  void SetLocalCoord();
104 
110  void SetDrawCoord();
111 
112  /* drawing functions */
113  void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
114  GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
115 
116  void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
117 
118  wxString GetClass() const override
119  {
120  return wxT( "MGRAPHIC" );
121  }
122 
123  wxString GetSelectMenuText() const override;
124 
125  BITMAP_DEF GetMenuImage() const override;
126 
127  EDA_ITEM* Clone() const override;
128 
129 
130 #if defined(DEBUG)
131  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
132 #endif
133 
134  wxPoint m_Start0; // Start point or center, relative to module origin, orient 0.
135  wxPoint m_End0; // End point, relative to module origin, orient 0.
136 };
137 
138 #endif // CLASS_EDGE_MOD_H_
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void SetEnd0(const wxPoint &aPoint)
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
PNG memory record (file in memory).
Definition: bitmap_types.h:38
const wxPoint & GetEnd0() const
usual segment : line with rounded ends
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
wxString GetClass() const override
Function GetClass returns the class name.
wxPoint m_End0
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate an edge of the footprint.
void Mirror(const wxPoint aCentre, bool aMirrorAroundXAxis)
Mirror an edge of the footprint.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void Flip(const wxPoint &aCentre) override
Flip entity relative to aCentre.
void SetLocalCoord()
Set relative coordinates from draw coordinates.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Class to handle a graphic segment.
const wxPoint & GetStart0() const
void Move(const wxPoint &aMoveVector) override
Move an edge of the footprint.
EDGE_MODULE(MODULE *parent, STROKE_T aShape=S_SEGMENT)
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
void SetStart0(const wxPoint &aPoint)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
static bool ClassOf(const EDA_ITEM *aItem)
wxPoint m_Start0
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53