40 EDA_SHAPE( aShape, aLineWidth, aFillType )
95 if(
GetShape() == SHAPE_T::RECTANGLE )
116 flip( aCenter,
true );
122 flip( aCenter,
false );
130 rotate( aCenter, rot_angle );
135 const TRANSFORM& aTransform,
bool aDimmed )
const
143 static std::vector<VECTOR2I> cornerList;
153 else if(
GetShape() == SHAPE_T::BEZIER )
173 case FILL_T::FILLED_SHAPE:
176 case FILL_T::FILLED_WITH_COLOR:
180 case FILL_T::FILLED_WITH_BG_BODYCOLOR:
189 lineStyle = PLOT_DASH_TYPE::SOLID;
196 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
197 lineStyle = PLOT_DASH_TYPE::SOLID;
199 if(
m_fill == FILL_T::FILLED_SHAPE )
202 fill = FILL_T::NO_FILL;
209 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
219 aPlotter->
SetDash( penWidth, lineStyle );
227 aPlotter->
Arc( start, mid, end, fill, penWidth );
231 case SHAPE_T::CIRCLE:
239 case SHAPE_T::RECTANGLE:
240 aPlotter->
Rect( start, end, fill, penWidth );
244 case SHAPE_T::BEZIER:
245 aPlotter->
PlotPoly( cornerList, fill, penWidth );
252 aPlotter->
SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
263 const TRANSFORM& aTransform,
bool aDimmed )
268 bool forceNoFill =
static_cast<bool>( aData );
271 if( forceNoFill &&
IsFilled() && penWidth == 0 )
280 if(
color == COLOR4D::UNSPECIFIED )
294 unsigned ptCount = 0;
304 for(
unsigned ii = 0; ii < ptCount; ++ii )
307 else if(
GetShape() == SHAPE_T::BEZIER )
312 for(
size_t ii = 0; ii < ptCount; ++ii )
315 else if(
GetShape() == SHAPE_T::ARC )
325 bool transformed = aTransform.
MapAngles( &t1, &t2 );
326 EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
329 if( transformed == transformed2 )
330 std::swap( pt1, pt2 );
333 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
339 else if(
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
341 else if(
GetFillMode() == FILL_T::FILLED_WITH_COLOR )
345 if( fillColor != COLOR4D::UNSPECIFIED )
350 fillColor = fillColor.
Mix( bg, 0.5f );
356 GRFilledArc( DC, pt1, pt2, c, 0, fillColor, fillColor );
359 case SHAPE_T::CIRCLE:
363 case SHAPE_T::RECTANGLE:
368 GRPoly( DC, ptCount, buffer,
true, 0, fillColor, fillColor );
371 case SHAPE_T::BEZIER:
372 GRPoly( DC, ptCount, buffer,
true, 0, fillColor, fillColor );
394 case SHAPE_T::CIRCLE:
398 case SHAPE_T::RECTANGLE:
406 case SHAPE_T::BEZIER:
418 for(
SHAPE* shape : shapes )
429 for(
SHAPE* shape : shapes )
461 return wxString::Format(
_(
"Arc with radius %s" ),
464 case SHAPE_T::CIRCLE:
465 return wxString::Format(
_(
"Circle with radius %s" ),
468 case SHAPE_T::RECTANGLE:
469 return wxString::Format(
_(
"Rectangle with width %s height %s" ),
474 return wxString::Format(
_(
"Polyline with %d points" ),
477 case SHAPE_T::BEZIER:
478 return wxString::Format(
_(
"Bezier Curve with %d points" ),
483 return wxEmptyString;
492 case SHAPE_T::SEGMENT:
return BITMAPS::add_line;
493 case SHAPE_T::ARC:
return BITMAPS::add_arc;
494 case SHAPE_T::CIRCLE:
return BITMAPS::add_circle;
495 case SHAPE_T::RECTANGLE:
return BITMAPS::add_rectangle;
496 case SHAPE_T::POLY:
return BITMAPS::add_graphical_segments;
500 return BITMAPS::question_mark;
549 return shape->GetShape() == SHAPE_T::POLY;
555 _HKI(
"Position X" ), isPolygon );
557 _HKI(
"Position Y" ), isPolygon );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
VECTOR2I getCenter() const
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
void flip(const VECTOR2I &aCentre, bool aFlipLeftRight)
FILL_T GetFillMode() const
void CalcArcAngles(EDA_ANGLE &aStartAngle, EDA_ANGLE &aEndAngle) const
Calc arc start and end angles such that aStartAngle < aEndAngle.
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
bool hitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
std::vector< VECTOR2I > m_bezierPoints
void setPosition(const VECTOR2I &aPos)
wxString SHAPE_T_asString() const
const BOX2I getBoundingBox() const
virtual int GetWidth() const
int Compare(const EDA_SHAPE *aOther) const
VECTOR2I GetArcMid() const
Class that other classes need to inherit from, in order to be inspectable.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxDC * GetPrintDC() const
The base class for drawable items used by schematic library symbols.
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
STROKE_PARAMS GetStroke() const
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
void MirrorHorizontal(const VECTOR2I &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
void AddPoint(const VECTOR2I &aPosition)
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
int GetPenWidth() const override
const BOX2I GetBoundingBox() const override
PLOT_DASH_TYPE GetEffectiveLineStyle() const
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
LIB_SHAPE(LIB_SYMBOL *aParent, SHAPE_T aShape, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, KICAD_T aType=LIB_SHAPE_T)
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
void MoveTo(const VECTOR2I &aPosition) override
Move a draw object to aPosition.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
VECTOR2I GetPosition() const override
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Define a library symbol object.
Base plotter engine class.
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void Arc(const VECTOR2D &aStart, const VECTOR2D &aMid, const VECTOR2D &aEnd, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH)
RENDER_SETTINGS * RenderSettings()
bool GetColorMode() const
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual size_t GetPointCount() const override
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const std::vector< VECTOR2I > & CPoints() const
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
An abstract shape on 2D plane.
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
PLOT_DASH_TYPE GetPlotStyle() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
static constexpr EDA_ANGLE & ANGLE_180
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
TRANSFORM DefaultTransform
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
void GRFilledArc(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int width, const COLOR4D &Color, const COLOR4D &BgColor)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
void GRArc(wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int aWidth, const COLOR4D &aColor)
void GRPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
bool GetGRForceBlackPenState(void)
void GRFilledCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aStrokeColor, const COLOR4D &aFillColor)
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
#define MINIMUM_SELECTION_DISTANCE
static struct LIB_SHAPE_DESC _LIB_SHAPE_DESC
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Message panel definition file.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
PLOT_DASH_TYPE
Dashed line types.
constexpr int MilsToIU(int mils) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.