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 MSG_PANEL_ITEM;
39 
40 
41 class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
42 {
43 public:
44  TEXTE_PCB( BOARD_ITEM* parent );
45 
46  // Do not create a copy constructor & operator=.
47  // The ones generated by the compiler are adequate.
48 
49  ~TEXTE_PCB();
50 
51  static inline bool ClassOf( const EDA_ITEM* aItem )
52  {
53  return aItem && PCB_TEXT_T == aItem->Type();
54  }
55 
56  bool IsType( const KICAD_T aScanTypes[] ) const override
57  {
58  if( BOARD_ITEM::IsType( aScanTypes ) )
59  return true;
60 
61  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
62  {
63  if( *p == PCB_LOCATE_TEXT_T )
64  return true;
65  }
66 
67  return false;
68  }
69 
70  wxString GetShownText( int aDepth = 0 ) const override;
71 
72  bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
73  {
74  return BOARD_ITEM::Matches( GetShownText(), aSearchData );
75  }
76 
77  virtual const wxPoint GetPosition() const override
78  {
79  return EDA_TEXT::GetTextPos();
80  }
81 
82  virtual void SetPosition( const wxPoint& aPos ) override
83  {
84  EDA_TEXT::SetTextPos( aPos );
85  }
86 
87  void Move( const wxPoint& aMoveVector ) override
88  {
89  EDA_TEXT::Offset( aMoveVector );
90  }
91 
92  void SetTextAngle( double aAngle ) override;
93 
94  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
95 
96  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
97 
98  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
99 
100  bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override
101  {
102  return TextHitTest( aPosition, aAccuracy );
103  }
104 
108  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override
109  {
110  return TextHitTest( aRect, aContained, aAccuracy );
111  }
112 
113  wxString GetClass() const override
114  {
115  return wxT( "PTEXT" );
116  }
117 
128  SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError = ARC_HIGH_DEF ) const;
129 
130  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
131 
132  BITMAP_DEF GetMenuImage() const override;
133 
134  // Virtual function
135  const EDA_RECT GetBoundingBox() const override;
136 
137  EDA_ITEM* Clone() const override;
138 
139  virtual void SwapData( BOARD_ITEM* aImage ) override;
140 
141 #if defined(DEBUG)
142  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
143 #endif
144 };
145 
146 #endif // #define CLASS_PCB_TEXT_H
EDA_UNITS
Definition: common.h:198
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
void SetTextAngle(double aAngle) override
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:252
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
static bool ClassOf(const EDA_ITEM *aItem)
PNG memory record (file in memory).
Definition: bitmap_def.h:29
wxString GetClass() const override
Function GetClass returns the class name.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
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, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
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
bool IsType(const KICAD_T aScanTypes[]) const override
Function IsType Checks whether the item is one of the listed types.
The base class for create windows for drawing purpose.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:112
void TransformShapeWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF) const
Function TransformShapeWithClearanceToPolygonSet Convert the text shape to a set of polygons (one by ...
SHAPE_POLY_SET.
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
bool HitTest(const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
virtual const wxPoint GetPosition() const override
virtual void SetPosition(const wxPoint &aPos) override
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:370
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:457
TEXTE_PCB(BOARD_ITEM *parent)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193