36using namespace STROKEPARAMS_T;
 
   50                            const std::function<
void( 
const VECTOR2I& a,
 
   53    double strokes[6] = { aWidth * 1.0, aWidth * 1.0, aWidth * 1.0, aWidth * 1.0, aWidth * 1.0,
 
   89    switch( aShape->
Type() )
 
   94        std::set<size_t> arcsHandled;
 
  100                size_t arcIndex = outline.
ArcIndex( ii );
 
  102                if( !arcsHandled.contains( arcIndex ) )
 
  104                    arcsHandled.insert( arcIndex );
 
  117        for( 
int jj = 0; jj < (int) outline.
ArcCount(); ++jj )
 
  149        double theta = atan2( 
end.y - start.
y, 
end.x - start.
x );
 
  151        for( 
size_t i = 0; i < 10000; ++i )
 
  155            VECTOR2D next( start.
x + strokes[ i % wrapAround ] * cos( theta ),
 
  156                           start.
y + strokes[ i % wrapAround ] * sin( theta ) );
 
  164            else if( i % 2 == 0 )
 
  178        double    C = 2.0 * 
M_PI * r;
 
  185        if( arcEndAngle == startAngle )
 
  188        if( startAngle > arcEndAngle )
 
  196        wxASSERT( startAngle < arcEndAngle );
 
  200        for( 
size_t i = 0; i < 10000 && startAngle < arcEndAngle; ++i )
 
  203            EDA_ANGLE endAngle = std::min( startAngle + theta, arcEndAngle );
 
  208                        && i % wrapAround == 0 )
 
  211                    for( 
EDA_ANGLE currentAngle = startAngle; currentAngle < endAngle;
 
  212                         currentAngle += angleIncrement )
 
  218                        EDA_ANGLE nextAngle = currentAngle + angleIncrement;
 
  220                        if( nextAngle > endAngle )
 
  222                            nextAngle = endAngle; 
 
  242            startAngle = endAngle;
 
 
  277                                     std::vector<MSG_PANEL_ITEM>& aList,
 
  278                                     bool aIncludeStyle, 
bool aIncludeWidth )
 
  282        wxString msg = 
_( 
"Default" );
 
  284        for( 
const auto& [ lineStyle, lineStyleDesc ] : 
lineTypeNames )
 
  288                msg = lineStyleDesc.name;
 
  293        aList.emplace_back( 
_( 
"Line Style" ), msg );
 
 
  303    wxASSERT( aFormatter != 
nullptr );
 
  307        aFormatter->
Print( 
"(stroke (width %s) (type %s))",
 
  313        aFormatter->
Print( 
"(stroke (width %s) (type %s) (color %d %d %d %s))",
 
 
  326    for( 
T token = NextTok(); token != T_RIGHT; token = NextTok() )
 
  328        if( token != T_LEFT )
 
  353                Expecting( 
"solid, dash, dash_dot, dash_dot_dot, dot or default" );
 
  375            Expecting( 
"width, type, or color" );
 
 
  385    if( token != T_NUMBER )
 
  388    return atoi( CurText() );
 
 
  396    if( token != T_NUMBER )
 
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
 
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
 
A color representation with 4 components: red, green, blue, alpha.
 
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
 
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
 
double GetGapLength(int aLineWidth) const
 
double GetDotLength(int aLineWidth) const
 
double GetDashLength(int aLineWidth) const
 
const VECTOR2I & GetP1() const
 
const VECTOR2I & GetP0() const
 
const VECTOR2I & GetCenter() const
 
SHAPE_TYPE Type() const
Return the type of the shape.
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
const SHAPE_ARC & Arc(size_t aArc) const
 
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
 
virtual const SEG GetSegment(int aIndex) const override
 
int SegmentCount() const
Return the number of segments in this line chain.
 
bool IsArcSegment(size_t aSegment) const
 
const SEG & GetSeg() const
 
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
 
virtual const SEG GetSegment(int aIndex) const override
 
virtual size_t GetSegmentCount() const override
 
An abstract shape on 2D plane.
 
int parseInt(const char *aText)
 
void ParseStroke(STROKE_PARAMS &aStroke)
 
double parseDouble(const char *aText)
 
Simple container to manage line stroke parameters.
 
void SetLineStyle(LINE_STYLE aLineStyle)
 
void SetWidth(int aWidth)
 
void SetColor(const KIGFX::COLOR4D &aColor)
 
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
 
LINE_STYLE GetLineStyle() const
 
void Format(OUTPUTFORMATTER *out, const EDA_IU_SCALE &aIuScale) const
 
KIGFX::COLOR4D GetColor() const
 
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
 
static wxString GetLineStyleToken(LINE_STYLE aStyle)
 
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
 
static constexpr EDA_ANGLE ANGLE_0
 
static constexpr EDA_ANGLE ANGLE_360
 
a few functions useful in geometry calculations.
 
bool ClipLine(const BOX2I *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
 
This file contains miscellaneous commonly used macros and functions.
 
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
 
#define UNIMPLEMENTED_FOR(type)
 
Message panel definition file.
 
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.
 
@ SH_RECT
axis-aligned rectangle
 
@ SH_SIMPLE
simple polygon
 
static wxString SHAPE_TYPE_asString(SHAPE_TYPE a)
 
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
 
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
 
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.
 
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.
 
LINE_STYLE
Dashed line types.
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D