98 if( plotOnCopperLayer )
109 const bool useUTF8 =
false;
110 const bool useQuoting =
false;
124 if( !plotOnExternalCopperLayer )
154 if( plotOnExternalCopperLayer )
161 if( plotOnExternalCopperLayer )
172 if( plotOnExternalCopperLayer )
188 if( plotOnExternalCopperLayer )
255 coord[0] =
VECTOR2I( -half_size.
x - trap_delta.
y, half_size.
y + trap_delta.
x );
256 coord[1] =
VECTOR2I( half_size.
x + trap_delta.
y, half_size.
y - trap_delta.
x );
257 coord[2] =
VECTOR2I( half_size.
x - trap_delta.
y, -half_size.
y + trap_delta.
x );
258 coord[3] =
VECTOR2I( -half_size.
x + trap_delta.
y, -half_size.
y - trap_delta.
x );
286 if( polygons->OutlineCount() )
289 polygons.get(), aPlotMode, &gbr_metadata );
300 int textLayer = textItem->
GetLayer();
309 textItem = &aFootprint->
Value();
320 textItem = dyn_cast<const FP_TEXT*>( item );
349 switch( item->
Type() )
414 : wxString( wxEmptyString ),
452 callback_gal.SetIsStroke( font->
IsStroke() );
489 for(
const std::shared_ptr<SHAPE>& shape : aDim->
GetShapes() )
491 switch( shape->Type() )
495 const SEG& seg =
static_cast<const SHAPE_SEGMENT*
>( shape.get() )->GetSeg();
508 int radius =
static_cast<const SHAPE_CIRCLE*
>( shape.get() )->GetRadius();
528 int dx1, dx2, dy1, dy2, radius;
587 switch( item->Type() )
655 else if( isOnCopperLayer )
677 if( sketch || thickness > 0 )
734 std::vector<VECTOR2I> cornerList;
741 if( parentFootprint )
743 for(
unsigned ii = 0; ii < cornerList.size(); ++ii )
752 for(
size_t i = 1; i < cornerList.size(); i++ )
784 PlotPolyAsRegion( poly, fill_mode,
785 thickness, &gbr_metadata );
789 thickness, &gbr_metadata );
802 wxASSERT_MSG(
false, wxT(
"Unhandled FP_SHAPE shape" ) );
810 for(
SHAPE* shape : shapes )
815 m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
820 for(
SHAPE* shape : shapes )
835 : wxString( wxEmptyString ),
841 if( shownText.IsEmpty() )
881 callback_gal.SetIsStroke( font->
IsStroke() );
882 font->
Draw( &callback_gal, shownText, aText->
GetDrawPos(), attrs );
897 std::vector<VECTOR2I> positions;
898 wxArrayString strings_list;
900 positions.reserve( strings_list.Count() );
904 for(
unsigned ii = 0; ii < strings_list.Count(); ii++ )
906 wxString& txt = strings_list.Item( ii );
927 if( isOnCopperLayer )
955 for(
int idx = 0; idx < polysList.
OutlineCount(); ++idx )
1056 auto seg = it.Get();
1086 PlotPolyAsRegion( poly, fill, thickness, &gbr_metadata );
1122 PlotPolyAsRegion( poly, fill_mode, thickness, &gbr_metadata );
1139 for(
SHAPE* shape : shapes )
1144 m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
1149 for(
SHAPE* shape : shapes )
1157 const EDA_ANGLE& aOrientation,
int aSmallDrill )
1163 drillSize.
x = std::min( aSmallDrill, drillSize.
x );
1167 drillSize.
x =
Clamp( 1, drillSize.
x, aPadSize.
x - 1 );
1172 drillSize.
y =
Clamp( 1, drillSize.
y, aPadSize.
y - 1 );
1206 const PCB_VIA*
via = dyn_cast<const PCB_VIA*>( tracks );
1218 for(
PAD*
pad : footprint->Pads() )
1220 if(
pad->GetDrillSize().x == 0 )
1224 pad->GetSize(),
pad->GetOrientation(), smallDrill );
constexpr EDA_IU_SCALE pcbIUScale
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
wxString GetNetname() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual bool IsKnockout() const
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
BOARD_ITEM_CONTAINER * GetParent() const
FOOTPRINTS & Footprints()
void PlotDrillMarks()
Draw a drill mark for pads and vias.
void plotOneDrillMark(PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I &aDrillPos, const VECTOR2I &aDrillSize, const VECTOR2I &aPadSize, const EDA_ANGLE &aOrientation, int aSmallDrill)
Helper function to plot a single drill mark.
void PlotPcbShape(const PCB_SHAPE *aShape)
void PlotPcbGraphicItem(const BOARD_ITEM *item)
void PlotFilledAreas(const ZONE *aZone, PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
void PlotDimension(const PCB_DIMENSION_BASE *aDim)
void PlotPad(const PAD *aPad, const COLOR4D &aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
void PlotFootprintShape(const FP_SHAPE *aShape)
COLOR4D getColor(int aLayer) const
White color is special because it cannot be seen on a white paper in B&W mode.
void PlotBoardGraphicItems()
Plot items like text and graphics but not tracks and footprints.
void PlotPcbTarget(const PCB_TARGET *aMire)
void PlotFootprintTextItems(const FOOTPRINT *aFootprint)
int getFineWidthAdj() const
void PlotPcbText(const EDA_TEXT *aText, PCB_LAYER_ID aLayer, bool aIsKnockout)
void PlotFootprintGraphicItems(const FOOTPRINT *aFootprint)
void PlotFootprintTextItem(const FP_TEXT *aText, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
KICAD_T Type() const
Returns the type of object.
EDA_ANGLE GetArcAngle() const
const VECTOR2I & GetBezierC2() const
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
SHAPE_POLY_SET & GetPolyShape()
void SetFilled(bool aFlag)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
void DupPolyPointsList(std::vector< VECTOR2I > &aBuffer) const
Duplicate the list of corners in a std::vector<VECTOR2I>
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetShape(SHAPE_T aShape)
std::vector< VECTOR2I > GetRectCorners() const
void SetEnd(const VECTOR2I &aEnd)
wxString SHAPE_T_asString() const
const VECTOR2I & GetBezierC1() const
bool IsPolyShapeValid() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void TransformBoundingBoxToPolygon(SHAPE_POLY_SET *aBuffer, int aClearance) const
Convert the text bounding box to a rectangular polygon depending on the text orientation,...
const VECTOR2I & GetTextPos() const
bool IsMultilineAllowed() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
void GetLinePositions(std::vector< VECTOR2I > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
virtual EDA_ANGLE GetDrawRotation() const override
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
void FlashPadChamferRoundRect(const VECTOR2I &aShapePos, const VECTOR2I &aPadSize, int aCornerRadius, double aChamferRatio, int aChamferPositions, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aPlotMode, void *aData)
Flash a chamfered round rect pad.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
virtual bool IsStroke() const
virtual bool IsOutline() const
A color representation with 4 components: red, green, blue, alpha.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const wxString & GetDefaultFont() const
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
PAD_PROP GetProperty() const
PAD_ATTRIB GetAttribute() const
const wxString & GetPinFunction() const
const wxString & GetNumber() const
int GetRoundRectCornerRadius() const
VECTOR2I ShapePos() const
FOOTPRINT * GetParent() const
const VECTOR2I & GetDelta() const
PAD_SHAPE GetShape() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
int GetChamferPositions() const
const VECTOR2I & GetSize() const
double GetChamferRectRatio() const
int GetLineThickness() const
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
bool GetPlotInvisibleText() const
bool GetPlotReference() const
int GetSketchPadLineWidth() const
DRILL_MARKS GetDrillMarksType() const
bool GetPlotValue() const
OUTLINE_MODE GetPlotMode() const
COLOR_SETTINGS * ColorSettings() const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
FOOTPRINT * GetParentFootprint() const
Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
STROKE_PARAMS GetStroke() const override
void SetStroke(const STROKE_PARAMS &aStroke) override
VECTOR2I GetPosition() const override
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void FilledCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
virtual void BezierCurve(const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH)
Generic fallback: Cubic Bezier curve rendered as a polyline In KiCad the bezier curves have 4 control...
RENDER_SETTINGS * RenderSettings()
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr)
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
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 FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
Flash a trapezoidal pad.
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void ThickArc(const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData)
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void SetColor(const COLOR4D &color)=0
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN & Outline(int aIndex)
CONST_SEGMENT_ITERATOR CIterateSegments(int aFirst, int aLast, bool aIterateHoles=false) const
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET CloneDropTriangulation() const
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.
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)
PLOT_DASH_TYPE GetPlotStyle() const
Handle a list of polygons defining a copper zone.
bool IsOnCopperLayer() const override
static constexpr EDA_ANGLE & ANGLE_0
int GetKnockoutTextMargin(const VECTOR2I &aSize, int aThickness)
Returns the margin for knocking out text.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
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)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ CONN
Like smd, does not appear on the solder paste layer (default)
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
@ NONE
no special fabrication property
@ TESTPOINT
a test point pad
@ CASTELLATED
a pad with a castellated through hole
@ BGA
Smd pad, used in BGA footprints.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
PLOT_DASH_TYPE
Dashed line types.
constexpr int mmToIU(double mm) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double GetLineLength(const VECTOR2I &aPointA, const VECTOR2I &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.