65 #include <wx/gdicmn.h> 83 wxPoint shape_pos = aPad->
ShapePos();
96 if( plotOnCopperLayer )
107 const bool useUTF8 =
false;
108 const bool useQuoting =
false;
122 if( !plotOnExternalCopperLayer )
152 if( plotOnExternalCopperLayer )
159 if( plotOnExternalCopperLayer )
170 if( plotOnExternalCopperLayer )
186 if( plotOnExternalCopperLayer )
250 wxSize half_size = aPad->
GetSize()/2;
251 wxSize trap_delta = aPad->
GetDelta()/2;
253 coord[0] = wxPoint( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
254 coord[1] = wxPoint( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
255 coord[2] = wxPoint( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
256 coord[3] = wxPoint( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
266 static_cast<GERBER_PLOTTER*>(
m_plotter )->FlashPadChamferRoundRect(
282 if( polygons->OutlineCount() )
285 polygons.get(), aPlotMode, &gbr_metadata );
305 textItem = &aFootprint->
Value();
316 textItem = dyn_cast<const FP_TEXT*>( item );
347 switch( item->Type() )
397 bool allow_bold =
true;
412 aTextMod->
IsItalic(), allow_bold,
false, &gbr_metadata );
434 for(
const std::shared_ptr<SHAPE>& shape : aDim->
GetShapes() )
436 switch( shape->Type() )
440 const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
444 draw.
SetEnd( wxPoint( seg.
B ) );
452 wxPoint start( shape->Centre() );
453 int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
458 draw.
SetEnd( wxPoint( start.x + radius, start.y ) );
473 int dx1, dx2, dy1, dy2, radius;
515 draw.
SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
516 draw.
SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
519 draw.
SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
520 draw.
SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
529 const FP_SHAPE* shape = dynamic_cast<const FP_SHAPE*>( item );
558 else if( isOnCopperLayer )
577 if( sketch || thickness > 0 )
589 for(
const wxPoint& pt : pts )
618 double endAngle = startAngle + aShape->
GetArcAngle();
637 std::vector<wxPoint> cornerList;
644 if( parentFootprint )
646 for(
unsigned ii = 0; ii < cornerList.size(); ++ii )
648 wxPoint* corner = &cornerList[ii];
656 for(
size_t i = 1; i < cornerList.size(); i++ )
695 wxASSERT_MSG(
false, wxT(
"Unhandled FP_SHAPE shape" ) );
705 if( shownText.IsEmpty() )
731 bool allow_bold =
true;
737 std::vector<wxPoint> positions;
738 wxArrayString strings_list;
740 positions.reserve( strings_list.Count() );
744 for(
unsigned ii = 0; ii < strings_list.Count(); ii++ )
746 wxString& txt = strings_list.Item( ii );
749 allow_bold,
false, &gbr_metadata );
756 false, &gbr_metadata );
770 if( isOnCopperLayer )
802 for(
int idx = 0; idx < polysList.
OutlineCount(); ++idx )
812 if( outline_thickness > 0 )
823 wxPoint( outline.
CPoint( last_idx ) ),
828 static_cast<GERBER_PLOTTER*>(
m_plotter )->PlotGerberRegion( outline,
839 if( outline_thickness )
843 for(
int jj = 1; jj <= last_idx; jj++ )
846 wxPoint( outline.
CPoint( jj ) ),
855 wxPoint( outline.
CPoint( last_idx ) ),
915 double endAngle = startAngle + aShape->
GetArcAngle();
978 if( sketch || thickness > 0 )
990 for(
const wxPoint& pt : pts )
1006 const wxSize& aDrillSize,
const wxSize& aPadSize,
1007 double aOrientation,
int aSmallDrill )
1009 wxSize drillSize = aDrillSize;
1013 drillSize.x = std::min( aSmallDrill, drillSize.x );
1017 drillSize.x =
Clamp( 1, drillSize.x, aPadSize.x - 1 );
1022 drillSize.y =
Clamp( 1, drillSize.y, aPadSize.y - 1 );
1055 const PCB_VIA*
via = dyn_cast<const PCB_VIA*>( tracks );
1060 wxSize(
via->GetDrillValue(), 0 ),
1061 wxSize(
via->GetWidth(), 0 ), 0, smallDrill );
1067 for(
PAD*
pad : footprint->Pads() )
1069 if(
pad->GetDrillSize().x == 0 )
1073 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.
OUTLINE_MODE GetPlotMode() const
void PlotPcbTarget(const PCB_TARGET *aMire)
COLOR4D getColor(LAYER_NUM aLayer) const
White color is special because it cannot be seen on a white paper in B&W mode.
void plotOneDrillMark(PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, const wxSize &aDrillSize, const wxSize &aPadSize, double aOrientation, int aSmallDrill)
Helper function to plot a single drill mark.
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
class PCB_DIM_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...
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
void SetFilled(bool aFlag)
void SetEnd(const wxPoint &aEnd)
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...
const wxPoint & GetStart() const
Return the starting point of the graphic.
PAD_PROP GetProperty() const
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
void PlotFootprintGraphicItems(const FOOTPRINT *aFootprint)
class PCB_DIM_CENTER, a center point marking (graphic item)
Like smd, does not appear on the solder paste layer (default)
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
void PlotDrillMarks()
Draw a drill mark for pads and vias.
void DupPolyPointsList(std::vector< wxPoint > &aBuffer) const
Duplicate the list of corners in a std::vector<wxPoint>
double GetArcAngle() const
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 PlotPcbText(const PCB_TEXT *aText)
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
int LAYER_NUM
This can be replaced with int and removed.
virtual void FilledCircle(const wxPoint &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
wxString GetNetname() const
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 ...
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 PlotFootprintGraphicItem(const FP_SHAPE *aShape)
void RotatePoint(int *pX, int *pY, double angle)
void PlotPad(const PAD *aPad, const COLOR4D &aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
void PlotFootprintTextItems(const FOOTPRINT *aFootprint)
bool IsPolyShapeValid() const
int PointCount() const
Return the number of points (vertices) in this line chain.
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)
Append a new point at the end of the line chain.
This file contains miscellaneous commonly used macros and functions.
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
Flash a trapezoidal pad.
Board plot function definition file.
void SetStart(const wxPoint &aStart)
a pad used as heat sink, usually in SMD footprints
wxPoint GetPosition() const override
const wxPoint & GetBezierC1() const
std::vector< wxPoint > GetRectCorners() const
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
like PAD_PTH, but not plated
const wxPoint & GetEnd() const
Return the ending point of the graphic.
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
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)...
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
virtual bool IsVisible() const
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
int getFineWidthAdj() const
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Smd pad, used in BGA footprints.
const wxPoint & GetBezierC2() const
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
const wxString & GetNumber() const
#define UNIMPLEMENTED_FOR(type)
PAD_SHAPE GetShape() const
a fiducial (usually a smd) local to the parent footprint
void SetWidth(int aWidth)
Handle a list of polygons defining a copper zone.
wxString SHAPE_T_asString() const
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
SHAPE_POLY_SET & GetPolyShape()
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
bool IsMultilineAllowed() const
class PCB_TARGET, a target (graphic item)
virtual void SetColor(const COLOR4D &color)=0
bool GetPlotValue() const
void PlotFilledAreas(const ZONE *aZone, const SHAPE_POLY_SET &aPolysList)
int GetRoundRectCornerRadius() const
const wxSize & GetDelta() const
FOOTPRINT * GetParent() const
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
COLOR4D GetColor(int aLayer) const
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
a fiducial (usually a smd) for the full board
double GetChamferRectRatio() const
FOOTPRINT * GetParentFootprint() const
Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
no special fabrication property
void PlotPcbShape(const PCB_SHAPE *aShape)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PAD_ATTRIB GetAttribute() const
void SetShape(SHAPE_T aShape)
bool IsOnCopperLayer() const override
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)
Limit 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...
int GetChamferPositions() const
const wxPoint & GetTextPos() 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=nullptr)
Draw text with the plotter.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
COLOR_SETTINGS * ColorSettings() const
a pad with a castellated through hole
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
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
void PlotDimension(const PCB_DIMENSION_BASE *aDim)
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
const wxString & GetPinFunction() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
bool GetPlotReference() const
virtual const wxString & GetText() const
Return the string associated with the text object.
int GetLineThickness() const
void PlotFootprintTextItem(const FP_TEXT *aText, const COLOR4D &aColor)
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
KICAD_T Type() const
Returns the type of object.
bool GetFilledPolysUseThickness() const
A color representation with 4 components: red, green, blue, alpha.