50 bool aPlotFPText,
bool aPlotReferences,
bool aPlotValues );
68 LSET layers = { aLayer };
82 itemplotter.
PlotZone( &zone, aLayer, *aPolySet );
97 PlotLayer( aBoard, aPlotter, aLayerMask, aPlotOpt );
107 PlotPolySet( aBoard, aPlotter, aPlotOpt, &solderMask, layer );
124 PlotPolySet( aBoard, aPlotter, aPlotOpt, &silkscreen, silkLayer );
131 if( !aBoard || !aPlotter || aLayers.empty() )
150 if( mapLayers.any() )
178 bool onBack = fp->GetLayer() ==
B_Cu;
190 std::vector<wxString> properties;
192 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
193 _(
"Reference designator" ),
194 fp->Reference().GetShownText(
FOR_GUI ) ) );
196 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
198 fp->Value().GetShownText(
FOR_GUI ) ) );
200 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
202 fp->GetFPID().GetUniStringLibItemName() ) );
204 for(
const PCB_FIELD* field : fp->GetFields() )
206 wxCHECK2( field,
continue );
208 if( field->IsReference() || field->IsValue() )
211 if( field->GetText().IsEmpty() )
214 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
216 field->GetText() ) );
221 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
_(
"Library Description" ),
222 fp->GetLibDescription() ) );
224 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
_(
"Keywords" ),
225 fp->GetKeywords() ) );
232 BOX2I bbox = fp->GetBoundingBox(
false );
239 bbox = fp->GetBoundingBox(
true );
242 aPlotter->
Bookmark( bbox, fp->GetReference(),
_(
"Footprints" ) );
258 LSET layer_mask( { aLayer } );
269 PlotLayer( aBoard, aPlotter, layer_mask, plotOpt );
295 PlotLayer( aBoard, aPlotter, layer_mask, plotOpt );
333 PlotLayer( aBoard, aPlotter, layer_mask, plotOpt );
347 PlotLayer( aBoard, aPlotter, layer_mask, plotOpt );
368 bool onFrontFab = (
LSET( {
F_Fab } ) & aLayerMask ).any();
369 bool onBackFab = (
LSET( {
B_Fab } ) & aLayerMask ).any();
388 const bool dnp = footprint->GetDNPForVariant( variantName );
392 for(
PAD*
pad : footprint->Pads() )
394 bool doSketchPads =
false;
396 if( !(
pad->GetLayerSet() & aLayerMask ).any() )
398 if( sketchPads && ( ( onFrontFab &&
pad->GetLayerSet().Contains(
F_Cu ) )
399 || ( onBackFab &&
pad->GetLayerSet().Contains(
B_Cu ) ) ) )
409 if( onCopperLayer && !
pad->IsOnCopperLayer() )
413 if( onCopperLayer && !
pad->FlashLayer( aLayerMask ) )
421 if( aLayerMask.count() == 1 )
427 if( (
pad->GetLayerSet() & aLayerMask )[
B_Cu] )
430 if( (
pad->GetLayerSet() & aLayerMask )[
F_Cu] )
433 if( sketchPads && aLayerMask[
F_Fab] )
435 else if( sketchPads && aLayerMask[
B_Fab] )
439 if( sketchPads && ( ( onFrontFab &&
pad->GetLayerSet().Contains(
F_Cu ) )
440 || ( onBackFab &&
pad->GetLayerSet().Contains(
B_Cu ) ) ) )
455 if( onSolderMaskLayer )
456 margin.
x = margin.
y =
pad->GetSolderMaskExpansion( aLayer );
458 if( onSolderPasteLayer )
459 margin =
pad->GetSolderPasteMargin( aLayer );
465 int mask_clearance = margin.
x;
467 bool sameXYClearance = margin.
x == margin.
y;
470 VECTOR2I padPlotsSize =
pad->GetSize( aLayer ) + margin * 2 +
VECTOR2I( width_adj, width_adj );
478 double padCornerRadiusRatio =
pad->GetRoundRectRadiusRatio( aLayer );
483 && ( padPlotsSize.
x <= 0 || padPlotsSize.
y <= 0 ) )
492 pad->SetSize( aLayer, padPlotsSize );
496 (
pad->GetSize(aLayer ) ==
pad->GetDrillSize() ) &&
502 itemplotter.
PlotPad(
pad, aLayer, color, doSketchPads );
506 pad->SetSize( aLayer, padPlotsSize );
508 if( mask_clearance > 0 )
511 pad->SetRoundRectCornerRadius( aLayer, mask_clearance );
514 itemplotter.
PlotPad(
pad, aLayer, color, doSketchPads );
523 if( mask_clearance == 0 )
525 itemplotter.
PlotPad(
pad, aLayer, color, doSketchPads );
534 int dx = padSize.
x / 2;
535 int dy = padSize.
y / 2;
536 int ddx = padDelta.
x / 2;
537 int ddy = padDelta.
y / 2;
539 outline.
Append( -dx - ddy, dy + ddx );
540 outline.
Append( dx + ddy, dy - ddx );
541 outline.
Append( dx - ddy, -dy + ddx );
542 outline.
Append( -dx + ddy, -dy - ddx );
548 dummy.DeletePrimitivesList();
549 dummy.AddPrimitivePoly( aLayer, outline, 0,
true );
556 itemplotter.
PlotPad( &
dummy, aLayer, color, doSketchPads );
567 if( sameXYClearance )
569 int originalRadius =
pad->GetRoundRectCornerRadius( aLayer );
570 int newRadius = std::max( 0, originalRadius + mask_clearance + width_adj / 2 );
571 pad->SetSize( aLayer, padPlotsSize );
572 pad->SetRoundRectCornerRadius( aLayer, newRadius );
582 double radiusRatio =
pad->GetRoundRectRadiusRatio( aLayer );
583 pad->SetSize( aLayer, padPlotsSize );
584 pad->SetRoundRectRadiusRatio( aLayer, radiusRatio );
587 itemplotter.
PlotPad(
pad, aLayer, color, doSketchPads );
594 if( mask_clearance <= 0 )
597 pad->SetSize( aLayer, padPlotsSize );
598 itemplotter.
PlotPad(
pad, aLayer, color, doSketchPads );
614 if( !sameXYClearance )
615 dummy.SetSize( aLayer, padPlotsSize );
621 if( sameXYClearance )
628 dummy.DeletePrimitivesList();
629 dummy.AddPrimitivePoly( aLayer, outline, 0,
true );
636 dummy.SetPosition(
pad->GetPosition() );
637 dummy.SetOffset( aLayer,
pad->GetOffset( aLayer ) );
638 dummy.SetOrientation(
pad->GetOrientation() );
640 itemplotter.
PlotPad( &
dummy, aLayer, color, doSketchPads );
650 dummy.SetParentGroup(
nullptr );
653 pad->MergePrimitivesAsPolygon( aLayer, &shape );
659 dummy.DeletePrimitivesList();
660 dummy.AddPrimitivePoly( aLayer, shape, 0,
true );
665 if( mask_clearance < 0 )
668 std::max( 0, padPlotsSize.
y ) ) );
671 itemplotter.
PlotPad( &
dummy, aLayer, color, doSketchPads );
677 pad->SetSize( aLayer, padSize );
678 pad->SetDelta( aLayer, padDelta );
679 pad->SetShape( aLayer, padShape );
680 pad->SetRoundRectRadiusRatio( aLayer, padCornerRadiusRatio );
684 plotPadLayer( layer );
690 && ( ( onFrontFab && footprint->GetLayer() ==
F_Cu )
691 || ( onBackFab && footprint->GetLayer() ==
B_Cu ) ) )
695 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( footprint->GetLayer() );
697 EDA_ANGLE orient = footprint->GetOrientation();
706 std::shared_ptr<SHAPE> shape = footprint->GetEffectiveShape();
707 shape->Rotate( -orient,
center );
708 localRect = shape->BBox();
714 localRect = temp.
BBox();
733 aPlotter->
SetColor( dnpMarkerColor );
737 aPlotter->
ThickSegment( corner1, corner3, width,
nullptr );
738 aPlotter->
ThickSegment( corner2, corner4, width,
nullptr );
758 return (
void*) &gbr_metadata;
760 return (
void*) &aPlotOpt;
762 return (
void*)
nullptr;
775 LSET via_mask_layer =
via->GetLayerSet();
777 if( !( via_mask_layer & aLayerMask ).
any() )
781 double width_adj = 0;
784 if( onSolderMaskLayer )
785 via_margin =
via->GetSolderMaskExpansion();
791 if( onCopperLayer && !
via->FlashLayer( aLayerMask ) )
797 diameter = std::max( diameter,
via->GetWidth( layer ) );
799 diameter += 2 * via_margin + width_adj;
814 if( aLayerMask.count() == 1 )
849 if( !( aLayerMask & track->GetLayerSet() ).any() )
856 gbr_metadata.
SetNetName( track->GetNetname() );
860 if( onSolderMaskLayer )
861 margin = track->GetSolderMaskExpansion();
863 int width = track->GetWidth() + 2 * margin + itemplotter.
getFineWidthAdj();
897 for(
const ZONE* zone : aBoard->
Zones() )
899 if( zone->GetIsRuleArea() )
904 if( !aLayerMask[layer] )
912 if( zone->IsIsland( layer, i ) )
919 itemplotter.
PlotZone( zone, layer, mainArea );
924 dummy.SetNet( &nonet );
955 std::vector<VECTOR2I> cornerList;
960 for(
int kk = 0; kk <= outlines.
HoleCount(ii); kk++ )
964 : outlines.
CHole( ii, kk - 1 );
975 for(
PAD*
pad : footprint->Pads() )
979 if(
pad->GetDrillSize().x ==
pad->GetDrillSize().y )
981 int drill =
pad->GetDrillSize().x;
984 drill = std::min( smallDrill, drill );
1010 if(
via->GetLayerSet().Contains( layer ) )
1024 bool aPlotFPText,
bool aPlotReferences,
bool aPlotValues )
1048 auto handlePcbShape =
1051 LINE_STYLE lineStyle = aPcbShape.GetStroke().GetLineStyle();
1056 aPcbShape.TransformShapeToPolySet( exactPolys, aLayer, 0, maxError,
ERROR_OUTSIDE );
1058 aPcbShape.TransformShapeToPolySet( *aResult, aLayer, inflate, maxError,
ERROR_OUTSIDE );
1062 int thickness = aPcbShape.GetWidth();
1063 std::vector<SHAPE*> shapes = aPcbShape.MakeEffectiveShapesForStroking( thickness );
1064 int minSegCount = 8;
1066 for(
SHAPE* shape : shapes )
1073 TransformOvalToPolygon( exactPolys, a, b,
1074 thickness, maxError, ERROR_OUTSIDE, minSegCount );
1082 for(
SHAPE* shape : shapes )
1087 auto handleFPTextItem =
1093 if( aText.GetText() == wxT(
"${REFERENCE}" ) && !aPlotReferences )
1096 if( aText.GetText() == wxT(
"${VALUE}" ) && !aPlotValues )
1100 aText.TransformTextToPolySet( exactPolys, 0, maxError,
ERROR_OUTSIDE );
1102 aText.TransformTextToPolySet( *aResult, inflate, maxError,
ERROR_OUTSIDE );
1105 auto handleTextBoxItem =
1109 aTextBox.TransformTextToPolySet( exactPolys, 0, maxError,
ERROR_OUTSIDE );
1111 aTextBox.TransformTextToPolySet( *aResult, inflate, maxError,
ERROR_OUTSIDE );
1114 if( aTextBox.IsBorderEnabled() && !aTextBox.IsKnockout() )
1116 PCB_SHAPE shapebox = aTextBox.GetPolygonalBoxShape();
1117 handlePcbShape( shapebox );
1126 for(
const FOOTPRINT* footprint : aBoard->Footprints() )
1129 footprint->TransformPadsToPolySet( exactPolys, aLayer, 0, maxError,
ERROR_OUTSIDE );
1131 int outlinesBefore = aResult->OutlineCount();
1133 footprint->TransformPadsToPolySet( *aResult, aLayer, inflate, maxError,
ERROR_OUTSIDE );
1135 if( aResult->OutlineCount() > outlinesBefore )
1136 aPlotter->MarkFootprintPlotted( footprint );
1138 for(
const PCB_FIELD* field : footprint->GetFields() )
1140 wxCHECK2( field,
continue );
1142 if( field->IsReference() && !aPlotReferences )
1145 if( field->IsValue() && !aPlotValues )
1148 if( field->IsVisible() && field->IsOnLayer( aLayer ) )
1150 aPlotter->MarkFootprintPlotted( footprint );
1151 handleFPTextItem(
static_cast<const PCB_TEXT&
>( *field ) );
1155 for(
const BOARD_ITEM* item : footprint->GraphicalItems() )
1157 if( item->IsOnLayer( aLayer ) )
1159 aPlotter->MarkFootprintPlotted( footprint );
1163 handleFPTextItem(
static_cast<const PCB_TEXT&
>( *item ) );
1167 handleTextBoxItem(
static_cast<const PCB_TEXTBOX&
>( *item ) );
1173 handlePcbShape( *pcb_shape );
1178 item->TransformShapeToPolySet( exactPolys, aLayer, 0, maxError,
ERROR_OUTSIDE );
1180 item->TransformShapeToPolySet( *aResult, aLayer, inflate, maxError,
ERROR_OUTSIDE );
1188 for(
const PCB_TRACK* track : aBoard->Tracks() )
1191 if( !track->IsOnLayer( aLayer ) )
1194 int clearance = track->GetSolderMaskExpansion();
1202 for(
const BOARD_ITEM* item : aBoard->Drawings() )
1204 if( item->IsOnLayer( aLayer ) )
1217 handleTextBoxItem(
static_cast<const PCB_TEXTBOX&
>( *item ) );
1223 handlePcbShape( *pcb_shape );
1229 item->TransformShapeToPolySet( exactPolys, aLayer, 0, maxError,
ERROR_OUTSIDE,
1230 aPlotter->RenderSettings() );
1233 item->TransformShapeToPolySet( *aResult, aLayer, inflate, maxError,
ERROR_OUTSIDE,
1234 aPlotter->RenderSettings() );
1241 for(
ZONE* zone : aBoard->Zones() )
1243 if( zone->GetIsRuleArea() )
1246 if( !zone->IsOnLayer( aLayer ) )
1257 exactPolys.
Append( area );
1260 aResult->Append( area );
1265 aResult->Simplify();
1272 aResult->BooleanAdd( exactPolys );
1292 bool autocenter =
false;
1301 sheet_info = &pageA4;
1303 paperscale = (double) paperSizeIU.
x / pageSizeIU.
x;
1308 sheet_info = &pageInfo;
1309 paperSizeIU = pageSizeIU;
1320 double compound_scale;
1324 if( aPlotOpts->
GetAutoScale() && boardSize.
x > 0 && boardSize.
y > 0 )
1326 double xscale = (paperSizeIU.
x * 0.8) / boardSize.
x;
1327 double yscale = (paperSizeIU.
y * 0.8) / boardSize.
y;
1329 compound_scale = std::min( xscale, yscale ) * paperscale;
1333 compound_scale = aPlotOpts->
GetScale() * paperscale;
1342 offset.
x =
KiROUND( boardCenter.
x - ( paperSizeIU.
x / 2.0 ) / compound_scale );
1343 offset.
y =
KiROUND( boardCenter.
y - ( paperSizeIU.
y / 2.0 ) / compound_scale );
1382 BOX2I area = aBbbox;
1416 const wxString& aLayerName,
const wxString& aFullFileName,
1417 const wxString& aSheetName,
const wxString& aSheetPath,
1418 const wxString& aPageName,
const wxString& aPageNumber,
1419 const int aPageCount )
1421 wxCHECK( aBoard && aPlotOpts,
nullptr );
1433 plotter = DXF_plotter;
1444 plotter = PS_plotter;
1452 wxLogError(
_(
"HPGL plotting is no longer supported as of KiCad 10.0" ) );
1460 wxLogError( wxString::Format(
"Invalid board layer %d, cannot build a valid Gerber file header",
1478 double iuPerInch =
pcbIUScale.IU_PER_MILS * 1000.0;
1481 KiROUND( sizeIU.
y * dpi / iuPerInch ) );
1484 plotter = pngPlotter;
1519 if( plotter->
OpenFile( aFullFileName ) )
1537 bool startPlotSuccess =
false;
1541 startPlotSuccess =
static_cast<PDF_PLOTTER*
>( plotter )->StartPlot( aPageNumber, aPageName );
1543 startPlotSuccess = plotter->
StartPlot( aPageName );
1547 startPlotSuccess =
false;
1551 if( startPlotSuccess )
1566 &aBoard->
GetProperties(), aPageNumber, aPageCount, aSheetName, aSheetPath,
1568 variantName, variantDesc );
1594 const wxString& aLayerName,
const wxString& aSheetName,
1595 const wxString& aSheetPath,
const wxString& aPageNumber,
1606 bool revertOps =
false;
1607 bool oldMirror = aPlotOpts->
GetMirror();
1609 double oldScale = aPlotOpts->
GetScale();
1611 if( oldMirror || oldAutoScale || oldScale != 1.0 )
1624 &aBoard->
GetProperties(), aPageNumber, aPageCount, aSheetName, aSheetPath,
1626 variantName, variantDesc );
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
const VECTOR2I & GetAuxOrigin() const
int m_LineThickness[LAYER_CLASS_COUNT]
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
const PAGE_INFO & GetPageSettings() const
const ZONES & Zones() const
const LSET & DrillSymbolLayers() const
Layers that currently have a drill map on them.
TITLE_BLOCK & GetTitleBlock()
const std::map< wxString, wxString > & GetProperties() const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
const wxString & GetFileName() const
wxString GetVariantDescription(const wxString &aVariantName) const
wxString GetCurrentVariant() const
PROJECT * GetProject() const
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
BOARD_DESIGN_SETTINGS & GetDesignSettings()
const DRAWINGS & Drawings() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr const SizeVec & GetSize() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
void SetLayerSet(const LSET &aLayerMask)
void PlotFootprintGraphicItems(const FOOTPRINT *aFootprint) const
void PlotBoardGraphicItem(const BOARD_ITEM *item) const
Plot items like text and graphics but not tracks and footprints.
void PlotPadNumber(const PAD *aPad, const COLOR4D &aColor) const
void PlotDrillSymbols(PCB_LAYER_ID aLayer) const
Draw each hole's chart symbol on aLayer, from the board's shared symbol profile.
void PlotZone(const ZONE *aZone, PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList) const
void PlotFootprintTextItems(const FOOTPRINT *aFootprint) const
COLOR4D getColor(int aLayer) const
White color is special because it cannot be seen on a white paper in B&W mode.
void PlotDrillMarks() const
Draw a drill mark for pads and vias.
int getFineWidthAdj() const
void PlotPad(const PAD *aPad, PCB_LAYER_ID aLayer, const COLOR4D &aColor, bool aSketchMode) const
Plot a pad.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
static const COLOR4D BLACK
COLOR4D GetColor(int aLayer) const
When creating polygons to create a clearance polygonal area, the polygon must be same or bigger than ...
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
void UseX2format(bool aEnable)
void UseX2NetAttributes(bool aEnable)
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D LegacyMix(const COLOR4D &aColor) const
Mix this COLOR4D with an input COLOR4D using the OR-mixing of legacy canvas.
PCB specific render settings.
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SetDefaultPenWidth(int aWidth)
void SetGapLengthRatio(double aRatio)
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetLayerName(const wxString &aLayerName)
void SetDashLengthRatio(double aRatio)
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Handle the data for a net.
Describe the page size and margins of a paper page on which to eventually print or plot.
int GetHeightIU(double aIUScale) const
Get the page height in IU.
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
int GetWidthIU(double aIUScale) const
Get the page width in IU.
bool IsDegenerated(int aThreshold=5) const
EDA_ANGLE GetArcAngleStart() const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
EDA_ANGLE GetAngle() const
Parameters and options when plotting/printing a board.
PLOT_FORMAT GetFormat() const
bool GetSkipPlotNPTH_Pads() const
bool GetPngAntialias() const
void SetDrillMarksType(DRILL_MARKS aVal)
bool GetUseAuxOrigin() const
bool GetHideDNPFPsOnFabLayers() const
void SetSkipPlotNPTH_Pads(bool aSkip)
DXF_UNITS GetDXFPlotUnits() const
bool GetAutoScale() const
bool GetCrossoutDNPFPsOnFabLayers() const
void SetDXFPlotPolygonMode(bool aFlag)
void SetAutoScale(bool aFlag)
unsigned GetSvgPrecision() const
PLOT_TEXT_MODE GetTextMode() const override
bool GetDXFPlotPolygonMode() const
bool GetSvgFitPagetoBoard() const
bool GetPlotReference() const
bool m_PDFFrontFPPropertyPopups
Generate PDF property popup menus for footprints.
void SetScale(double aVal)
void SetMirror(bool aFlag)
bool GetSketchPadsOnFabLayers() const
bool GetSubtractMaskFromSilk() const
COLOR4D GetBackgroundColor() const
int GetGerberPrecision() const
double GetFineScaleAdjustY() const
bool GetPlotPadNumbers() const
DRILL_MARKS GetDrillMarksType() const
bool GetUseGerberX2format() const
bool GetPlotValue() const
bool GetIncludeGerberNetlistInfo() const
double GetFineScaleAdjustX() const
bool GetBlackAndWhite() const
double GetDashedLineGapRatio() const
bool m_PDFBackFPPropertyPopups
on front and/or back of board
bool GetPlotFPText() const
double GetDashedLineDashRatio() const
bool GetPlotFrameRef() const
bool GetDisableGerberMacros() const
std::vector< std::pair< PCB_LAYER_ID, wxString > > GetLayersToExport() const
COLOR_SETTINGS * ColorSettings() const
Base plotter engine class.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
virtual void SetNegative(bool aNegative)
virtual void SetSvgCoordinatesFormat(unsigned aPrecision)
Set the number of digits for mantissa in coordinates in mm for SVG plotter.
void MarkFootprintPlotted(const FOOTPRINT *aFootprint)
Record that aFootprint was drawn on the page being plotted, so that hyperlinks and bookmarks can cove...
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void SetRenderSettings(RENDER_SETTINGS *aSettings)
static const int USE_DEFAULT_LINE_WIDTH
double GetPlotScale() const
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
virtual bool StartPlot(const wxString &aPageNumber)=0
void SetLayersToExport(const std::vector< std::pair< PCB_LAYER_ID, wxString > > &aLayersToExport)
Sets the list of layers to export to the specified vector.
RENDER_SETTINGS * RenderSettings()
void ClearPlottedFootprints()
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
virtual PLOT_FORMAT GetPlotterType() const =0
Return the effective plot engine in use.
virtual void ThickArc(const EDA_SHAPE &aArcShape, void *aData, int aWidth)
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0)=0
virtual void SetCreator(const wxString &aCreator)
VECTOR2I GetPlotOffsetUserUnits()
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
bool GetColorMode() const
PAGE_INFO & PageSettings()
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, void *aData)=0
virtual void SetPlotBBox(const BOX2I &aBBoxIU)
Set an explicit bounding box for the plotted content (in IUs).
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual void SetLayerPolarity(bool aPositive)
Set the current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerb...
bool WasFootprintPlotted(const FOOTPRINT *aFootprint) const
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, void *aData)
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...
PNG rasterization plotter using Cairo graphics library.
void SetPixelSize(int aWidth, int aHeight)
Set the output image dimensions in pixels.
void SetResolution(int aDPI)
Set the output resolution in dots per inch.
void SetAntialias(bool aEnable)
Enable or disable anti-aliasing.
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void RemoveAllContours()
Remove all outlines & holes (clears) the polygon set.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
void DeletePolygon(int aIdx)
Delete aIdx-th polygon from the set.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of outlines in the set.
void InflateWithLinkedHoles(int aFactor, CORNER_STRATEGY aCornerStrategy, int aMaxError)
Perform outline inflation/deflation, using round corners.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
SHAPE_POLY_SET CloneDropTriangulation() const
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const POLYGON & CPolygon(int aIndex) const
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
An abstract shape on 2D plane.
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)
Handle a list of polygons defining a copper zone.
void SetMinThickness(int aMinThickness)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
A type-safe container of any type.
constexpr any() noexcept
Default constructor, creates an empty object.
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const std::map< wxString, wxString > *aProperties, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage, const wxString &aVariantName, const wxString &aVariantDesc)
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
@ CHAMFER_ALL_CORNERS
All angles are chamfered.
@ ROUND_ALL_CORNERS
All angles are rounded.
static constexpr EDA_ANGLE ANGLE_0
@ FILLED_SHAPE
Fill with object color.
a few functions useful in geometry calculations.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
PCB_LAYER_ID
A quick note on layer IDs:
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
void AddGerberX2Attribute(PLOTTER *aPlotter, const BOARD *aBoard, int aLayer, bool aUseX1CompatibilityMode)
Calculate some X2 attributes as defined in the Gerber file format specification and add them to the g...
void GenerateLayerPoly(SHAPE_POLY_SET *aResult, BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, bool aPlotFPText, bool aPlotReferences, bool aPlotValues)
Generates a SHAPE_POLY_SET representing the plotted items on a layer.
static void FillNegativeKnockout(PLOTTER *aPlotter, const BOX2I &aBbbox)
Prefill in black an area a little bigger than the board to prepare for the negative plot.
void PlotClippedSilkLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
void PlotBoardLayers(BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayers, const PCB_PLOT_PARAMS &aPlotOptions)
Plot a sequence of board layer IDs.
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot any layer EXCEPT a solder-mask with an enforced minimum width.
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aLayerName, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aPageName, const wxString &aPageNumber, const int aPageCount)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
void PlotPolySet(BOARD *aBoard, PLOTTER *aPlotter, const PCB_PLOT_PARAMS &aPlotOpt, SHAPE_POLY_SET *aPolySet, PCB_LAYER_ID aLayer)
void setupPlotterNewPDFPage(PLOTTER *aPlotter, BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, const wxString &aLayerName, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aPageNumber, int aPageCount)
void PlotSolderMaskLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot a solder mask layer.
static void initializePlotter(PLOTTER *aPlotter, const BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts)
Set up most plot options for plotting a board (especially the viewport) Important thing: page size is...
void PlotInteractiveLayer(BOARD *aBoard, PLOTTER *aPlotter, const PCB_PLOT_PARAMS &aPlotOpt)
Plot interactive items (hypertext links, properties, etc.) for the footprints the page drew.
static void plotBackgroundColor(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, PLOTTER *aPlotter)
void PlotOneBoardLayer(BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt, bool isPrimaryLayer)
Plot one copper or technical layer.
void PlotLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &layerMask, const PCB_PLOT_PARAMS &plotOpts)
void PlotLayerOutlines(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot outlines.
Plotting engines similar to ps (PostScript, Gerber, svg)
std::vector< FAB_LAYER_COLOR > dummy
LINE_STYLE
Dashed line types.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D