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 #include <PolyLine.h>
36 
37 
38 class LINE_READER;
39 class EDA_DRAW_PANEL;
40 class MSG_PANEL_ITEM;
41 
42 
43 class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
44 {
45 public:
46  TEXTE_PCB( BOARD_ITEM* parent );
47 
48  // Do not create a copy constructor & operator=.
49  // The ones generated by the compiler are adequate.
50 
51  ~TEXTE_PCB();
52 
53  static inline bool ClassOf( const EDA_ITEM* aItem )
54  {
55  return aItem && PCB_TEXT_T == aItem->Type();
56  }
57 
58  virtual const wxPoint& GetPosition() const override
59  {
60  return EDA_TEXT::GetTextPos();
61  }
62 
63  virtual void SetPosition( const wxPoint& aPos ) override
64  {
65  EDA_TEXT::SetTextPos( aPos );
66  }
67 
68  void Move( const wxPoint& aMoveVector ) override
69  {
70  EDA_TEXT::Offset( aMoveVector );
71  }
72 
73  void SetTextAngle( double aAngle );
74 
75  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
76 
77  void Flip( const wxPoint& aCentre ) override;
78 
79  void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
80  GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
81 
82  void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
83 
84  virtual bool HitTest( const wxPoint& aPosition ) const override
85  {
86  return TextHitTest( aPosition );
87  }
88 
92  virtual bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override
93  {
94  return TextHitTest( aRect, aContained, aAccuracy );
95  }
96 
97  wxString GetClass() const override
98  {
99  return wxT( "PTEXT" );
100  }
101 
114  SHAPE_POLY_SET& aCornerBuffer,
115  int aClearanceValue ) const;
116 
130  int aClearanceValue,
131  int aCircleToSegmentsCount,
132  double aCorrectionFactor ) const;
133 
134  wxString GetSelectMenuText() const override;
135 
136  BITMAP_DEF GetMenuImage() const override;
137 
138  // Virtual function
139  const EDA_RECT GetBoundingBox() const override;
140 
141  EDA_ITEM* Clone() const override;
142 
143 #if defined(DEBUG)
144  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
145 #endif
146 };
147 
148 #endif // #define CLASS_PCB_TEXT_H
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:198
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:229
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
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:38
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
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:223
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:104
virtual const wxPoint & GetPosition() const override
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:114
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 ...
void TransformBoundingBoxWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue) const
Function TransformBoundingBoxWithClearanceToPolygon Convert the text bounding box to a rectangular po...
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:267
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
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 void SetPosition(const wxPoint &aPos) override
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...
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:151
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
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
TEXTE_PCB(BOARD_ITEM *parent)