25#ifndef PCB_DIMENSION_H
26#define PCB_DIMENSION_H
100 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
105 for(
KICAD_T scanType : aScanTypes )
156 void SetPrefix(
const wxString& aPrefix );
159 void SetSuffix(
const wxString& aSuffix );
205 void SetText(
const wxString& aNewText );
212 const wxString
GetText()
const;
226 void Flip(
const VECTOR2I& aCentre,
bool aFlipLeftRight )
override;
236 virtual void Mirror(
const VECTOR2I& axis_pos,
bool aMirrorLeftRight =
false );
240 bool HitTest(
const VECTOR2I& aPosition,
int aAccuracy )
const override;
241 bool HitTest(
const BOX2I& aRect,
bool aContained,
int aAccuracy = 0 )
const override;
254 bool aIgnoreLineWidth =
false )
const override;
257 virtual void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
272 template<
typename ShapeType>
273 void addShape(
const ShapeType& aShape );
284 bool aStart =
true );
361 void Mirror(
const VECTOR2I& axis_pos,
bool aMirrorLeftRight =
false )
override;
396 return atan2( (
double)
delta.y, (
double)
delta.x );
401 return wxT(
"PCB_DIM_ALIGNED" );
460 return wxT(
"PCB_DIM_ORTHOGONAL" );
521 return wxT(
"PCB_DIM_RADIAL" );
566 return wxT(
"PCB_DIM_LEADER" );
607 return wxT(
"PCB_DIM_CENTER" );
BITMAPS
A list of all bitmap identifiers.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Represent basic circle geometry with utility geometry functions.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
void SetTextSize(const VECTOR2I &aNewSize)
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
EDA_MSG_PANEL items for displaying messages.
EDA_UNITS GetUnits() const
bool m_autoUnits
If true, follow the currently selected UI units.
void Update()
Update the dimension's cached text and geometry.
void SetTextSize(const wxSize &aTextSize)
wxString GetOverrideText() const
wxString GetSuffix() const
std::vector< std::shared_ptr< SHAPE > > m_shapes
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
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.
virtual void updateGeometry()=0
Update the cached geometry of the dimension after changing any of its properties.
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
void SetPrecision(int aPrecision)
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.
void SetMeasuredValue(int aValue)
int GetLineThickness() const
void SetUnits(EDA_UNITS aUnits)
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
static OPT_VECTOR2I segCircleIntersection(CIRCLE &aCircle, SEG &aSeg, bool aStart=true)
const PCB_TEXT & Text() const
void addShape(const ShapeType &aShape)
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 SetExtensionOffset(int aOffset)
PCB_TEXT m_text
The actual text object.
void SetSuppressZeroes(bool aSuppress)
PCB_DIMENSION_BASE(BOARD_ITEM *aParent, KICAD_T aType=PCB_DIMENSION_T)
int m_extensionOffset
Distance from feature points to extension line start.
void SetText(const wxString &aNewText)
Set the override text - has no effect if m_overrideValue == false.
DIM_TEXT_POSITION GetTextPositionMode() const
void SetParent(EDA_ITEM *aParent) override
bool GetKeepTextAligned() const
bool m_keepTextAligned
Calculate text orientation to match dimension.
wxString GetPrefix() const
void SetOverrideTextEnabled(bool aOverride)
void SetSuffix(const wxString &aSuffix)
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
DIM_UNITS_MODE GetUnitsMode() const
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.
wxString m_valueString
Displayed value when m_overrideValue = true.
virtual void SetEnd(const VECTOR2I &aPoint)
bool m_overrideTextEnabled
Manually specify the displayed measurement value.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
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
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
int m_precision
Number of digits to display after decimal.
const wxString GetText() const
Retrieve the value text or override text, not including prefix or suffix.
DIM_TEXT_POSITION m_textPosition
How to position the text.
static OPT_VECTOR2I segPolyIntersection(const SHAPE_POLY_SET &aPoly, const SEG &aSeg, bool aStart=true)
Find the intersection between a given segment and polygon outline.
void SetOverrideText(const wxString &aValue)
wxString GetValueText() const
int GetExtensionOffset() const
wxString m_prefix
String prepended to the value.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void SetPosition(const VECTOR2I &aPos) override
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.
virtual void Mirror(const VECTOR2I &axis_pos, bool aMirrorLeftRight=false)
Mirror the dimension relative to a given horizontal axis.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
bool GetOverrideTextEnabled() const
void SetUnitsMode(DIM_UNITS_MODE aMode)
int m_arrowLength
Length of arrow shapes.
virtual const VECTOR2I & GetEnd() const
VECTOR2I m_end
Internal cache of drawn shapes.
void SetKeepTextAligned(bool aKeepAligned)
VECTOR2I GetPosition() const override
For better understanding of the points that make a dimension:
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.
int m_height
Perpendicular distance from features to crossbar.
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 UpdateHeight(const VECTOR2I &aCrossbarStart, const VECTOR2I &aCrossbarEnd)
Update the stored height basing on points coordinates.
virtual void swapData(BOARD_ITEM *aImage) override
PCB_DIM_ALIGNED(BOARD_ITEM *aParent, KICAD_T aType)
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 Mirror(const VECTOR2I &axis_pos, bool aMirrorLeftRight=false) override
Mirror the dimension relative to a given horizontal axis.
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.
PCB_DIM_CENTER(BOARD_ITEM *aParent, bool aInFP=false)
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.
virtual void swapData(BOARD_ITEM *aImage) override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
static bool ClassOf(const EDA_ITEM *aItem)
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
void SetTextBorder(DIM_TEXT_BORDER aFrame)
virtual void swapData(BOARD_ITEM *aImage) override
PCB_DIM_LEADER(BOARD_ITEM *aParent, bool aInFP=false)
static bool ClassOf(const EDA_ITEM *aItem)
void updateGeometry() override
Update 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.
wxString GetClass() const override
Return the class name.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
PCB_DIM_ORTHOGONAL(BOARD_ITEM *aParent, bool aInFP=false)
void swapData(BOARD_ITEM *aImage) override
wxString GetClass() const override
Return the class name.
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
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 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 updateGeometry() override
Update the cached geometry of the dimension after changing any of its properties.
PCB_DIM_RADIAL(BOARD_ITEM *aParent, bool aInFP=false)
static bool ClassOf(const EDA_ITEM *aItem)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Represent a set of closed polygons.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
PCB_LAYER_ID
A quick note on layer IDs:
DIM_TEXT_POSITION
Where to place the text on a dimension.
@ 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.
DIM_UNITS_MODE
Used for storing the units selection in the file because EDA_UNITS alone doesn't cut it.
DIM_TEXT_BORDER
Frame to show around dimension text.
std::optional< VECTOR2I > OPT_VECTOR2I
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension