91 wxPoint shape_pos = aPad->
ShapePos();
104 if( plotOnCopperLayer )
114 const bool useUTF8 =
false;
115 const bool useQuoting =
false;
118 if( !aPad->
GetName().IsEmpty() )
129 if( !plotOnExternalCopperLayer )
158 if( plotOnExternalCopperLayer )
164 if( plotOnExternalCopperLayer )
174 if( plotOnExternalCopperLayer )
187 if( plotOnExternalCopperLayer )
247 wxSize half_size = aPad->
GetSize()/2;
248 wxSize trap_delta = aPad->
GetDelta()/2;
250 coord[0] = wxPoint( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
251 coord[1] = wxPoint( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
252 coord[2] = wxPoint( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
253 coord[3] = wxPoint( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
263 static_cast<GERBER_PLOTTER*>(
m_plotter )->FlashPadChamferRoundRect(
278 if( polygons->OutlineCount() )
281 polygons.get(), aPlotMode, &gbr_metadata );
301 textItem = &aFootprint->
Value();
312 textItem = dyn_cast<FP_TEXT*>( item );
344 switch( item->Type() )
395 bool allow_bold =
true;
406 aTextMod->
IsItalic(), allow_bold,
false, &gbr_metadata );
428 for(
const std::shared_ptr<SHAPE>& shape : aDim->
GetShapes() )
430 switch( shape->Type() )
434 const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
438 draw.
SetEnd( wxPoint( seg.
B ) );
446 wxPoint start( shape->Centre() );
447 int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
452 draw.
SetEnd( wxPoint( start.x + radius, start.y ) );
467 int dx1, dx2, dy1, dy2, radius;
509 draw.
SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
510 draw.
SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
513 draw.
SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
514 draw.
SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
524 FP_SHAPE* shape = dynamic_cast<FP_SHAPE*>( item );
543 wxPoint end( aShape->
GetEnd() );
552 if( isOnCopperLayer )
555 gbr_metadata.SetCopper(
true );
574 if( sketch || thickness > 0 )
586 for(
const wxPoint& pt : pts )
607 double startAngle =
ArcTangente( end.y - pos.y, end.x - pos.x );
608 double endAngle = startAngle + aShape->
GetAngle();
611 if( std::abs( aShape->
GetAngle() ) == 3600.0 )
632 std::vector<wxPoint> cornerList;
634 cornerList.reserve( polyPoints.size() );
636 for( wxPoint corner : polyPoints )
638 if( parentFootprint )
644 cornerList.push_back( corner );
647 if( sketch || thickness > 0 )
649 for(
size_t i = 1; i < cornerList.size(); i++ )
687 wxASSERT_MSG(
false,
"Unhandled FP_SHAPE shape" );
698 if( shownText.IsEmpty() )
724 bool allow_bold =
true;
730 std::vector<wxPoint> positions;
731 wxArrayString strings_list;
733 positions.reserve( strings_list.Count() );
737 for(
unsigned ii = 0; ii < strings_list.Count(); ii++ )
739 wxString& txt = strings_list.Item( ii );
742 allow_bold,
false, &gbr_metadata );
749 false, &gbr_metadata );
763 if( isOnCopperLayer )
783 std::vector< wxPoint > cornerList;
797 for(
int idx = 0; idx < polysList.
OutlineCount(); ++idx )
804 for(
int ic = 0; ic < outline.
PointCount(); ++ic )
806 cornerList.emplace_back( wxPoint( outline.
CPoint( ic ) ) );
809 if( cornerList.size() )
812 if( cornerList[0] != cornerList[cornerList.size() - 1] )
813 cornerList.push_back( cornerList[0] );
821 if( outline_thickness > 0 )
827 static_cast<GERBER_PLOTTER*>(
m_plotter )->PlotGerberRegion( cornerList,
838 if( outline_thickness )
840 for(
unsigned jj = 1; jj < cornerList.size(); jj++ )
864 double StAngle = 0, EndAngle = 0;
870 wxPoint start( aShape->
GetStart() );
871 wxPoint end( aShape->
GetEnd() );
902 StAngle =
ArcTangente( end.y - start.y, end.x - start.x );
903 EndAngle = StAngle + aShape->
GetAngle();
906 if( std::abs( aShape->
GetAngle() ) == 3600.0 )
925 if( sketch || thickness > 0 )
946 for(
int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
959 if( sketch || thickness > 0 )
971 for(
const wxPoint& pt : pts )
980 wxASSERT_MSG(
false,
"Unhandled PCB_SHAPE shape" );
990 wxSize aDrillSize,
const wxSize &aPadSize,
991 double aOrientation,
int aSmallDrill )
995 aDrillSize.x = std::min( aSmallDrill, aDrillSize.x );
999 aDrillSize.x =
Clamp( 1, aDrillSize.x, aPadSize.x - 1 );
1004 aDrillSize.y =
Clamp( 1, aDrillSize.y, aPadSize.y - 1 );
1037 const VIA* via = dyn_cast<const VIA*>( tracks );
1043 wxSize( via->
GetWidth(), 0 ), 0, smallDrill );
1049 for(
PAD* pad : footprint->Pads() )
1051 if( pad->GetDrillSize().x == 0 )
1054 plotOneDrillMark( pad->GetDrillShape(), pad->GetPosition(), pad->GetDrillSize(),
1055 pad->GetSize(), pad->GetOrientation(), smallDrill );
virtual double GetDrawRotation() const override
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
bool IsPolyShapeValid() const
OUTLINE_MODE GetPlotMode() const
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
class ALIGNED_DIMENSION, a linear dimension (graphic item)
class LEADER, a leader dimension (graphic item)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, OUTLINE_MODE aTraceMode, void *aData)=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...
no special fabrication property
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
SHAPE_POLY_SET & GetPolyShape()
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Plotting engines (PostScript, Gerber, HPGL and DXF)
virtual void SetColor(COLOR4D color)=0
const wxPoint & GetStart() const
void SetFilled(bool aFlag)
class CENTER_DIMENSION, a center point marking (graphic item)
void PlotPcbText(PCB_TEXT *aText)
a fiducial (usually a smd) for the full board
std::vector< wxPoint > GetRectCorners() const
Smd pad, appears on the solder paste layer (default)
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
polygon (not yet used for tracks, but could be in microwave apps)
void PlotDrillMarks()
Function PlotDrillMarks Draw a drill mark for pads and vias.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
double GetTextAngle() const
class PCB_TEXT, text on a layer
void PlotFootprintTextItems(FOOTPRINT *aFootprint)
usual segment : line with rounded ends
Smd pad, used in BGA footprints.
virtual void FilledCircle(const wxPoint &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
wxString GetNetname() const
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_TYPE aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Draw a polygon ( filled or not )
class FP_SHAPE, a footprint edge
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
PAD_SHAPE_T GetShape() const
virtual void BezierCurve(const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &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...
void RotatePoint(int *pX, int *pY, double angle)
like PAD_PTH, but not plated mechanical use only, no connection allowed
a pad used as heat sink, usually in SMD footprints
segment with non rounded ends
int PointCount() const
Function PointCount()
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData)
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
Flash a trapezoidal pad.
a pad with a castellated through hole
int GetLineThickness() const
PAD_ATTR_T GetAttribute() const
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Board plot function definition file.
wxPoint GetPosition() const override
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
const VECTOR2I & CPoint(int aIndex) const
Function Point()
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
void SetClosed(bool aClosed)
Function SetClosed()
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
int GetMinThickness() const
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
void SetShape(PCB_SHAPE_TYPE_T aShape)
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
void PlotPcbTarget(PCB_TARGET *PtMire)
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
void PlotBoardGraphicItems()
plot items like text and graphics, but not tracks and footprints
const wxSize & GetTextSize() const
FOOTPRINTS & Footprints()
const wxSize & GetSize() const
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
const wxString & GetName() const
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
void PlotFootprintTextItem(FP_TEXT *aText, COLOR4D aColor)
void PlotFootprintGraphicItems(FOOTPRINT *aFootprint)
ZONE handles a list of polygons defining a copper zone.
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
PAD_PROP_T GetProperty() const
bool IsMultilineAllowed() const
class PCB_TARGET, a target (graphic item)
int LAYER_NUM
This can be replaced with int and removed.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
bool GetPlotValue() const
int GetRoundRectCornerRadius() const
const wxSize & GetDelta() const
FOOTPRINT * GetParent() const
void PlotFilledAreas(ZONE *aZone, SHAPE_POLY_SET &aPolysList)
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void PlotPad(PAD *aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
COLOR4D GetColor(int aLayer) const
a fiducial (usually a smd) local to the parent footprint
Board layer functions and definitions.
double GetChamferRectRatio() const
void plotOneDrillMark(PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, wxSize aDrillSize, const wxSize &aPadSize, double aOrientation, int aSmallDrill)
Helper function to plot a single drill mark.
FOOTPRINT * GetParentFootprint() const
Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not ...
void SetStart(const wxPoint &aStart)
void PlotPcbShape(PCB_SHAPE *aShape)
void PlotFootprintGraphicItem(FP_SHAPE *aShape)
const wxPoint & GetBezControl2() const
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
void SetWidth(int aWidth)
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
bool GetPlotInvisibleText() const
int GetSketchPadLineWidth() const
virtual void ThickArc(const wxPoint ¢re, double StAngle, double EndAngle, int rayon, int width, OUTLINE_MODE tracemode, void *aData)
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData)=0
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
int GetChamferPositions() const
const wxPoint & GetTextPos() const
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
COLOR_SETTINGS * ColorSettings() const
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
PCB_SHAPE_TYPE_T GetShape() const
CONST_SEGMENT_ITERATOR CIterateSegments(int aFirst, int aLast, bool aIterateHoles=false) const
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
double ArcTangente(int dy, int dx)
BOARD_ITEM_CONTAINER * GetParent() const
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
DrillMarksType GetDrillMarksType() const
class PCB_SHAPE, a segment not on copper layers
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
const wxString & GetPinFunction() const
const wxPoint & GetBezControl1() const
bool GetPlotReference() const
void PlotDimension(DIMENSION_BASE *Dimension)
virtual const wxString & GetText() const
Return the string associated with the text object.
COLOR4D getColor(LAYER_NUM aLayer)
Function getColor.
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
void SetEnd(const wxPoint &aEnd)
KICAD_T Type() const
Returns the type of object.
bool GetFilledPolysUseThickness() const
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
A color representation with 4 components: red, green, blue, alpha.