40 EDA_SHAPE( aShape, aLineWidth, aFillType )
77 if(
GetShape() == SHAPE_T::RECTANGLE )
98 flip(
VECTOR2I( aCenter, 0 ), FLIP_DIRECTION::LEFT_RIGHT );
104 flip(
VECTOR2I( 0, aCenter ), FLIP_DIRECTION::TOP_BOTTOM );
116 return hitTest( aPosition, aAccuracy );
125 return hitTest( aRect, aContained, aAccuracy );
130 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
138 static std::vector<VECTOR2I> ptList;
147 else if(
GetShape() == SHAPE_T::BEZIER )
167 case FILL_T::FILLED_SHAPE:
170 case FILL_T::FILLED_WITH_COLOR:
174 case FILL_T::FILLED_WITH_BG_BODYCOLOR:
183 lineStyle = LINE_STYLE::SOLID;
190 if( lineStyle == LINE_STYLE::DEFAULT )
191 lineStyle = LINE_STYLE::SOLID;
193 if(
m_fill == FILL_T::FILLED_SHAPE )
196 fill = FILL_T::NO_FILL;
201 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
212 aPlotter->
SetDash( pen_size, lineStyle );
222 aPlotter->
Arc( start, mid, end, fill, pen_size );
225 case SHAPE_T::CIRCLE:
230 case SHAPE_T::RECTANGLE:
231 aPlotter->
Rect( start, end, fill, pen_size );
235 case SHAPE_T::BEZIER:
236 aPlotter->
PlotPoly( ptList, fill, pen_size );
243 aPlotter->
SetDash( pen_size, LINE_STYLE::SOLID );
272 const VECTOR2I& aOffset,
bool aDimmed )
280 static std::vector<VECTOR2I> ptList;
289 else if(
GetShape() == SHAPE_T::BEZIER )
310 case SHAPE_T::CIRCLE:
314 case SHAPE_T::RECTANGLE:
322 case SHAPE_T::BEZIER:
334 const VECTOR2I& aOffset,
bool aForceNoFill,
bool aDimmed )
344 if(
color == COLOR4D::UNSPECIFIED )
356 static std::vector<VECTOR2I> ptList;
365 else if(
GetShape() == SHAPE_T::BEZIER )
393 EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
396 if( transformed != transformed2 )
397 std::swap( start, end );
401 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
405 else if(
GetFillMode() == FILL_T::FILLED_WITH_COLOR )
407 else if(
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
410 if( fillColor != COLOR4D::UNSPECIFIED && !aForceNoFill )
415 fillColor = fillColor.
Mix( bg, 0.5f );
421 GRFilledArc( DC, end, start, center, 0, fillColor, fillColor );
424 case SHAPE_T::CIRCLE:
428 case SHAPE_T::RECTANGLE:
429 GRFilledRect( DC, start, end, 0, fillColor, fillColor );
433 GRPoly( DC, (
int) ptList.size(), ptList.data(),
true, 0, fillColor, fillColor );
436 case SHAPE_T::BEZIER:
437 GRPoly( DC, (
int) ptList.size(), ptList.data(),
true, 0, fillColor, fillColor );
454 GRArc( DC, end, start, center, penWidth,
color );
457 case SHAPE_T::CIRCLE:
461 case SHAPE_T::RECTANGLE:
466 GRPoly( DC, (
int) ptList.size(), ptList.data(),
false, penWidth,
color,
color );
469 case SHAPE_T::BEZIER:
470 GRPoly( DC, (
int) ptList.size(), ptList.data(),
false, penWidth,
color,
color );
481 for(
SHAPE* shape : shapes )
492 for(
SHAPE* shape : shapes )
515 return wxString::Format(
_(
"Arc, radius %s" ),
518 case SHAPE_T::CIRCLE:
519 return wxString::Format(
_(
"Circle, radius %s" ),
522 case SHAPE_T::RECTANGLE:
523 return wxString::Format(
_(
"Rectangle, width %s height %s" ),
528 return wxString::Format(
_(
"Polyline, %d points" ),
531 case SHAPE_T::BEZIER:
532 return wxString::Format(
_(
"Bezier Curve, %d points" ),
537 return wxEmptyString;
546 case SHAPE_T::SEGMENT:
return BITMAPS::add_line;
547 case SHAPE_T::ARC:
return BITMAPS::add_arc;
548 case SHAPE_T::CIRCLE:
return BITMAPS::add_circle;
549 case SHAPE_T::RECTANGLE:
return BITMAPS::add_rectangle;
550 case SHAPE_T::POLY:
return BITMAPS::add_graphical_segments;
551 case SHAPE_T::BEZIER:
return BITMAPS::add_bezier;
555 return BITMAPS::question_mark;
562 std::vector<int> layers( 3 );
644 if( fillEnum.
Choices().GetCount() == 0 )
646 fillEnum.
Map( FILL_T::NO_FILL,
_HKI(
"None" ) )
647 .
Map( FILL_T::FILLED_SHAPE,
_HKI(
"Body outline color" ) )
648 .
Map( FILL_T::FILLED_WITH_BG_BODYCOLOR,
_HKI(
"Body background color" ) )
649 .
Map( FILL_T::FILLED_WITH_COLOR,
_HKI(
"Fill color" ) );
665 return shape->GetShape() == SHAPE_T::POLY;
679 auto isSchematicItem =
689 _HKI(
"Position X" ), isPolygon );
691 _HKI(
"Position Y" ), isPolygon );
694 _HKI(
"Filled" ), isSchematicItem );
700 fillModeSetter, fillModeGetter ),
701 _HKI(
"Shape Properties" ) )
702 .SetAvailableFunc( isSymbolItem );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
VECTOR2I getCenter() const
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
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 operator==(const EDA_SHAPE &aOther) const
bool hitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
void flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
COLOR4D GetFillColor() const
void SwapShape(EDA_SHAPE *aImage)
std::vector< VECTOR2I > m_bezierPoints
wxString SHAPE_T_asString() const
double Similarity(const EDA_SHAPE &aOther) const
const BOX2I getBoundingBox() const
void SetFillMode(FILL_T aFill)
int Compare(const EDA_SHAPE *aOther) const
VECTOR2I GetArcMid() const
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
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.
int GetMinPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Base plotter engine class.
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)
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
bool GetColorMode() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
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()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
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.
Holds all the data relating to one schematic.
SCHEMATIC_SETTINGS & Settings() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual bool operator==(const SCH_ITEM &aOther) const
void SetLayer(SCH_LAYER_ID aLayer)
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the SCH_SHAPE.
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetStroke(const STROKE_PARAMS &aStroke) override
LINE_STYLE GetEffectiveLineStyle() const
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Print just the background fills.
SCH_SHAPE(SHAPE_T aShape=SHAPE_T::UNDEFINED, SCH_LAYER_ID aLayer=LAYER_NOTES, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, KICAD_T aType=SCH_SHAPE_T)
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void AddPoint(const VECTOR2I &aPosition)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
bool operator==(const SCH_ITEM &aOther) const override
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
int GetPenWidth() const override
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
int GetEffectiveWidth() const override
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
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 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.
Simple container to manage line stroke parameters.
LINE_STYLE GetLineStyle() 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)
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
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).
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Message panel definition file.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
static struct SCH_SHAPE_DESC _SCH_SHAPE_DESC
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I