|
KiCad PCB EDA Suite
|
Decorative shape (arrowhead, circle, square) at the start or end of a graphic line, arc, or bezier. More...
#include <line_ending.h>
Public Member Functions | |
| LINE_ENDING () | |
| LINE_ENDING (LINE_ENDING_STYLE aStyle, int aLength=0, int aWidth=0, int aStrokeWidth=0) | |
| LINE_ENDING_STYLE | GetStyle () const |
| void | SetStyle (LINE_ENDING_STYLE aStyle) |
| int | GetLength () const |
| Along-line size. 0 = auto. | |
| void | SetLength (int aLength) |
| int | GetWidth () const |
| Perpendicular size. 0 = auto. | |
| void | SetWidth (int aWidth) |
| void | SetUniformSize (int aSize) |
| int | GetStrokeWidth () const |
| Outline stroke width. | |
| void | SetStrokeWidth (int aWidth) |
| const STROKE_PARAMS & | GetStroke () const |
| void | SetStroke (const STROKE_PARAMS &aStroke) |
| VECTOR2I | GetEffectiveSize (int aLineWidth) const |
| Return the rendered size per axis, applying auto-sizing when length or width is 0. | |
| int | GetShortenDepth (int aLineWidth) const |
| Return how far the line should be shortened at this ending. | |
| int | GetCurveOrientationDepth (int aLineWidth) const |
| Return how far along a curved body to look when orienting this ending. | |
| void | GetShapes (const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, std::vector< VECTOR2I > &aPolygon) const |
| Generate ending geometry as polygon vertices at the given point and direction. | |
| bool | operator== (const LINE_ENDING &aOther) const |
| bool | operator!= (const LINE_ENDING &aOther) const |
| void | Draw (KIGFX::GAL &aGal, const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, double aLineWidth, const KIGFX::COLOR4D &aColor) const |
| void | Plot (PLOTTER *aPlotter, const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, void *aData=nullptr) const |
| void | Format (OUTPUTFORMATTER *aOut, const EDA_IU_SCALE &aIuScale, const char *aToken) const |
Static Public Member Functions | |
| static wxString | StyleToToken (LINE_ENDING_STYLE aStyle) |
| static LINE_ENDING_STYLE | TokenToStyle (const wxString &aToken) |
| static int | StyleToChoiceIndex (LINE_ENDING_STYLE aStyle) |
| Return the dropdown index for the given style, or 0 (NONE) if not found. | |
Static Public Attributes | |
| static constexpr double | DEFAULT_RATIO_LENGTH = 5.0 |
| static constexpr double | DEFAULT_RATIO_WIDTH = 5.0 |
| static const LINE_ENDING_STYLE | s_defaultChoiceOrder [] |
| Dropdown display order for line ending style choosers. | |
| static const int | s_defaultChoiceCount |
Private Attributes | |
| LINE_ENDING_STYLE | m_style |
| int | m_length |
| Along-line axis. 0 = auto (ratio * line width). | |
| int | m_width |
| Perpendicular axis. 0 = auto. | |
| STROKE_PARAMS | m_stroke |
Decorative shape (arrowhead, circle, square) at the start or end of a graphic line, arc, or bezier.
Closed arrows are tip-anchored at the line endpoint and extend back along the line. Open arrows are vertex-anchored at the endpoint and do not shorten the line body. Circles and squares are centered on the endpoint.
Definition at line 61 of file line_ending.h.
|
inline |
Definition at line 64 of file line_ending.h.
References DEFAULT, m_length, m_stroke, m_style, m_width, NONE, and UNSPECIFIED.
Referenced by operator!=(), and operator==().
|
inline |
Definition at line 72 of file line_ending.h.
References DEFAULT, m_length, m_stroke, m_style, m_width, and UNSPECIFIED.
| void LINE_ENDING::Draw | ( | KIGFX::GAL & | aGal, |
| const VECTOR2I & | aPoint, | ||
| const EDA_ANGLE & | aTangent, | ||
| double | aLineWidth, | ||
| const KIGFX::COLOR4D & | aColor ) const |
Definition at line 197 of file line_ending.cpp.
References ARROW_OPEN, KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawPolyline(), GetShapes(), KiROUND(), m_stroke, m_style, NONE, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and KIGFX::GAL_SCOPED_ATTRS::STROKE_FILL.
Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), and KIGFX::SCH_PAINTER::draw().
| void LINE_ENDING::Format | ( | OUTPUTFORMATTER * | aOut, |
| const EDA_IU_SCALE & | aIuScale, | ||
| const char * | aToken ) const |
Definition at line 299 of file line_ending.cpp.
References EDA_UNIT_UTILS::FormatInternalUnits(), STROKE_PARAMS::GetLineStyleToken(), m_length, m_stroke, m_style, m_width, NONE, OUTPUTFORMATTER::Print(), result, StyleToToken(), and TO_UTF8.
Referenced by PCB_IO_KICAD_SEXPR::format(), formatArc(), formatBezier(), formatLineEnding(), formatPoly(), and SCH_IO_KICAD_SEXPR::saveLine().
| int LINE_ENDING::GetCurveOrientationDepth | ( | int | aLineWidth | ) | const |
Return how far along a curved body to look when orienting this ending.
This is separate from line-body shortening. Open arrows do not shorten the line body, but they still extend behind the endpoint and need that visual length when aligning to curves.
Definition at line 111 of file line_ending.cpp.
References ARROW_OPEN, GetEffectiveSize(), GetShortenDepth(), m_style, and VECTOR2< T >::x.
Referenced by checkCurveOrientationDepth(), and EDA_SHAPE::GetEndingTangents().
| VECTOR2I LINE_ENDING::GetEffectiveSize | ( | int | aLineWidth | ) | const |
Return the rendered size per axis, applying auto-sizing when length or width is 0.
When one axis is 0 and the other is set, the 0 axis inherits the set value.
Definition at line 63 of file line_ending.cpp.
References DEFAULT_RATIO_LENGTH, DEFAULT_RATIO_WIDTH, KiROUND(), m_length, and m_width.
Referenced by checkEffectiveSize(), GetCurveOrientationDepth(), GetShapes(), and GetShortenDepth().
|
inline |
Along-line size. 0 = auto.
Definition at line 84 of file line_ending.h.
References m_length.
Referenced by kiapi::common::PackLineEnding().
| void LINE_ENDING::GetShapes | ( | const VECTOR2I & | aPoint, |
| const EDA_ANGLE & | aTangent, | ||
| int | aLineWidth, | ||
| std::vector< VECTOR2I > & | aPolygon ) const |
Generate ending geometry as polygon vertices at the given point and direction.
ARROW_OPEN produces an open 3-point polyline; all others produce closed polygons.
| aTangent | Outward-facing tangent direction at the endpoint. |
Definition at line 120 of file line_ending.cpp.
References ARROW, ARROW_OPEN, CIRCLE, GetEffectiveSize(), KiROUND(), M_PI, m_style, NONE, RotatePoint(), SQUARE, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by addLineEndingEffectiveShapes(), addLineEndingPolygon(), BOARD_ADAPTER::addShape(), BOOST_AUTO_TEST_CASE(), EXPORTER_STEP::buildGraphic3DShape(), Draw(), EDA_SHAPE::GetLineEndingsBoundingBox(), MakeLineEndingBitmap(), and Plot().
| int LINE_ENDING::GetShortenDepth | ( | int | aLineWidth | ) | const |
Return how far the line should be shortened at this ending.
Arrow: full length. Circle/Square: half length. Arrow_Open/None: 0. Reduced by strokeWidth/2 when stroked.
Definition at line 88 of file line_ending.cpp.
References ARROW, ARROW_OPEN, GetEffectiveSize(), m_stroke, m_style, NONE, and VECTOR2< T >::x.
Referenced by checkShortenDepth(), GetCurveOrientationDepth(), MakeLineEndingBitmap(), and EDA_SHAPE::ShortenSegmentForEndings().
|
inline |
Definition at line 103 of file line_ending.h.
References m_stroke.
Referenced by kiapi::common::PackLineEnding().
|
inline |
Outline stroke width.
0 = sharp/filled (default), >0 = stroked outline with line shortening reduced by strokeWidth/2.
Definition at line 100 of file line_ending.h.
References m_stroke.
Referenced by addLineEndingEffectiveShapes(), addLineEndingPolygon(), BOARD_ADAPTER::addShape(), EXPORTER_STEP::buildGraphic3DShape(), EDA_SHAPE::GetLineEndingsBoundingBox(), and kiapi::common::PackLineEnding().
|
inline |
Definition at line 81 of file line_ending.h.
References m_style.
Referenced by addLineEndingEffectiveShapes(), addLineEndingPolygon(), BOARD_ADAPTER::addShape(), EXPORTER_STEP::buildGraphic3DShape(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), EDA_SHAPE::GetEndingTangents(), EDA_SHAPE::GetLineEndingsBoundingBox(), hasLineEnding(), kiapi::common::PackLineEnding(), and BRDITEMS_PLOTTER::PlotShape().
|
inline |
Perpendicular size. 0 = auto.
Definition at line 87 of file line_ending.h.
References m_width.
Referenced by kiapi::common::PackLineEnding().
|
inline |
Definition at line 138 of file line_ending.h.
References LINE_ENDING().
| bool LINE_ENDING::operator== | ( | const LINE_ENDING & | aOther | ) | const |
Definition at line 266 of file line_ending.cpp.
References LINE_ENDING(), m_length, m_stroke, m_style, and m_width.
| void LINE_ENDING::Plot | ( | PLOTTER * | aPlotter, |
| const VECTOR2I & | aPoint, | ||
| const EDA_ANGLE & | aTangent, | ||
| int | aLineWidth, | ||
| void * | aData = nullptr ) const |
Definition at line 238 of file line_ending.cpp.
References ARROW_OPEN, FILLED_SHAPE, GetShapes(), m_stroke, m_style, NO_FILL, NONE, and PLOTTER::PlotPoly().
Referenced by SCH_LINE::Plot(), SCH_SHAPE::Plot(), and BRDITEMS_PLOTTER::PlotShape().
|
inline |
Definition at line 85 of file line_ending.h.
References m_length.
Referenced by PCB_IO_KICAD_SEXPR_PARSER::parseLineEnding(), SCH_IO_KICAD_SEXPR_PARSER::parseLineEnding(), and kiapi::common::UnpackLineEnding().
|
inline |
Definition at line 104 of file line_ending.h.
References m_stroke.
Referenced by PCB_IO_KICAD_SEXPR_PARSER::parseLineEnding(), SCH_IO_KICAD_SEXPR_PARSER::parseLineEnding(), and kiapi::common::UnpackLineEnding().
|
inline |
Definition at line 101 of file line_ending.h.
References m_stroke.
|
inline |
Definition at line 82 of file line_ending.h.
References m_style.
Referenced by PCB_IO_KICAD_SEXPR_PARSER::parseLineEnding(), SCH_IO_KICAD_SEXPR_PARSER::parseLineEnding(), and kiapi::common::UnpackLineEnding().
|
inline |
Definition at line 90 of file line_ending.h.
|
inline |
Definition at line 88 of file line_ending.h.
References m_width.
Referenced by PCB_IO_KICAD_SEXPR_PARSER::parseLineEnding(), SCH_IO_KICAD_SEXPR_PARSER::parseLineEnding(), and kiapi::common::UnpackLineEnding().
|
static |
Return the dropdown index for the given style, or 0 (NONE) if not found.
Definition at line 51 of file line_ending.cpp.
References s_defaultChoiceCount, and s_defaultChoiceOrder.
Referenced by DIALOG_LINE_PROPERTIES::TransferDataToWindow(), and DIALOG_SHAPE_PROPERTIES::TransferDataToWindow().
|
static |
Definition at line 275 of file line_ending.cpp.
References ARROW, ARROW_OPEN, CIRCLE, NONE, and SQUARE.
Referenced by Format().
|
static |
Definition at line 289 of file line_ending.cpp.
References ARROW, ARROW_OPEN, CIRCLE, NONE, and SQUARE.
|
staticconstexpr |
Definition at line 152 of file line_ending.h.
Referenced by DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), GetEffectiveSize(), and MakeLineEndingBitmap().
|
staticconstexpr |
Definition at line 153 of file line_ending.h.
Referenced by GetEffectiveSize(), and MakeLineEndingBitmap().
|
private |
Along-line axis. 0 = auto (ratio * line width).
Definition at line 169 of file line_ending.h.
Referenced by Format(), GetEffectiveSize(), GetLength(), LINE_ENDING(), LINE_ENDING(), operator==(), SetLength(), and SetUniformSize().
|
private |
Definition at line 171 of file line_ending.h.
Referenced by Draw(), Format(), GetShortenDepth(), GetStroke(), GetStrokeWidth(), LINE_ENDING(), LINE_ENDING(), operator==(), Plot(), SetStroke(), and SetStrokeWidth().
|
private |
Definition at line 168 of file line_ending.h.
Referenced by Draw(), Format(), GetCurveOrientationDepth(), GetShapes(), GetShortenDepth(), GetStyle(), LINE_ENDING(), LINE_ENDING(), operator==(), Plot(), and SetStyle().
|
private |
Perpendicular axis. 0 = auto.
Definition at line 170 of file line_ending.h.
Referenced by Format(), GetEffectiveSize(), GetWidth(), LINE_ENDING(), LINE_ENDING(), operator==(), SetUniformSize(), and SetWidth().
|
static |
Definition at line 160 of file line_ending.h.
Referenced by StyleToChoiceIndex(), DIALOG_LINE_PROPERTIES::TransferDataFromWindow(), and DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow().
|
static |
Dropdown display order for line ending style choosers.
Order: None, Arrow, Open Arrow, Circle, Square.
Definition at line 38 of file line_ending.h.
Referenced by StyleToChoiceIndex(), DIALOG_LINE_PROPERTIES::TransferDataFromWindow(), and DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow().