KiCad PCB EDA Suite
class_mire.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) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 1992-2011 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
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org 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  */
24 
30 #ifndef MIRE_H
31 #define MIRE_H
32 
33 
34 #include <class_board_item.h>
35 
36 
37 class EDA_RECT;
38 class LINE_READER;
39 class EDA_DRAW_PANEL;
40 
41 
42 class PCB_TARGET : public BOARD_ITEM
43 {
44  int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
45  int m_Size;
46  int m_Width;
48 
49 public:
50  PCB_TARGET( BOARD_ITEM* aParent );
51 
52  // Do not create a copy constructor. The one generated by the compiler is adequate.
53 
54  PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
55  const wxPoint& aPos, int aSize, int aWidth );
56 
57  // Do not create a copy constructor & operator=.
58  // The ones generated by the compiler are adequate.
59 
60  ~PCB_TARGET();
61 
62  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
63  const wxPoint& GetPosition() const override { return m_Pos; }
64 
65  void SetShape( int aShape ) { m_Shape = aShape; }
66  int GetShape() const { return m_Shape; }
67 
68  void SetSize( int aSize ) { m_Size = aSize; }
69  int GetSize() const { return m_Size; }
70 
71  void SetWidth( int aWidth ) { m_Width = aWidth; }
72  int GetWidth() const { return m_Width; }
73 
74  void Move( const wxPoint& aMoveVector ) override
75  {
76  m_Pos += aMoveVector;
77  }
78 
79  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
80 
81  void Flip( const wxPoint& aCentre ) override;
82 
83  void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
84  GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
85 
86  bool HitTest( const wxPoint& aPosition ) const override;
87 
88  wxString GetClass() const override
89  {
90  return wxT( "PCB_TARGET" );
91  }
92 
96  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
97 
98  // Virtual function
99  const EDA_RECT GetBoundingBox() const override;
100 
101  wxString GetSelectMenuText() const override;
102 
103  BITMAP_DEF GetMenuImage() const override;
104 
105  EDA_ITEM* Clone() const override;
106 
107 #if defined(DEBUG)
108  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
109 #endif
110 };
111 
112 
113 #endif // #define MIRE_H
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
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: class_mire.cpp:200
int GetWidth() const
Definition: class_mire.h:72
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void SetSize(int aSize)
Definition: class_mire.h:68
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Definition: class_mire.cpp:167
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
int m_Shape
Definition: class_mire.h:44
PCB_LAYER_ID
A quick note on layer IDs:
int GetShape() const
Definition: class_mire.h:66
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_mire.cpp:205
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_mire.h:88
void SetPosition(const wxPoint &aPos) override
Definition: class_mire.h:62
void SetShape(int aShape)
Definition: class_mire.h:65
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.
Definition: class_mire.cpp:78
int m_Width
Definition: class_mire.h:46
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_mire.cpp:161
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
Definition: class_mire.h:74
const wxPoint & GetPosition() const override
Definition: class_mire.h:63
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_mire.cpp:186
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
void SetWidth(int aWidth)
Definition: class_mire.h:71
int GetSize() const
Definition: class_mire.h:69
PCB_TARGET(BOARD_ITEM *aParent)
Definition: class_mire.cpp:48
wxPoint m_Pos
Definition: class_mire.h:47
int m_Size
Definition: class_mire.h:45
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_mire.cpp:174
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
Definition: class_mire.cpp:140