KiCad PCB EDA Suite
dimension.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-2020 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 
25 #ifndef DIMENSION_H
26 #define DIMENSION_H
27 
28 
29 #include <board_item.h>
30 #include <pcb_text.h>
31 #include <geometry/shape.h>
32 
33 
34 class LINE_READER;
35 class MSG_PANEL_ITEM;
36 
37 
39 enum class DIM_UNITS_FORMAT
40 {
41  NO_SUFFIX, // 1234.0
42  BARE_SUFFIX, // 1234.0 mm
43  PAREN_SUFFIX // 1234.0 (mm)
44 };
45 
48 {
49  OUTSIDE,
50  INLINE,
51  MANUAL
52 };
53 
57 enum class DIM_UNITS_MODE
58 {
59  INCHES,
60  MILS,
62  AUTOMATIC
63 };
64 
68 enum class DIM_TEXT_FRAME
69 {
70  NONE,
71  RECTANGLE,
72  CIRCLE,
73  ROUNDRECT
74 };
75 
95 class DIMENSION_BASE : public BOARD_ITEM
96 {
97 public:
98  DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T );
99 
100  bool IsType( const KICAD_T aScanTypes[] ) const override
101  {
102  if( BOARD_ITEM::IsType( aScanTypes ) )
103  return true;
104 
105  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
106  {
107  if( *p == PCB_LOCATE_GRAPHIC_T )
108  return true;
109  }
110 
111  return false;
112  }
113 
114  void SetParent( EDA_ITEM* aParent ) override;
115 
121  virtual const wxPoint& GetStart() const { return m_start; }
122  virtual void SetStart( const wxPoint& aPoint ) { m_start = aPoint; }
123 
124  virtual const wxPoint& GetEnd() const { return m_end; }
125  virtual void SetEnd( const wxPoint& aPoint ) { m_end = aPoint; }
126 
127  wxPoint GetPosition() const override { return m_start; }
128  void SetPosition( const wxPoint& aPos ) override { m_start = aPos; }
129 
131  void SetOverrideTextEnabled( bool aOverride ) { m_overrideTextEnabled = aOverride; }
132 
133  wxString GetOverrideText() const { return m_valueString; }
134  void SetOverrideText( const wxString& aValue ) { m_valueString = aValue; }
135 
136  int GetMeasuredValue() const { return m_measuredValue; }
137 
141  wxString GetValueText() const;
142 
146  void Update()
147  {
148  updateGeometry();
149  updateText();
150  }
151 
152  wxString GetPrefix() const { return m_prefix; }
153  void SetPrefix( const wxString& aPrefix );
154 
155  wxString GetSuffix() const { return m_suffix; }
156  void SetSuffix( const wxString& aSuffix );
157 
158  void GetUnits( EDA_UNITS& aUnits ) const { aUnits = m_units; }
159  void SetUnits( EDA_UNITS aUnits );
160 
162  void SetUnitsMode( DIM_UNITS_MODE aMode );
163 
164  void SetAutoUnits( bool aAuto = true ) { m_autoUnits = aAuto; }
165 
167  void SetUnitsFormat( const DIM_UNITS_FORMAT aFormat ) { m_unitsFormat = aFormat; }
168 
169  int GetPrecision() const { return m_precision; }
170  void SetPrecision( int aPrecision ) { m_precision = aPrecision; }
171 
172  bool GetSuppressZeroes() const { return m_suppressZeroes; }
173  void SetSuppressZeroes( bool aSuppress ) { m_suppressZeroes = aSuppress; }
174 
175  bool GetKeepTextAligned() const { return m_keepTextAligned; }
176  void SetKeepTextAligned( bool aKeepAligned ) { m_keepTextAligned = aKeepAligned; }
177 
180 
181  int GetArrowLength() const { return m_arrowLength; }
182  void SetArrowLength( int aLength ) { m_arrowLength = aLength; }
183 
184  void SetExtensionOffset( int aOffset ) { m_extensionOffset = aOffset; }
185  int GetExtensionOffset() const { return m_extensionOffset; }
186 
187  int GetLineThickness() const { return m_lineThickness; }
188  void SetLineThickness( int aWidth ) { m_lineThickness = aWidth; }
189 
190  void SetLayer( PCB_LAYER_ID aLayer ) override;
191 
192  void SetTextSize( const wxSize& aTextSize )
193  {
194  m_text.SetTextSize( aTextSize );
195  }
196 
201  void SetText( const wxString& aNewText );
202 
207  const wxString GetText() const;
208 
209  PCB_TEXT& Text() { return m_text; }
210  PCB_TEXT& Text() const { return *( const_cast<PCB_TEXT*> ( &m_text ) ); }
211 
215  const std::vector<std::shared_ptr<SHAPE>>& GetShapes() const { return m_shapes; }
216 
217  // BOARD_ITEM overrides
218 
219  void Move( const wxPoint& offset ) override;
220  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
221  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
222 
229  void Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight = false );
230 
231  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
232 
233  bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
234  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
235 
236  const EDA_RECT GetBoundingBox() const override;
237 
238  std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer ) const override;
239 
240  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
241 
242  const BOX2I ViewBBox() const override;
243 
245  int aClearance, int aError, ERROR_LOC aErrorLoc,
246  bool aIgnoreLineWidth ) const override;
247 
248 #if defined(DEBUG)
249  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
250 #endif
251 
252 protected:
253 
257  virtual void updateGeometry() = 0;
258 
262  virtual void updateText();
263 
264  template<typename ShapeType>
265  void addShape( const ShapeType& aShape );
266 
274  static OPT_VECTOR2I segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart = true );
275 
276  // Value format
278  wxString m_valueString;
279  wxString m_prefix;
280  wxString m_suffix;
282  bool m_autoUnits;
286 
287  // Geometry
293 
294  // Internal
297  wxPoint m_start;
298  wxPoint m_end;
299 
301  std::vector<std::shared_ptr<SHAPE>> m_shapes;
302 
303  static constexpr float s_arrowAngle = 27.5;
304 };
305 
334 {
335 protected:
336  // Geometry
337  int m_height;
339 
340  wxPoint m_crossBarStart;
341  wxPoint m_crossBarEnd;
342 
343 public:
345 
346  // Do not create a copy constructor & operator=.
347  // The ones generated by the compiler are adequate.
348 
349  ~ALIGNED_DIMENSION() = default;
350 
351  static inline bool ClassOf( const EDA_ITEM* aItem )
352  {
353  return aItem && PCB_DIM_ALIGNED_T == aItem->Type();
354  }
355 
356  EDA_ITEM* Clone() const override;
357 
358  virtual void SwapData( BOARD_ITEM* aImage ) override;
359 
360  BITMAP_DEF GetMenuImage() const override;
361 
362  const wxPoint& GetCrossbarStart() const { return m_crossBarStart; }
363 
364  const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; }
365 
370  void SetHeight( int aHeight ) { m_height = aHeight; }
371  int GetHeight() const { return m_height; }
372 
377  void UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd );
378 
379  void SetExtensionHeight( int aHeight ) { m_extensionHeight = aHeight; }
380  int GetExtensionHeight() const { return m_extensionHeight; }
381 
387  double GetAngle() const
388  {
389  wxPoint delta( m_end - m_start );
390 
391  return atan2( (double)delta.y, (double)delta.x );
392  }
393 
394  wxString GetClass() const override
395  {
396  return wxT( "ALIGNED_DIMENSION" );
397  }
398 
399  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
400 
401 protected:
402 
403  void updateGeometry() override;
404 
405  void updateText() override;
406 };
407 
408 
414 {
415 public:
416  enum class DIR
417  {
418  HORIZONTAL, // Aligned with x-axis
419  VERTICAL // Aligned with y-axis
420  };
421 
422 private:
423  // Geometry
425 
426 public:
427  ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent );
428 
429  ~ORTHOGONAL_DIMENSION() = default;
430 
431  static inline bool ClassOf( const EDA_ITEM* aItem )
432  {
433  return aItem && PCB_DIM_ORTHOGONAL_T == aItem->Type();
434  }
435 
436  EDA_ITEM* Clone() const override;
437 
438  void SwapData( BOARD_ITEM* aImage ) override;
439 
440  BITMAP_DEF GetMenuImage() const override;
441 
446  void SetOrientation( DIR aOrientation ) { m_orientation = aOrientation; }
447  DIR GetOrientation() const { return m_orientation; }
448 
449  wxString GetClass() const override
450  {
451  return wxT( "ORTHOGONAL_DIMENSION" );
452  }
453 
454 protected:
455 
456  void updateGeometry() override;
457 
458  void updateText() override;
459 };
460 
461 
476 class LEADER : public DIMENSION_BASE
477 {
479 
480 public:
481  LEADER( BOARD_ITEM* aParent );
482 
483  static inline bool ClassOf( const EDA_ITEM* aItem )
484  {
485  return aItem && PCB_DIM_LEADER_T == aItem->Type();
486  }
487 
488  EDA_ITEM* Clone() const override;
489 
490  virtual void SwapData( BOARD_ITEM* aImage ) override;
491 
492  BITMAP_DEF GetMenuImage() const override;
493 
494  wxString GetClass() const override
495  {
496  return wxT( "LEADER" );
497  }
498 
499  void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; }
501 
502  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
503 
504 protected:
505 
506  void updateGeometry() override;
507 };
508 
509 
516 {
517 
518 public:
519  CENTER_DIMENSION( BOARD_ITEM* aParent );
520 
521  static inline bool ClassOf( const EDA_ITEM* aItem )
522  {
523  return aItem && PCB_DIM_CENTER_T == aItem->Type();
524  }
525 
526  EDA_ITEM* Clone() const override;
527 
528  virtual void SwapData( BOARD_ITEM* aImage ) override;
529 
530  BITMAP_DEF GetMenuImage() const override;
531 
532  wxString GetClass() const override
533  {
534  return wxT( "CENTER_DIMENSION" );
535  }
536 
537  const EDA_RECT GetBoundingBox() const override;
538 
539  const BOX2I ViewBBox() const override;
540 
541 protected:
542 
543  void updateGeometry() override;
544 };
545 
546 #endif // DIMENSION_H
bool GetSuppressZeroes() const
Definition: dimension.h:172
CENTER_DIMENSION(BOARD_ITEM *aParent)
Definition: dimension.cpp:971
int m_extensionHeight
Length of extension lines past the crossbar.
Definition: dimension.h:338
~ALIGNED_DIMENSION()=default
bool GetOverrideTextEnabled() const
Definition: dimension.h:130
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:80
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:507
PNG memory record (file in memory).
Definition: bitmap_def.h:29
bool m_suppressZeroes
Suppress trailing zeroes.
Definition: dimension.h:285
DIM_UNITS_FORMAT GetUnitsFormat() const
Definition: dimension.h:166
static constexpr float s_arrowAngle
Definition: dimension.h:303
void SetParent(EDA_ITEM *aParent) override
Definition: dimension.cpp:61
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:860
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:431
virtual void SetStart(const wxPoint &aPoint)
Definition: dimension.h:122
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: dimension.cpp:436
int m_precision
Number of digits to display after decimal.
Definition: dimension.h:284
void SetTextFrame(DIM_TEXT_FRAME aFrame)
Definition: dimension.h:499
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
wxString m_prefix
String prepended to the value.
Definition: dimension.h:279
DIM_UNITS_MODE GetUnitsMode() const
Definition: dimension.cpp:150
DIM_TEXT_FRAME GetTextFrame() const
Definition: dimension.h:500
bool m_autoUnits
If true, follow the currently selected UI units.
Definition: dimension.h:282
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:1023
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: dimension.cpp:212
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: dimension.cpp:253
bool m_overrideTextEnabled
Manually specify the displayed measurement value.
Definition: dimension.h:277
void SetPosition(const wxPoint &aPos) override
Definition: dimension.h:128
void updateText() override
Updates the text field value from the current geometry (called by updateGeometry normally)
Definition: dimension.cpp:615
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
Definition: dimension.h:121
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
Definition: dimension.h:167
void SetPrefix(const wxString &aPrefix)
Definition: dimension.cpp:132
DIM_TEXT_POSITION GetTextPositionMode() const
Definition: dimension.h:179
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: dimension.cpp:852
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:846
wxPoint m_start
Definition: dimension.h:297
void SetUnits(EDA_UNITS aUnits)
Definition: dimension.cpp:144
wxString GetOverrideText() const
Definition: dimension.h:133
int m_extensionOffset
Distance from feature points to extension line start.
Definition: dimension.h:290
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
wxString GetClass() const override
Return the class name.
Definition: dimension.h:532
void Update()
Updates the dimension's cached text and geometry.
Definition: dimension.h:146
const wxString GetText() const
Retrieves the value text or override text, not including prefix or suffix.
Definition: dimension.cpp:206
void addShape(const ShapeType &aShape)
Definition: dimension.cpp:97
The base class for create windows for drawing purpose.
LEADER(BOARD_ITEM *aParent)
Definition: dimension.cpp:836
const wxPoint & GetCrossbarStart() const
Definition: dimension.h:362
int GetPrecision() const
Definition: dimension.h:169
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: dimension.cpp:403
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:521
void SetOverrideText(const wxString &aValue)
Definition: dimension.h:134
int m_height
Perpendicular distance from features to crossbar.
Definition: dimension.h:337
const wxPoint & GetCrossbarEnd() const
Definition: dimension.h:364
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
int GetLineThickness() const
Definition: dimension.h:187
double GetAngle() const
Function GetAngle Returns angle of the crossbar.
Definition: dimension.h:387
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: dimension.cpp:985
int m_arrowLength
Length of arrow shapes.
Definition: dimension.h:289
void SetExtensionHeight(int aHeight)
Definition: dimension.h:379
wxString m_suffix
String appended to the value.
Definition: dimension.h:280
void SetSuppressZeroes(bool aSuppress)
Definition: dimension.h:173
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:351
void updateText() override
Updates the text field value from the current geometry (called by updateGeometry normally)
Definition: dimension.cpp:795
void SetText(const wxString &aNewText)
Sets the override text - has no effect if m_overrideValue == false.
Definition: dimension.cpp:199
wxString GetClass() const override
Return the class name.
Definition: dimension.h:394
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth) const override
Convert the item shape to a closed polygon.
PCB_LAYER_ID
A quick note on layer IDs:
wxString GetSuffix() const
Definition: dimension.h:155
void SetHeight(int aHeight)
Sets the distance from the feature points to the crossbar line.
Definition: dimension.h:370
bool m_keepTextAligned
Calculate text orientation to match dimension.
Definition: dimension.h:292
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
Definition: dimension.h:215
virtual void updateGeometry()=0
Updates the cached geometry of the dimension after changing any of its properties.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:668
static OPT_VECTOR2I segPolyIntersection(SHAPE_POLY_SET &aPoly, SEG &aSeg, bool aStart=true)
Finds the intersection between a given segment and polygon outline.
Definition: dimension.cpp:455
wxString GetPrefix() const
Definition: dimension.h:152
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:39
A leader is a dimension-like object pointing to a specific point.
Definition: dimension.h:476
int GetExtensionHeight() const
Definition: dimension.h:380
Represent a set of closed polygons.
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:866
void GetUnits(EDA_UNITS &aUnits) const
Definition: dimension.h:158
EDA_UNITS m_units
0 = inches, 1 = mm
Definition: dimension.h:281
PCB_TEXT & Text()
Definition: dimension.h:209
DIR GetOrientation() const
Definition: dimension.h:447
bool IsType(const KICAD_T aScanTypes[]) const override
Check whether the item is one of the listed types.
Definition: dimension.h:100
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
Definition: dimension.h:413
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: dimension.cpp:951
PCB_TEXT m_text
The actual text object.
Definition: dimension.h:295
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:993
virtual void SetEnd(const wxPoint &aPoint)
Definition: dimension.h:125
Text placement is manually set by the user.
void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: dimension.cpp:674
void Move(const wxPoint &offset) override
Move this object.
Definition: dimension.cpp:219
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:232
Text appears outside the dimension line (default)
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: dimension.cpp:230
void SetExtensionOffset(int aOffset)
Definition: dimension.h:184
DIM_TEXT_FRAME
Frame to show around dimension text.
Definition: dimension.h:68
void SetSuffix(const wxString &aSuffix)
Definition: dimension.cpp:138
int m_measuredValue
value of PCB dimensions
Definition: dimension.h:296
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
~ORTHOGONAL_DIMENSION()=default
void SetOrientation(DIR aOrientation)
Sets the orientation of the dimension line (so, perpendicular to the feature lines)
Definition: dimension.h:446
Text appears in line with the dimension line.
void UpdateHeight(const wxPoint &aCrossbarStart, const wxPoint &aCrossbarEnd)
Updates stored height basing on points coordinates.
Definition: dimension.cpp:513
void SetAutoUnits(bool aAuto=true)
Definition: dimension.h:164
int GetHeight() const
Definition: dimension.h:371
Definition: seg.h:41
EDA_UNITS
Definition: eda_units.h:38
wxString GetClass() const override
Return the class name.
Definition: dimension.h:494
int GetMeasuredValue() const
Definition: dimension.h:136
wxPoint GetPosition() const override
Definition: dimension.h:127
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: dimension.cpp:354
PCB_TEXT & Text() const
Definition: dimension.h:210
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:694
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: dimension.cpp:445
DIM_TEXT_FRAME m_textFrame
Definition: dimension.h:478
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:483
wxString GetClass() const override
Return the class name.
Definition: dimension.h:449
ALIGNED_DIMENSION(BOARD_ITEM *aParent, KICAD_T aType=PCB_DIM_ALIGNED_T)
Definition: dimension.cpp:479
void SetPrecision(int aPrecision)
Definition: dimension.h:170
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: dimension.cpp:999
std::vector< std::shared_ptr< SHAPE > > m_shapes
Definition: dimension.h:301
void SetArrowLength(int aLength)
Definition: dimension.h:182
DIM_UNITS_MODE
Used for storing the units selection in the file because EDA_UNITS alone doesn't cut it.
Definition: dimension.h:57
Handle the component boundary box.
Definition: eda_rect.h:42
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: dimension.cpp:494
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: dimension.cpp:650
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:979
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: dimension.cpp:1016
wxString m_valueString
Displayed value when m_overrideValue = true.
Definition: dimension.h:278
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: dimension.cpp:367
DIM_TEXT_POSITION
Where to place the text on a dimension.
Definition: dimension.h:47
int m_lineThickness
Thickness used for all graphics in the dimension.
Definition: dimension.h:288
ORTHOGONAL_DIMENSION(BOARD_ITEM *aParent)
Definition: dimension.cpp:659
DIMENSION_BASE(BOARD_ITEM *aParent, KICAD_T aType=PCB_DIMENSION_T)
Definition: dimension.cpp:41
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
void Mirror(const wxPoint &axis_pos, bool aMirrorLeftRight=false)
Mirror the Dimension , relative to a given horizontal axis the text is not mirrored.
Definition: dimension.cpp:261
DIM_UNITS_FORMAT m_unitsFormat
How to render the units suffix.
Definition: dimension.h:283
void SetOverrideTextEnabled(bool aOverride)
Definition: dimension.h:131
DIM_UNITS_FORMAT
How to display the units in a dimension's text.
Definition: dimension.h:39
virtual void updateText()
Updates the text field value from the current geometry (called by updateGeometry normally)
Definition: dimension.cpp:68
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:488
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:527
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
void SetLineThickness(int aWidth)
Definition: dimension.h:188
For better understanding of the points that make a dimension:
Definition: dimension.h:333
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:688
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
Definition: dimension.h:178
wxPoint m_crossBarEnd
Crossbar end control point.
Definition: dimension.h:341
void SetTextSize(const wxSize &aTextSize)
Definition: dimension.h:192
Abstract dimension API.
Definition: dimension.h:95
bool GetKeepTextAligned() const
Definition: dimension.h:175
DIM_TEXT_POSITION m_textPosition
How to position the text.
Definition: dimension.h:291
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: dimension.cpp:294
virtual const wxPoint & GetEnd() const
Definition: dimension.h:124
int GetArrowLength() const
Definition: dimension.h:181
wxPoint m_crossBarStart
Crossbar start control point.
Definition: dimension.h:340
int GetExtensionOffset() const
Definition: dimension.h:185
void SetUnitsMode(DIM_UNITS_MODE aMode)
Definition: dimension.cpp:174
void SetKeepTextAligned(bool aKeepAligned)
Definition: dimension.h:176
wxString GetValueText() const
Definition: dimension.cpp:103
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
DIR m_orientation
What axis to lock the dimension line to.
Definition: dimension.h:424
wxPoint m_end
Internal cache of drawn shapes.
Definition: dimension.h:298
Marks the center of a circle or arc with a cross shape The size and orientation of the cross is adjus...
Definition: dimension.h:515