KiCad PCB EDA Suite
class_pcb_text.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 CLASS_PCB_TEXT_H
31 #define CLASS_PCB_TEXT_H
32 
33 #include <eda_text.h>
34 #include <class_board_item.h>
35 
36 
37 class LINE_READER;
38 class EDA_DRAW_PANEL;
39 class MSG_PANEL_ITEM;
40 
41 
42 class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
43 {
44 public:
45  TEXTE_PCB( BOARD_ITEM* parent );
46 
47  // Do not create a copy constructor & operator=.
48  // The ones generated by the compiler are adequate.
49 
50  ~TEXTE_PCB();
51 
52  static inline bool ClassOf( const EDA_ITEM* aItem )
53  {
54  return aItem && PCB_TEXT_T == aItem->Type();
55  }
56 
57  virtual const wxPoint GetPosition() const override
58  {
59  return EDA_TEXT::GetTextPos();
60  }
61 
62  virtual void SetPosition( const wxPoint& aPos ) override
63  {
64  EDA_TEXT::SetTextPos( aPos );
65  }
66 
67  void Move( const wxPoint& aMoveVector ) override
68  {
69  EDA_TEXT::Offset( aMoveVector );
70  }
71 
72  void SetTextAngle( double aAngle );
73 
74  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
75 
76  void Flip( const wxPoint& aCentre ) override;
77 
78  void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
79  GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
80 
81  void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
82 
83  virtual bool HitTest( const wxPoint& aPosition ) const override
84  {
85  return TextHitTest( aPosition );
86  }
87 
91  virtual bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override
92  {
93  return TextHitTest( aRect, aContained, aAccuracy );
94  }
95 
96  wxString GetClass() const override
97  {
98  return wxT( "PTEXT" );
99  }
100 
114  int aClearanceValue,
115  int aCircleToSegmentsCount,
116  double aCorrectionFactor ) const;
117 
118  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
119 
120  BITMAP_DEF GetMenuImage() const override;
121 
122  // Virtual function
123  const EDA_RECT GetBoundingBox() const override;
124 
125  EDA_ITEM* Clone() const override;
126 
127  virtual void SwapData( BOARD_ITEM* aImage ) override;
128 
129 #if defined(DEBUG)
130  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
131 #endif
132 };
133 
134 #endif // #define CLASS_PCB_TEXT_H
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
virtual bool HitTest(const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:242
void SetTextAngle(double aAngle)
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
static bool ClassOf(const EDA_ITEM *aItem)
PNG memory record (file in memory).
Definition: bitmap_types.h:43
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
wxString GetClass() const override
Function GetClass returns the class name.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
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 SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
Definition of base KiCad text object.
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:127
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
void TransformShapeWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor) const
Function TransformShapeWithClearanceToPolygonSet Convert the text shape to a set of polygons (one by ...
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Function TextHitTest Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:255
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
Class SHAPE_POLY_SET.
virtual bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
virtual const wxPoint GetPosition() const override
virtual void SetPosition(const wxPoint &aPos) override
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:154
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
EDA_UNITS_T
Definition: common.h:159
TEXTE_PCB(BOARD_ITEM *parent)