KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_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, [email protected]
5 * Copyright The 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 PCB_DIMENSION_H
26#define PCB_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
34class LINE_READER;
35class MSG_PANEL_ITEM;
36
37
40{
41 NO_SUFFIX, // 1234.0
42 BARE_SUFFIX, // 1234.0 mm
43 PAREN_SUFFIX // 1234.0 (mm)
44};
45
46enum class DIM_PRECISION
47{
48 X = 0, // 0
49 X_X, // 0.0
50 X_XX, // 0.00
51 X_XXX, // 0.000
52 X_XXXX, // 0.0000
53 X_XXXXX, // 0.00000
54 V_VV, // 0.00 / 0 / 0.0
55 V_VVV, // 0.000 / 0 / 0.00
56 V_VVVV, // 0.0000 / 0.0 / 0.000
57 V_VVVVV // 0.00000 / 0.00 / 0.0000
58};
59
62{
63 OUTSIDE,
64 INLINE,
65 MANUAL
66};
67
72{
73 INCH, // Do not use IN: it conflicts with a Windows header
74 MILS,
75 MM,
77};
78
83{
84 INWARD,
85 OUTWARD,
86};
87
92{
93 NONE,
95 CIRCLE,
97};
98
119{
120public:
122
123 void Serialize( google::protobuf::Any &aContainer ) const override;
124 bool Deserialize( const google::protobuf::Any &aContainer ) override;
125
131 virtual const VECTOR2I& GetStart() const { return m_start; }
132 virtual void SetStart( const VECTOR2I& aPoint ) { m_start = aPoint; }
133
134 virtual const VECTOR2I& GetEnd() const { return m_end; }
135 virtual void SetEnd( const VECTOR2I& aPoint ) { m_end = aPoint; }
136
137 VECTOR2I GetPosition() const override { return m_start; }
138 void SetPosition( const VECTOR2I& aPos ) override { m_start = aPos; }
139
141 void SetOverrideTextEnabled( bool aOverride ) { m_overrideTextEnabled = aOverride; }
142
143 wxString GetOverrideText() const { return m_valueString; }
144 void SetOverrideText( const wxString& aValue ) { m_valueString = aValue; }
145
146 void ChangeOverrideText( const wxString& aValue )
147 {
149 SetOverrideText( aValue );
150 Update();
151 }
152
153 int GetMeasuredValue() const { return m_measuredValue; }
154
155 // KiCad normally calculates the measured value but some importers need to set it.
156 void SetMeasuredValue( int aValue ) { m_measuredValue = aValue; }
157
161 wxString GetValueText() const;
162
170 void Update()
171 {
172 // Calls updateText internally
174 }
175
177 {
179 Update();
180 }
181
182 wxString GetPrefix() const { return m_prefix; }
183 void SetPrefix( const wxString& aPrefix );
184
185 void ChangePrefix( const wxString& aPrefix )
186 {
187 SetPrefix( aPrefix );
188 Update();
189 }
190
191 wxString GetSuffix() const { return m_suffix; }
192 void SetSuffix( const wxString& aSuffix );
193
194 void ChangeSuffix( const wxString& aSuffix )
195 {
196 SetSuffix( aSuffix );
197 Update();
198 }
199
201 void SetArrowDirection( const DIM_ARROW_DIRECTION& aDirection )
202 {
203 m_arrowDirection = aDirection;
204 }
205
207 {
208 SetArrowDirection( aDirection );
209 updateText();
211 }
212
213 EDA_UNITS GetUnits() const { return m_units; }
214 void SetUnits( EDA_UNITS aUnits );
215
217 void SetUnitsMode( DIM_UNITS_MODE aMode );
218
220 {
221 SetUnitsMode( aMode );
222 Update();
223 }
224
225 void SetAutoUnits( bool aAuto = true ) { m_autoUnits = aAuto; }
226
228 void SetUnitsFormat( const DIM_UNITS_FORMAT aFormat ) { m_unitsFormat = aFormat; }
229
231 {
232 SetUnitsFormat( aFormat );
233 Update();
234 }
235
237 void SetPrecision( DIM_PRECISION aPrecision ) { m_precision = aPrecision; }
238
240 {
241 SetPrecision( aPrecision );
242 Update();
243 }
244
245 bool GetSuppressZeroes() const { return m_suppressZeroes; }
246 void SetSuppressZeroes( bool aSuppress ) { m_suppressZeroes = aSuppress; }
247
248 void ChangeSuppressZeroes( bool aSuppress )
249 {
250 SetSuppressZeroes( aSuppress );
251 Update();
252 }
253
254 bool GetKeepTextAligned() const { return m_keepTextAligned; }
255 void SetKeepTextAligned( bool aKeepAligned ) { m_keepTextAligned = aKeepAligned; }
256
257 double GetTextAngleDegreesProp() const { return GetTextAngleDegrees(); }
258 void ChangeTextAngleDegrees( double aDegrees );
259 void ChangeKeepTextAligned( bool aKeepAligned );
260
263
264 int GetArrowLength() const { return m_arrowLength; }
265 void SetArrowLength( int aLength ) { m_arrowLength = aLength; }
266
267 void SetExtensionOffset( int aOffset ) { m_extensionOffset = aOffset; }
268 int GetExtensionOffset() const { return m_extensionOffset; }
269
270 int GetLineThickness() const { return m_lineThickness; }
271 void SetLineThickness( int aWidth ) { m_lineThickness = aWidth; }
272
276 const std::vector<std::shared_ptr<SHAPE>>& GetShapes() const { return m_shapes; }
277
278 // BOARD_ITEM overrides
279
280 void Move( const VECTOR2I& offset ) override;
281 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
282 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
283
292 virtual void Mirror( const VECTOR2I& axis_pos, FLIP_DIRECTION aFlipDirection ) override;
293
294 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
295
296 bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
297 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
298 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
299
300 const BOX2I GetBoundingBox() const override;
301
302 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
303 FLASHING aFlash = FLASHING::DEFAULT ) const override;
304
305 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
306
307 const BOX2I ViewBBox() const override;
308
309 void ClearRenderCache() override;
310
311 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
312 int aError, ERROR_LOC aErrorLoc,
313 bool aIgnoreLineWidth = false ) const override;
314
315 double Similarity( const BOARD_ITEM& aOther ) const override;
316
317 bool operator==( const PCB_DIMENSION_BASE& aOther ) const;
318 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
319
320#if defined(DEBUG)
321 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
322#endif
323
324protected:
325
329 virtual void updateGeometry() = 0;
330
337 virtual void updateText();
338
339 template<typename ShapeType>
340 void addShape( const ShapeType& aShape );
341
350 void drawAnArrow( VECTOR2I aStartPoint, EDA_ANGLE anAngle, int aLength );
351
352 // Value format
354 wxString m_valueString;
355 wxString m_prefix;
356 wxString m_suffix;
363
364 // Geometry
370
371 // Internal
375
377 std::vector<std::shared_ptr<SHAPE>> m_shapes;
378
380
381 // a flag to protect against reentrance
382 bool m_busy;
383};
384
385
414{
415public:
417
418 // Do not create a copy constructor & operator=.
419 // The ones generated by the compiler are adequate.
420
421 ~PCB_DIM_ALIGNED() = default;
422
423 void Serialize( google::protobuf::Any &aContainer ) const override;
424 bool Deserialize( const google::protobuf::Any &aContainer ) override;
425
426 static inline bool ClassOf( const EDA_ITEM* aItem )
427 {
428 return aItem && aItem->Type() == PCB_DIM_ALIGNED_T;
429 }
430
431 EDA_ITEM* Clone() const override;
432
433 void Mirror( const VECTOR2I& axis_pos, FLIP_DIRECTION aFlipDirection ) override;
434
435 BITMAPS GetMenuImage() const override;
436
437 const VECTOR2I& GetCrossbarStart() const { return m_crossBarStart; }
438
439 const VECTOR2I& GetCrossbarEnd() const { return m_crossBarEnd; }
440
446 void SetHeight( int aHeight ) { m_height = aHeight; }
447 int GetHeight() const { return m_height; }
448
449 void ChangeHeight( int aHeight )
450 {
451 SetHeight( aHeight );
452 Update();
453 }
454
460 void UpdateHeight( const VECTOR2I& aCrossbarStart, const VECTOR2I& aCrossbarEnd );
461
462 void SetExtensionHeight( int aHeight ) { m_extensionHeight = aHeight; }
463 int GetExtensionHeight() const { return m_extensionHeight; }
464
465 void ChangeExtensionHeight( int aHeight )
466 {
467 SetExtensionHeight( aHeight );
468 Update();
469 }
470
476 double GetAngle() const
477 {
479
480 return atan2( (double)delta.y, (double)delta.x );
481 }
482
483 wxString GetClass() const override
484 {
485 return wxT( "PCB_DIM_ALIGNED" );
486 }
487
488 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
489
490protected:
491 virtual void swapData( BOARD_ITEM* aImage ) override;
492
493 void updateGeometry() override;
494
495 void updateText() override;
496
497 // Geometry
500
503
504};
505
506
512{
513public:
514 enum class DIR
515 {
516 HORIZONTAL, // Aligned with x-axis
517 VERTICAL // Aligned with y-axis
518 };
519
520 PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent );
521
523
524 void Serialize( google::protobuf::Any &aContainer ) const override;
525 bool Deserialize( const google::protobuf::Any &aContainer ) override;
526
527 static inline bool ClassOf( const EDA_ITEM* aItem )
528 {
529 return aItem && aItem->Type() == PCB_DIM_ORTHOGONAL_T;
530 }
531
532 EDA_ITEM* Clone() const override;
533
534 void Mirror( const VECTOR2I& axis_pos, FLIP_DIRECTION aFlipDirection ) override;
535
536 BITMAPS GetMenuImage() const override;
537
543 void SetOrientation( DIR aOrientation ) { m_orientation = aOrientation; }
544 DIR GetOrientation() const { return m_orientation; }
545
546 wxString GetClass() const override
547 {
548 return wxT( "PCB_DIM_ORTHOGONAL" );
549 }
550 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
551
552protected:
553 void swapData( BOARD_ITEM* aImage ) override;
554
555 void updateGeometry() override;
556
557 void updateText() override;
558
559private:
560 // Geometry
562
563};
564
565
587{
588public:
589 PCB_DIM_RADIAL( BOARD_ITEM* aParent );
590
591 void Serialize( google::protobuf::Any &aContainer ) const override;
592 bool Deserialize( const google::protobuf::Any &aContainer ) override;
593
594 static inline bool ClassOf( const EDA_ITEM* aItem )
595 {
596 return aItem && aItem->Type() == PCB_DIM_RADIAL_T;
597 }
598
599 EDA_ITEM* Clone() const override;
600
601 void SetLeaderLength( int aLength ) { m_leaderLength = aLength; }
602 int GetLeaderLength() const { return m_leaderLength; }
603
604 void ChangeLeaderLength( int aLength )
605 {
606 SetLeaderLength( aLength );
607 Update();
608 }
609
610 // Returns the point (c).
611 VECTOR2I GetKnee() const;
612
613 BITMAPS GetMenuImage() const override;
614
615 wxString GetClass() const override
616 {
617 return wxT( "PCB_DIM_RADIAL" );
618 }
619
620protected:
621 virtual void swapData( BOARD_ITEM* aImage ) override;
622
623 void updateText() override;
624 void updateGeometry() override;
625
626private:
628};
629
630
645{
646public:
647 PCB_DIM_LEADER( BOARD_ITEM* aParent );
648
649 void Serialize( google::protobuf::Any &aContainer ) const override;
650 bool Deserialize( const google::protobuf::Any &aContainer ) override;
651
652 static inline bool ClassOf( const EDA_ITEM* aItem )
653 {
654 return aItem && aItem->Type() == PCB_DIM_LEADER_T;
655 }
656
657 EDA_ITEM* Clone() const override;
658
659 BITMAPS GetMenuImage() const override;
660
661 wxString GetClass() const override
662 {
663 return wxT( "PCB_DIM_LEADER" );
664 }
665
666 void SetTextBorder( DIM_TEXT_BORDER aBorder ) { m_textBorder = aBorder; }
668
670 {
671 SetTextBorder( aBorder );
672 Update();
673 }
674
675 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
676
677protected:
678 virtual void swapData( BOARD_ITEM* aImage ) override;
679
680 void updateText() override;
681 void updateGeometry() override;
682
683private:
685};
686
687
695{
696public:
697 PCB_DIM_CENTER( BOARD_ITEM* aParent );
698
699 void Serialize( google::protobuf::Any &aContainer ) const override;
700 bool Deserialize( const google::protobuf::Any &aContainer ) override;
701
702 static inline bool ClassOf( const EDA_ITEM* aItem )
703 {
704 return aItem && aItem->Type() == PCB_DIM_CENTER_T;
705 }
706
707 EDA_ITEM* Clone() const override;
708
709 BITMAPS GetMenuImage() const override;
710
711 wxString GetClass() const override
712 {
713 return wxT( "PCB_DIM_CENTER" );
714 }
715
716 const BOX2I GetBoundingBox() const override;
717
718 const BOX2I ViewBBox() const override;
719
720protected:
721 virtual void swapData( BOARD_ITEM* aImage ) override;
722
723 void updateText() override;
724 void updateGeometry() override;
725};
726
727#endif // DIMENSION_H
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
double GetTextAngleDegrees() const
Definition: eda_text.h:151
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Abstract dimension API.
EDA_UNITS GetUnits() const
bool m_autoUnits
If true, follow the currently selected UI units.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
void Update()
Update the dimension's cached text and geometry.
void ChangeSuffix(const wxString &aSuffix)
wxString GetOverrideText() const
wxString GetSuffix() const
std::vector< std::shared_ptr< SHAPE > > m_shapes
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
virtual void updateGeometry()=0
Update the cached geometry of the dimension after changing any of its properties.
void ClearRenderCache() override
int m_lineThickness
Thickness used for all graphics in the dimension.
void Move(const VECTOR2I &offset) override
Move this object.
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
bool m_suppressZeroes
Suppress trailing zeroes.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void SetMeasuredValue(int aValue)
int GetLineThickness() const
void SetUnits(EDA_UNITS aUnits)
DIM_PRECISION m_precision
Number of digits to display after decimal.
void addShape(const ShapeType &aShape)
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void SetPrefix(const wxString &aPrefix)
wxString m_suffix
String appended to the value.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void ChangeOverrideText(const wxString &aValue)
void SetExtensionOffset(int aOffset)
void SetSuppressZeroes(bool aSuppress)
bool m_inClearRenderCache
re-entrancy guard
int m_extensionOffset
Distance from feature points to extension line start.
DIM_TEXT_POSITION GetTextPositionMode() const
void ChangeArrowDirection(const DIM_ARROW_DIRECTION &aDirection)
bool GetKeepTextAligned() const
void ChangeTextAngleDegrees(double aDegrees)
bool m_keepTextAligned
Calculate text orientation to match dimension.
DIM_PRECISION GetPrecision() const
wxString GetPrefix() const
void SetOverrideTextEnabled(bool aOverride)
void SetSuffix(const wxString &aSuffix)
bool operator==(const PCB_DIMENSION_BASE &aOther) const
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
DIM_UNITS_MODE GetUnitsMode() const
void drawAnArrow(VECTOR2I aStartPoint, EDA_ANGLE anAngle, int aLength)
Draws an arrow and updates the shape container.
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
virtual void updateText()
Update the text field value from the current geometry (called by updateGeometry normally).
bool HitTest(const VECTOR2I &aPosition, int aAccuracy) const override
Test if aPosition is inside or on the boundary of this item.
EDA_UNITS m_units
0 = inches, 1 = mm
int m_measuredValue
value of PCB dimensions
DIM_UNITS_FORMAT GetUnitsFormat() const
void SetLineThickness(int aWidth)
void SetArrowLength(int aLength)
virtual const VECTOR2I & GetStart() const
The dimension's origin is the first feature point for the dimension.
DIM_ARROW_DIRECTION GetArrowDirection() const
wxString m_valueString
Displayed value when m_overrideValue = true.
void ChangePrecision(DIM_PRECISION aPrecision)
virtual void SetEnd(const VECTOR2I &aPoint)
void SetPrecision(DIM_PRECISION aPrecision)
bool m_overrideTextEnabled
Manually specify the displayed measurement value.
virtual void SetStart(const VECTOR2I &aPoint)
void SetAutoUnits(bool aAuto=true)
DIM_UNITS_FORMAT m_unitsFormat
How to render the units suffix.
int GetMeasuredValue() const
bool GetSuppressZeroes() const
void SetArrowDirection(const DIM_ARROW_DIRECTION &aDirection)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
DIM_TEXT_POSITION m_textPosition
How to position the text.
void SetOverrideText(const wxString &aValue)
wxString GetValueText() const
int GetExtensionOffset() const
void ChangePrefix(const wxString &aPrefix)
wxString m_prefix
String prepended to the value.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void SetPosition(const VECTOR2I &aPos) override
DIM_ARROW_DIRECTION m_arrowDirection
direction of dimension arrow.
void ChangeKeepTextAligned(bool aKeepAligned)
void ChangeUnitsFormat(const DIM_UNITS_FORMAT aFormat)
void ChangeSuppressZeroes(bool aSuppress)
int GetArrowLength() const
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.
double GetTextAngleDegreesProp() const
bool GetOverrideTextEnabled() const
void SetUnitsMode(DIM_UNITS_MODE aMode)
int m_arrowLength
Length of arrow shapes.
virtual const VECTOR2I & GetEnd() const
virtual void Mirror(const VECTOR2I &axis_pos, FLIP_DIRECTION aFlipDirection) override
Mirror the dimension relative to a given horizontal axis.
VECTOR2I m_end
Internal cache of drawn shapes.
void ChangeUnitsMode(DIM_UNITS_MODE aMode)
void SetKeepTextAligned(bool aKeepAligned)
VECTOR2I GetPosition() const override
For better understanding of the points that make a dimension:
int GetHeight() const
const VECTOR2I & GetCrossbarStart() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
int m_height
Perpendicular distance from features to crossbar.
void ChangeExtensionHeight(int aHeight)
wxString GetClass() const override
Return the class name.
void updateText() override
Update the text field value from the current geometry (called by updateGeometry normally).
void SetExtensionHeight(int aHeight)
const VECTOR2I & GetCrossbarEnd() const
~PCB_DIM_ALIGNED()=default
VECTOR2I m_crossBarStart
Crossbar start control point.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void Mirror(const VECTOR2I &axis_pos, FLIP_DIRECTION aFlipDirection) override
Mirror the dimension relative to a given horizontal axis.
void UpdateHeight(const VECTOR2I &aCrossbarStart, const VECTOR2I &aCrossbarEnd)
Update the stored height basing on points coordinates.
virtual void swapData(BOARD_ITEM *aImage) override
int m_extensionHeight
Length of extension lines past the crossbar.
double GetAngle() const
Return the angle of the crossbar.
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
static bool ClassOf(const EDA_ITEM *aItem)
VECTOR2I m_crossBarEnd
Crossbar end control point.
void ChangeHeight(int aHeight)
void updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
int GetExtensionHeight() const
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.
Mark the center of a circle or arc with a cross shape.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
wxString GetClass() const override
Return the class name.
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
virtual void swapData(BOARD_ITEM *aImage) override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
static bool ClassOf(const EDA_ITEM *aItem)
void updateText() override
Update the text field value from the current geometry (called by updateGeometry normally).
A leader is a dimension-like object pointing to a specific point.
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.
DIM_TEXT_BORDER m_textBorder
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
DIM_TEXT_BORDER GetTextBorder() const
virtual void swapData(BOARD_ITEM *aImage) override
static bool ClassOf(const EDA_ITEM *aItem)
void updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
void updateText() override
Update the text field value from the current geometry (called by updateGeometry normally).
void SetTextBorder(DIM_TEXT_BORDER aBorder)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void ChangeTextBorder(DIM_TEXT_BORDER aBorder)
wxString GetClass() const override
Return the class name.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
void swapData(BOARD_ITEM *aImage) override
wxString GetClass() const override
Return the class name.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
static bool ClassOf(const EDA_ITEM *aItem)
void updateText() override
Update the text field value from the current geometry (called by updateGeometry normally).
void SetOrientation(DIR aOrientation)
Set the orientation of the dimension line (so, perpendicular to the feature lines).
void updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
~PCB_DIM_ORTHOGONAL()=default
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
DIR m_orientation
What axis to lock the dimension line to.
void Mirror(const VECTOR2I &axis_pos, FLIP_DIRECTION aFlipDirection) override
Mirror the dimension relative to a given horizontal axis.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
DIR GetOrientation() const
A radial dimension indicates either the radius or diameter of an arc or circle.
int GetLeaderLength() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void updateText() override
Update the text field value from the current geometry (called by updateGeometry normally).
virtual void swapData(BOARD_ITEM *aImage) override
void SetLeaderLength(int aLength)
wxString GetClass() const override
Return the class name.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
void ChangeLeaderLength(int aLength)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
static bool ClassOf(const EDA_ITEM *aItem)
VECTOR2I GetKnee() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
A round rectangle shape, based on a rectangle and a radius.
Definition: roundrect.h:36
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
EDA_UNITS
Definition: eda_units.h:48
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:184
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
FLIP_DIRECTION
Definition: mirror.h:27
DIM_TEXT_POSITION
Where to place the text on a dimension.
Definition: pcb_dimension.h:62
@ OUTSIDE
Text appears outside the dimension line (default)
@ MANUAL
Text placement is manually set by the user.
@ INLINE
Text appears in line with the dimension line.
DIM_UNITS_FORMAT
How to display the units in a dimension's text.
Definition: pcb_dimension.h:40
DIM_UNITS_MODE
Used for storing the units selection in the file because EDA_UNITS alone doesn't cut it.
Definition: pcb_dimension.h:72
DIM_ARROW_DIRECTION
Used for dimension's arrow.
Definition: pcb_dimension.h:83
DIM_TEXT_BORDER
Frame to show around dimension text.
Definition: pcb_dimension.h:92
DIM_PRECISION
Definition: pcb_dimension.h:47
int delta
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:105
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:103
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:101
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:100
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:104