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 #include <geometry/circle.h>
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  const PCB_TEXT& Text() const { return 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( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, bool aStart = true );
275  static OPT_VECTOR2I segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart = true );
276 
277  // Value format
279  wxString m_valueString;
280  wxString m_prefix;
281  wxString m_suffix;
283  bool m_autoUnits;
287 
288  // Geometry
294 
295  // Internal
298  wxPoint m_start;
299  wxPoint m_end;
300 
302  std::vector<std::shared_ptr<SHAPE>> m_shapes;
303 
304  static constexpr float s_arrowAngle = 27.5;
305 };
306 
335 {
336 protected:
337  // Geometry
338  int m_height;
340 
341  wxPoint m_crossBarStart;
342  wxPoint m_crossBarEnd;
343 
344 public:
346 
347  // Do not create a copy constructor & operator=.
348  // The ones generated by the compiler are adequate.
349 
350  ~ALIGNED_DIMENSION() = default;
351 
352  static inline bool ClassOf( const EDA_ITEM* aItem )
353  {
354  return aItem && PCB_DIM_ALIGNED_T == aItem->Type();
355  }
356 
357  EDA_ITEM* Clone() const override;
358 
359  virtual void SwapData( BOARD_ITEM* aImage ) override;
360 
361  BITMAPS GetMenuImage() const override;
362 
363  const wxPoint& GetCrossbarStart() const { return m_crossBarStart; }
364 
365  const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; }
366 
371  void SetHeight( int aHeight ) { m_height = aHeight; }
372  int GetHeight() const { return m_height; }
373 
378  void UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd );
379 
380  void SetExtensionHeight( int aHeight ) { m_extensionHeight = aHeight; }
381  int GetExtensionHeight() const { return m_extensionHeight; }
382 
388  double GetAngle() const
389  {
390  wxPoint delta( m_end - m_start );
391 
392  return atan2( (double)delta.y, (double)delta.x );
393  }
394 
395  wxString GetClass() const override
396  {
397  return wxT( "ALIGNED_DIMENSION" );
398  }
399 
400  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
401 
402 protected:
403 
404  void updateGeometry() override;
405 
406  void updateText() override;
407 };
408 
409 
415 {
416 public:
417  enum class DIR
418  {
419  HORIZONTAL, // Aligned with x-axis
420  VERTICAL // Aligned with y-axis
421  };
422 
423 private:
424  // Geometry
426 
427 public:
428  ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent );
429 
430  ~ORTHOGONAL_DIMENSION() = default;
431 
432  static inline bool ClassOf( const EDA_ITEM* aItem )
433  {
434  return aItem && PCB_DIM_ORTHOGONAL_T == aItem->Type();
435  }
436 
437  EDA_ITEM* Clone() const override;
438 
439  void SwapData( BOARD_ITEM* aImage ) override;
440 
441  BITMAPS GetMenuImage() const override;
442 
447  void SetOrientation( DIR aOrientation ) { m_orientation = aOrientation; }
448  DIR GetOrientation() const { return m_orientation; }
449 
450  wxString GetClass() const override
451  {
452  return wxT( "ORTHOGONAL_DIMENSION" );
453  }
454  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
455 
456 protected:
457 
458  void updateGeometry() override;
459 
460  void updateText() override;
461 };
462 
463 
478 class LEADER : public DIMENSION_BASE
479 {
481 
482 public:
483  LEADER( BOARD_ITEM* aParent );
484 
485  static inline bool ClassOf( const EDA_ITEM* aItem )
486  {
487  return aItem && PCB_DIM_LEADER_T == aItem->Type();
488  }
489 
490  EDA_ITEM* Clone() const override;
491 
492  virtual void SwapData( BOARD_ITEM* aImage ) override;
493 
494  BITMAPS GetMenuImage() const override;
495 
496  wxString GetClass() const override
497  {
498  return wxT( "LEADER" );
499  }
500 
501  void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; }
503 
504  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
505 
506 protected:
507 
508  void updateGeometry() override;
509 };
510 
511 
518 {
519 
520 public:
521  CENTER_DIMENSION( BOARD_ITEM* aParent );
522 
523  static inline bool ClassOf( const EDA_ITEM* aItem )
524  {
525  return aItem && PCB_DIM_CENTER_T == aItem->Type();
526  }
527 
528  EDA_ITEM* Clone() const override;
529 
530  virtual void SwapData( BOARD_ITEM* aImage ) override;
531 
532  BITMAPS GetMenuImage() const override;
533 
534  wxString GetClass() const override
535  {
536  return wxT( "CENTER_DIMENSION" );
537  }
538 
539  const EDA_RECT GetBoundingBox() const override;
540 
541  const BOX2I ViewBBox() const override;
542 
543 protected:
544 
545  void updateGeometry() override;
546 };
547 
548 #endif // DIMENSION_H
bool GetSuppressZeroes() const
Definition: dimension.h:172
CENTER_DIMENSION(BOARD_ITEM *aParent)
Definition: dimension.cpp:1057
int m_extensionHeight
Length of extension lines past the crossbar.
Definition: dimension.h:339
~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
bool m_suppressZeroes
Suppress trailing zeroes.
Definition: dimension.h:286
DIM_UNITS_FORMAT GetUnitsFormat() const
Definition: dimension.h:166
static constexpr float s_arrowAngle
Definition: dimension.h:304
void SetParent(EDA_ITEM *aParent) override
Definition: dimension.cpp:61
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:432
virtual void SetStart(const wxPoint &aPoint)
Definition: dimension.h:122
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:717
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:940
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:285
void SetTextFrame(DIM_TEXT_FRAME aFrame)
Definition: dimension.h:501
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:280
DIM_UNITS_MODE GetUnitsMode() const
Definition: dimension.cpp:150
DIM_TEXT_FRAME GetTextFrame() const
Definition: dimension.h:502
bool m_autoUnits
If true, follow the currently selected UI units.
Definition: dimension.h:283
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:1109
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:250
bool m_overrideTextEnabled
Manually specify the displayed measurement value.
Definition: dimension.h:278
void SetPosition(const wxPoint &aPos) override
Definition: dimension.h:128
static OPT_VECTOR2I segPolyIntersection(const SHAPE_POLY_SET &aPoly, const SEG &aSeg, bool aStart=true)
Finds the intersection between a given segment and polygon outline.
Definition: dimension.cpp:455
void updateText() override
Updates the text field value from the current geometry (called by updateGeometry normally)
Definition: dimension.cpp:639
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:932
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:926
wxPoint m_start
Definition: dimension.h:298
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:291
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
wxString GetClass() const override
Return the class name.
Definition: dimension.h:534
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:916
const wxPoint & GetCrossbarStart() const
Definition: dimension.h:363
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 OPT_VECTOR2I segCircleIntersection(CIRCLE &aCircle, SEG &aSeg, bool aStart=true)
Definition: dimension.cpp:479
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:523
void SetOverrideText(const wxString &aValue)
Definition: dimension.h:134
int m_height
Perpendicular distance from features to crossbar.
Definition: dimension.h:338
const wxPoint & GetCrossbarEnd() const
Definition: dimension.h:365
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:388
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: dimension.cpp:1071
int m_arrowLength
Length of arrow shapes.
Definition: dimension.h:290
void SetExtensionHeight(int aHeight)
Definition: dimension.h:380
wxString m_suffix
String appended to the value.
Definition: dimension.h:281
void SetSuppressZeroes(bool aSuppress)
Definition: dimension.h:173
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:352
void updateText() override
Updates the text field value from the current geometry (called by updateGeometry normally)
Definition: dimension.cpp:824
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:395
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:371
bool m_keepTextAligned
Calculate text orientation to match dimension.
Definition: dimension.h:293
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:697
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:478
int GetExtensionHeight() const
Definition: dimension.h:381
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:946
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:1079
void GetUnits(EDA_UNITS &aUnits) const
Definition: dimension.h:158
EDA_UNITS m_units
0 = inches, 1 = mm
Definition: dimension.h:282
PCB_TEXT & Text()
Definition: dimension.h:209
DIR GetOrientation() const
Definition: dimension.h:448
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:414
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:1037
PCB_TEXT m_text
The actual text object.
Definition: dimension.h:296
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:703
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:233
Text appears outside the dimension line (default)
Class Circle Represents basic circle geometry with utility geometry functions.
Definition: circle.h:33
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
const PCB_TEXT & Text() const
Definition: dimension.h:210
void SetSuffix(const wxString &aSuffix)
Definition: dimension.cpp:138
int m_measuredValue
value of PCB dimensions
Definition: dimension.h:297
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
~ORTHOGONAL_DIMENSION()=default
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: dimension.cpp:531
void SetOrientation(DIR aOrientation)
Sets the orientation of the dimension line (so, perpendicular to the feature lines)
Definition: dimension.h:447
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:537
void SetAutoUnits(bool aAuto=true)
Definition: dimension.h:164
int GetHeight() const
Definition: dimension.h:372
Definition: seg.h:41
EDA_UNITS
Definition: eda_units.h:38
wxString GetClass() const override
Return the class name.
Definition: dimension.h:496
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
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:723
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:480
static bool ClassOf(const EDA_ITEM *aItem)
Definition: dimension.h:485
wxString GetClass() const override
Return the class name.
Definition: dimension.h:450
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
ALIGNED_DIMENSION(BOARD_ITEM *aParent, KICAD_T aType=PCB_DIM_ALIGNED_T)
Definition: dimension.cpp:503
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:1085
std::vector< std::shared_ptr< SHAPE > > m_shapes
Definition: dimension.h:302
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:518
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:679
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: dimension.cpp:1065
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: dimension.cpp:1102
wxString m_valueString
Displayed value when m_overrideValue = true.
Definition: dimension.h:279
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:289
ORTHOGONAL_DIMENSION(BOARD_ITEM *aParent)
Definition: dimension.cpp:688
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:258
DIM_UNITS_FORMAT m_unitsFormat
How to render the units suffix.
Definition: dimension.h:284
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:512
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: dimension.cpp:862
void updateGeometry() override
Updates the cached geometry of the dimension after changing any of its properties.
Definition: dimension.cpp:551
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:334
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
Definition: dimension.h:178
wxPoint m_crossBarEnd
Crossbar end control point.
Definition: dimension.h:342
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:292
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:291
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:341
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:163
DIR m_orientation
What axis to lock the dimension line to.
Definition: dimension.h:425
wxPoint m_end
Internal cache of drawn shapes.
Definition: dimension.h:299
Marks the center of a circle or arc with a cross shape The size and orientation of the cross is adjus...
Definition: dimension.h:517