KiCad PCB EDA Suite
class_pcb_target.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 PCB_TARGET_H_
31 #define PCB_TARGET_H_
32 
33 #include <class_board_item.h>
34 
35 
36 class EDA_RECT;
37 class LINE_READER;
38 class EDA_DRAW_PANEL;
39 
40 
41 class PCB_TARGET : public BOARD_ITEM
42 {
43  int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
44  int m_Size;
45  int m_Width;
47 
48 public:
49  PCB_TARGET( BOARD_ITEM* aParent );
50 
51  // Do not create a copy constructor. The one generated by the compiler is adequate.
52 
53  PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
54  const wxPoint& aPos, int aSize, int aWidth );
55 
56  // Do not create a copy constructor & operator=.
57  // The ones generated by the compiler are adequate.
58 
59  ~PCB_TARGET();
60 
61  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
62  const wxPoint GetPosition() const override { return m_Pos; }
63 
64  void SetShape( int aShape ) { m_Shape = aShape; }
65  int GetShape() const { return m_Shape; }
66 
67  void SetSize( int aSize ) { m_Size = aSize; }
68  int GetSize() const { return m_Size; }
69 
70  void SetWidth( int aWidth ) { m_Width = aWidth; }
71  int GetWidth() const { return m_Width; }
72 
73  void Move( const wxPoint& aMoveVector ) override
74  {
75  m_Pos += aMoveVector;
76  }
77 
78  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
79 
80  void Flip( const wxPoint& aCentre ) override;
81 
82  void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
83  GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
84 
85  bool HitTest( const wxPoint& aPosition ) const override;
86 
87  wxString GetClass() const override
88  {
89  return wxT( "PCB_TARGET" );
90  }
91 
95  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
96 
97  // Virtual function
98  const EDA_RECT GetBoundingBox() const override;
99 
100  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
101 
102  BITMAP_DEF GetMenuImage() const override;
103 
104  EDA_ITEM* Clone() const override;
105 
106  virtual void SwapData( BOARD_ITEM* aImage ) override;
107 
108 #if defined(DEBUG)
109  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
110 #endif
111 };
112 
113 
114 #endif
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:41
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
int GetWidth() const
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void SetSize(int aSize)
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
PCB_LAYER_ID
A quick note on layer IDs:
int GetShape() const
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
wxString GetClass() const override
Function GetClass returns the class name.
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void SetPosition(const wxPoint &aPos) override
void SetShape(int aShape)
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 Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
void SetWidth(int aWidth)
int GetSize() const
PCB_TARGET(BOARD_ITEM *aParent)
EDA_UNITS_T
Definition: common.h:158
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
const wxPoint GetPosition() const override
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...