107 raw = std::max( 0, raw -
m_stroke.GetWidth() / 2 );
123 int aLineWidth, std::vector<VECTOR2I>& aPolygon )
const
138 int halfWidth = sizeY / 2;
140 aPolygon.emplace_back( 0, 0 );
141 aPolygon.emplace_back( -sizeX, halfWidth );
142 aPolygon.emplace_back( -sizeX, -halfWidth );
143 aPolygon.emplace_back( 0, 0 );
149 int halfWidth = sizeY / 2;
151 aPolygon.emplace_back( -sizeX, -halfWidth );
152 aPolygon.emplace_back( 0, 0 );
153 aPolygon.emplace_back( -sizeX, halfWidth );
159 int halfX = sizeX / 2;
160 int halfY = sizeY / 2;
163 for(
int i = 0; i <= nSeg; i++ )
165 double angle = 2.0 *
M_PI * i / nSeg;
166 int px =
KiROUND( halfX * std::cos( angle ) );
167 int py =
KiROUND( halfY * std::sin( angle ) );
168 aPolygon.emplace_back( px, py );
176 int halfX = sizeX / 2;
177 int halfY = sizeY / 2;
179 aPolygon.emplace_back( halfX, halfY );
180 aPolygon.emplace_back( halfX, -halfY );
181 aPolygon.emplace_back( -halfX, -halfY );
182 aPolygon.emplace_back( -halfX, halfY );
183 aPolygon.emplace_back( halfX, halfY );
205 std::vector<VECTOR2I> polygon;
208 if( polygon.empty() )
241 int aLineWidth,
void* aData )
const
246 std::vector<VECTOR2I> polygon;
247 GetShapes( aPoint, aTangent, aLineWidth, polygon );
249 if( polygon.empty() )
286 default:
return wxT(
"none" );
302 const char* aToken )
const
307 std::string
result =
"(" + std::string( aToken ) +
" "
326 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.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
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.
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