105 raw = std::max( 0, raw -
m_stroke.GetWidth() / 2 );
121 int aLineWidth, std::vector<VECTOR2I>& aPolygon )
const
136 int halfWidth = sizeY / 2;
138 aPolygon.emplace_back( 0, 0 );
139 aPolygon.emplace_back( -sizeX, halfWidth );
140 aPolygon.emplace_back( -sizeX, -halfWidth );
141 aPolygon.emplace_back( 0, 0 );
147 int halfWidth = sizeY / 2;
149 aPolygon.emplace_back( -sizeX, -halfWidth );
150 aPolygon.emplace_back( 0, 0 );
151 aPolygon.emplace_back( -sizeX, halfWidth );
157 int halfX = sizeX / 2;
158 int halfY = sizeY / 2;
161 for(
int i = 0; i <= nSeg; i++ )
163 double angle = 2.0 *
M_PI * i / nSeg;
164 int px =
KiROUND( halfX * std::cos( angle ) );
165 int py =
KiROUND( halfY * std::sin( angle ) );
166 aPolygon.emplace_back( px, py );
174 int halfX = sizeX / 2;
175 int halfY = sizeY / 2;
177 aPolygon.emplace_back( halfX, halfY );
178 aPolygon.emplace_back( halfX, -halfY );
179 aPolygon.emplace_back( -halfX, -halfY );
180 aPolygon.emplace_back( -halfX, halfY );
181 aPolygon.emplace_back( halfX, halfY );
203 std::vector<VECTOR2I> polygon;
206 if( polygon.empty() )
239 int aLineWidth,
void* aData )
const
244 std::vector<VECTOR2I> polygon;
245 GetShapes( aPoint, aTangent, aLineWidth, polygon );
247 if( polygon.empty() )
284 default:
return wxT(
"none" );
300 const char* aToken )
const
305 std::string
result =
"(" + std::string( aToken ) +
" "
324 result +=
" (stroke (width "
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
A color representation with 4 components: red, green, blue, alpha.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
static constexpr double DEFAULT_RATIO_LENGTH
int GetShortenDepth(int aLineWidth) const
Return how far the line should be shortened at this ending.
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
static wxString StyleToToken(LINE_ENDING_STYLE aStyle)
int GetCurveOrientationDepth(int aLineWidth) const
Return how far along a curved body to look when orienting this ending.
LINE_ENDING_STYLE m_style
static const int s_defaultChoiceCount
VECTOR2I GetEffectiveSize(int aLineWidth) const
Return the rendered size per axis, applying auto-sizing when length or width is 0.
static constexpr double DEFAULT_RATIO_WIDTH
static LINE_ENDING_STYLE TokenToStyle(const wxString &aToken)
int m_length
Along-line axis. 0 = auto (ratio * line width).
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.
static const LINE_ENDING_STYLE s_defaultChoiceOrder[]
Dropdown display order for line ending style choosers.
static int StyleToChoiceIndex(LINE_ENDING_STYLE aStyle)
Return the dropdown index for the given style, or 0 (NONE) if not found.
void Plot(PLOTTER *aPlotter, const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, void *aData=nullptr) const
int m_width
Perpendicular axis. 0 = auto.
void Format(OUTPUTFORMATTER *aOut, const EDA_IU_SCALE &aIuScale, const char *aToken) const
Base plotter engine class.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
static wxString GetLineStyleToken(LINE_STYLE aStyle)
@ FILLED_SHAPE
Fill with object color.
LINE_ENDING_STYLE
Line ending styles for graphic lines, arcs, and beziers.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API std::string FormatInternalUnits(const EDA_IU_SCALE &aIuScale, int aValue, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
Converts aValue from internal units to a string appropriate for writing to file.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
wxString result
Test unit parsing edge cases and error handling.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I