KiCad PCB EDA Suite
GERBER_PLOTTER Class Reference

#include <plotter.h>

Inheritance diagram for GERBER_PLOTTER:
PLOTTER

Public Member Functions

 GERBER_PLOTTER ()
 
virtual PlotFormat GetPlotterType () const override
 Returns the effective plot engine in use. More...
 
virtual bool StartPlot () override
 Function StartPlot Write GERBER header to file initialize global variable g_Plot_PlotOutputFile. More...
 
virtual bool EndPlot () override
 
virtual void SetCurrentLineWidth (int width, void *aData=NULL) override
 Set the line width for the next drawing. More...
 
virtual void SetDefaultLineWidth (int width) override
 Set the default line width. More...
 
virtual void SetDash (int dashed) override
 
virtual void SetColor (COLOR4D color) override
 
virtual void SetViewport (const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
 Set the plot offset and scaling for the current plot. More...
 
virtual void Rect (const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void Circle (const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void Arc (const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
 Generic fallback: arc rendered as a polyline. More...
 
virtual void ThickSegment (const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
 
virtual void ThickArc (const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
 
virtual void ThickRect (const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
 
virtual void ThickCircle (const wxPoint &pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
 
virtual void PlotPoly (const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
 Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence. More...
 
virtual void PenTo (const wxPoint &pos, char plume) override
 moveto/lineto primitive, moves the 'pen' to the specified direction More...
 
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) override
 Draws text with the plotter. More...
 
virtual void FlashPadCircle (const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
 Filled circular flashes are stored as apertures. More...
 
virtual void FlashPadOval (const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
 Filled oval flashes are handled as aperture in the 90 degree positions only. More...
 
virtual void FlashPadRect (const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
 Filled rect flashes are handled as aperture in the 0 90 180 or 270 degree orientation only and as polygon for other orientations TODO: always use flashed shapes (aperture macros) More...
 
virtual void FlashPadRoundRect (const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
 Roundrect pad at the moment are not handled as aperture, since they require aperture macros TODO: always use flashed shapes (aperture macros) More...
 
virtual void FlashPadCustom (const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
 virtual function FlashPadCustom More...
 
virtual void FlashPadTrapez (const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
 Trapezoidal pad at the moment are never handled as aperture, since they require aperture macros TODO: always use flashed shapes (aperture macros) More...
 
virtual void SetLayerPolarity (bool aPositive) override
 Change the plot polarity and begin a new layer Used to 'scratch off' silk screen away from solder mask. More...
 
virtual void SetGerberCoordinatesFormat (int aResolution, bool aUseInches=false) override
 Function SetGerberCoordinatesFormat selection of Gerber units and resolution (number of digits in mantissa) More...
 
void UseX2format (bool aEnable)
 
void UseX2NetAttributes (bool aEnable)
 
virtual void StartBlock (void *aData) override
 calling this function allows one to define the beginning of a group of drawing items (used in X2 format with netlist attributes) More...
 
virtual void EndBlock (void *aData) override
 calling this function allows one to define the end of a group of drawing items the group is started by StartBlock() (used in X2 format with netlist attributes) More...
 
virtual void SetNegative (bool aNegative)
 
virtual void SetColorMode (bool aColorMode)
 Plot in B/W or color. More...
 
bool GetColorMode () const
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)
 
virtual int GetCurrentLineWidth () const
 
virtual void SetCreator (const wxString &aCreator)
 
virtual void SetTitle (const wxString &aTitle)
 
void AddLineToHeader (const wxString &aExtraString)
 Function AddLineToHeader Add a line to the list of free lines to print at the beginning of the file. More...
 
void ClearHeaderLinesList ()
 Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning of the file. More...
 
virtual bool OpenFile (const wxString &aFullFilename)
 Open or create the plot file aFullFilename. More...
 
double GetIUsPerDecimil () const
 The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establishing the viewport. More...
 
void MoveTo (const wxPoint &pos)
 
void LineTo (const wxPoint &pos)
 
void FinishTo (const wxPoint &pos)
 
void PenFinish ()
 
virtual void PlotPoly (const SHAPE_LINE_CHAIN &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)
 Function PlotPoly. More...
 
virtual void PlotImage (const wxImage &aImage, const wxPoint &aPos, double aScaleFactor)
 Function PlotImage Only Postscript plotters can plot bitmaps for plotters that cannot plot a bitmap, a rectangle is plotted. More...
 
void Marker (const wxPoint &position, int diametre, unsigned aShapeId)
 Draw a pattern shape number aShapeId, to coord position. More...
 
virtual void SetTextMode (PlotTextMode mode)
 Change the current text mode. More...
 

Static Public Member Functions

static wxString GetDefaultFileExtension ()
 

Static Public Attributes

static const int DO_NOT_SET_LINE_WIDTH = -2
 
static const int USE_DEFAULT_LINE_WIDTH = -1
 
static const unsigned MARKER_COUNT = 58
 Draw a marker (used for the drill map) More...
 

Protected Member Functions

void selectAperture (const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 Pick an existing aperture or create a new one, matching the size, type and attributes. More...
 
void emitDcode (const DPOINT &pt, int dcode)
 Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (for n decimal positions, see header generation in start_plot. More...
 
void formatNetAttribute (GBR_NETLIST_METADATA *aData)
 print a Gerber net attribute object record. More...
 
void clearNetAttribute ()
 clear a Gerber net attribute record (clear object attribute dictionnary) and output the clear object attribute dictionnary command to gerber file More...
 
std::vector< APERTURE >::iterator getAperture (const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 Function getAperture returns a reference to the aperture which meets the size anf type of tool if the aperture does not exist, it is created and entered in aperture list. More...
 
void writeApertureList ()
 Generate the table of D codes. More...
 
void markerCircle (const wxPoint &pos, int radius)
 Plot a circle centered on the position. More...
 
void markerHBar (const wxPoint &pos, int radius)
 Plot a - bar centered on the position. More...
 
void markerSlash (const wxPoint &pos, int radius)
 Plot a / bar centered on the position. More...
 
void markerBackSlash (const wxPoint &pos, int radius)
 Plot a \ bar centered on the position. More...
 
void markerVBar (const wxPoint &pos, int radius)
 Plot a | bar centered on the position. More...
 
void markerSquare (const wxPoint &position, int radius)
 Plot a square centered on the position. More...
 
void markerLozenge (const wxPoint &position, int radius)
 Plot a lozenge centered on the position. More...
 
void segmentAsOval (const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode)
 Cdonvert a thick segment and plot it as an oval. More...
 
void sketchOval (const wxPoint &pos, const wxSize &size, double orient, int width)
 
virtual DPOINT userToDeviceCoordinates (const wxPoint &aCoordinate)
 Modifies coordinates according to the orientation, scale factor, and offsets trace. More...
 
virtual DPOINT userToDeviceSize (const wxSize &size)
 Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) More...
 
virtual double userToDeviceSize (double size) const
 Modifies size according to the plotter scale factors (simple double version) More...
 
double GetDotMarkLenIU () const
 
double GetDashMarkLenIU () const
 
double GetDashGapLenIU () const
 

Protected Attributes

std::string m_objectAttributesDictionnary
 
int m_apertureAttribute
 
FILE * workFile
 
FILE * finalFile
 
wxString m_workFilename
 
std::vector< APERTUREapertures
 
std::vector< APERTURE >::iterator currentAperture
 
bool m_gerberUnitInch
 
int m_gerberUnitFmt
 
bool m_useX2format
 
bool m_useNetAttributes
 
double plotScale
 Plot scale - chosen by the user (even implicitly with 'fit in a4') More...
 
double m_IUsPerDecimil
 
double iuPerDeviceUnit
 Device scale (from IUs to plotter device units - usually decimils) More...
 
wxPoint plotOffset
 Plot offset (in IUs) More...
 
bool m_plotMirror
 X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG) More...
 
bool m_mirrorIsHorizontal
 
bool m_yaxisReversed
 true to mirror horizontally (else vertically) More...
 
FILE * outputFile
 true if the Y axis is top to bottom (SVG) More...
 
bool colorMode
 
bool negativeMode
 true to plot in color, false to plot in black and white More...
 
int defaultPenWidth
 true to generate a negative image (PS mode mainly) More...
 
int currentPenWidth
 
char penState
 Current pen state: 'U', 'D' or 'Z' (see PenTo) More...
 
wxPoint penLastpos
 Last pen positions; set to -1,-1 when the pen is at rest. More...
 
wxString creator
 
wxString filename
 
wxString title
 
PAGE_INFO pageInfo
 
wxSize paperSize
 Paper size in IU - not in mils. More...
 
wxArrayString m_headerExtraLines
 

Detailed Description

Definition at line 1011 of file plotter.h.

Constructor & Destructor Documentation

◆ GERBER_PLOTTER()

GERBER_PLOTTER::GERBER_PLOTTER ( )

Definition at line 46 of file GERBER_plotter.cpp.

References apertures, currentAperture, finalFile, m_apertureAttribute, m_gerberUnitFmt, m_gerberUnitInch, m_useNetAttributes, m_useX2format, and workFile.

47 {
48  workFile = NULL;
49  finalFile = NULL;
50  currentAperture = apertures.end();
52 
53  // number of digits after the point (number of digits of the mantissa
54  // Be carefull: the Gerber coordinates are stored in an integer
55  // so 6 digits (inches) or 5 digits (mm) is a good value
56  // To avoid overflow, 7 digits (inches) or 6 digits is a max.
57  // with lower values than 6 digits (inches) or 5 digits (mm),
58  // Creating self-intersecting polygons from non-intersecting polygons
59  // happen easily.
60  m_gerberUnitInch = false;
61  m_gerberUnitFmt = 6;
62  m_useX2format = true;
63  m_useNetAttributes = true;
64 }
bool m_useNetAttributes
Definition: plotter.h:1227
std::vector< APERTURE > apertures
Definition: plotter.h:1218
bool m_gerberUnitInch
Definition: plotter.h:1221
int m_gerberUnitFmt
Definition: plotter.h:1222
FILE * finalFile
Definition: plotter.h:1210
bool m_useX2format
Definition: plotter.h:1224
int m_apertureAttribute
Definition: plotter.h:1207
FILE * workFile
Definition: plotter.h:1209
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1219

Member Function Documentation

◆ AddLineToHeader()

void PLOTTER::AddLineToHeader ( const wxString &  aExtraString)
inlineinherited

Function AddLineToHeader Add a line to the list of free lines to print at the beginning of the file.

Parameters
aExtraStringis the string to print

Definition at line 176 of file plotter.h.

References PLOTTER::m_headerExtraLines.

Referenced by AddGerberX2Attribute(), AddGerberX2Header(), and GERBER_WRITER::createDrillFile().

177  {
178  m_headerExtraLines.Add( aExtraString );
179  }
wxArrayString m_headerExtraLines
Definition: plotter.h:572

◆ Arc()

void GERBER_PLOTTER::Arc ( const wxPoint &  centre,
double  StAngle,
double  EndAngle,
int  rayon,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Generic fallback: arc rendered as a polyline.

Reimplemented from PLOTTER.

Definition at line 468 of file GERBER_plotter.cpp.

References cosdecideg(), KiROUND(), PLOTTER::MoveTo(), PLOTTER::outputFile, SetCurrentLineWidth(), sindecideg(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Circle(), and ThickArc().

470 {
471  SetCurrentLineWidth( aWidth );
472 
473  wxPoint start, end;
474  start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) );
475  start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) );
476  MoveTo( start );
477  end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
478  end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
479  DPOINT devEnd = userToDeviceCoordinates( end );
480  DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
481 
482  fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
483 
484  if( aStAngle < aEndAngle )
485  fprintf( outputFile, "G03" );
486  else
487  fprintf( outputFile, "G02" );
488 
489  fprintf( outputFile, "X%dY%dI%dJ%dD01*\n",
490  KiROUND( devEnd.x ), KiROUND( devEnd.y ),
491  KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
492 
493  fprintf( outputFile, "G01*\n" ); // Back to linear interpol (perhaps useless here).
494 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:96
double cosdecideg(double r, double a)
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
Definition: trigo.h:354
double sindecideg(double r, double a)
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians.
Definition: trigo.h:345
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554

◆ Circle()

void GERBER_PLOTTER::Circle ( const wxPoint &  pos,
int  diametre,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 462 of file GERBER_plotter.cpp.

References Arc().

Referenced by FlashPadCircle(), and ThickCircle().

463 {
464  Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
465 }
virtual void Arc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.

◆ ClearHeaderLinesList()

void PLOTTER::ClearHeaderLinesList ( )
inlineinherited

Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning of the file.

Definition at line 185 of file plotter.h.

References PLOTTER::m_headerExtraLines.

Referenced by StartPlotBoard().

186  {
187  m_headerExtraLines.Clear();
188  }
wxArrayString m_headerExtraLines
Definition: plotter.h:572

◆ clearNetAttribute()

void GERBER_PLOTTER::clearNetAttribute ( )
protected

clear a Gerber net attribute record (clear object attribute dictionnary) and output the clear object attribute dictionnary command to gerber file

Definition at line 109 of file GERBER_plotter.cpp.

References m_objectAttributesDictionnary, m_useX2format, and PLOTTER::outputFile.

Referenced by EndBlock(), and formatNetAttribute().

110 {
111  // disable a Gerber net attribute (exists only in X2 with net attributes mode).
112  if( m_objectAttributesDictionnary.empty() ) // No net attribute or not X2 mode
113  return;
114 
115  // Remove all net attributes from object attributes dictionnary
116  if( m_useX2format )
117  fputs( "%TD*%\n", outputFile );
118  else
119  fputs( "G04 #@! TD*\n", outputFile );
120 
122 }
bool m_useX2format
Definition: plotter.h:1224
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
std::string m_objectAttributesDictionnary
Definition: plotter.h:1204

◆ emitDcode()

void GERBER_PLOTTER::emitDcode ( const DPOINT pt,
int  dcode 
)
protected

Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (for n decimal positions, see header generation in start_plot.

Definition at line 101 of file GERBER_plotter.cpp.

References KiROUND(), PLOTTER::outputFile, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadCircle(), FlashPadOval(), FlashPadRect(), and PenTo().

102 {
103 
104  fprintf( outputFile, "X%dY%dD%02d*\n",
105  KiROUND( pt.x ), KiROUND( pt.y ), dcode );
106 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554

◆ EndBlock()

void GERBER_PLOTTER::EndBlock ( void *  aData)
overridevirtual

calling this function allows one to define the end of a group of drawing items the group is started by StartBlock() (used in X2 format with netlist attributes)

Parameters
aDatacan define any parameter

Reimplemented from PLOTTER.

Definition at line 132 of file GERBER_plotter.cpp.

References clearNetAttribute().

Referenced by GERBER_WRITER::createDrillFile(), and StartBlock().

133 {
134  // Remove all net attributes from object attributes dictionnary
136 }
void clearNetAttribute()
clear a Gerber net attribute record (clear object attribute dictionnary) and output the clear object ...

◆ EndPlot()

bool GERBER_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 222 of file GERBER_plotter.cpp.

References finalFile, m_workFilename, PLOTTER::outputFile, workFile, and writeApertureList().

Referenced by GERBER_WRITER::createDrillFile().

223 {
224  char line[1024];
225  wxString msg;
226 
227  wxASSERT( outputFile );
228 
229  /* Outfile is actually a temporary file i.e. workFile */
230  fputs( "M02*\n", outputFile );
231  fflush( outputFile );
232 
233  fclose( workFile );
234  workFile = wxFopen( m_workFilename, wxT( "rt" ));
235  wxASSERT( workFile );
237 
238  // Placement of apertures in RS274X
239  while( fgets( line, 1024, workFile ) )
240  {
241  fputs( line, outputFile );
242 
243  if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 )
244  {
246  fputs( "G04 APERTURE END LIST*\n", outputFile );
247  }
248  }
249 
250  fclose( workFile );
251  fclose( finalFile );
252  ::wxRemoveFile( m_workFilename );
253  outputFile = 0;
254 
255  return true;
256 }
void writeApertureList()
Generate the table of D codes.
FILE * finalFile
Definition: plotter.h:1210
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
wxString m_workFilename
Definition: plotter.h:1211
FILE * workFile
Definition: plotter.h:1209

◆ FinishTo()

◆ FlashPadCircle()

void GERBER_PLOTTER::FlashPadCircle ( const wxPoint &  pos,
int  diametre,
EDA_DRAW_MODE_T  trace_mode,
void *  aData 
)
overridevirtual

Filled circular flashes are stored as apertures.

Implements PLOTTER.

Definition at line 639 of file GERBER_plotter.cpp.

References APERTURE::Circle, Circle(), PLOTTER::currentPenWidth, PLOTTER::DO_NOT_SET_LINE_WIDTH, emitDcode(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), GBR_METADATA::m_NetlistMetadata, NO_FILL, selectAperture(), SetCurrentLineWidth(), SKETCH, PLOTTER::USE_DEFAULT_LINE_WIDTH, and PLOTTER::userToDeviceCoordinates().

Referenced by GERBER_WRITER::createDrillFile(), FlashPadCustom(), FlashPadOval(), FlashPadRoundRect(), and FlashPadTrapez().

640 {
641  wxSize size( diametre, diametre );
642  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
643 
644  if( trace_mode == SKETCH )
645  {
647 
648  if( gbr_metadata )
649  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
650 
652  }
653  else
654  {
655  DPOINT pos_dev = userToDeviceCoordinates( pos );
656 
657  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
658  selectAperture( size, APERTURE::Circle, aperture_attrib );
659 
660  if( gbr_metadata )
661  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
662 
663  emitDcode( pos_dev, 3 );
664  }
665 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:147
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:96
int currentPenWidth
Definition: plotter.h:560
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101

◆ FlashPadCustom()

void GERBER_PLOTTER::FlashPadCustom ( const wxPoint &  aPadPos,
const wxSize &  aSize,
SHAPE_POLY_SET aPolygons,
EDA_DRAW_MODE_T  aTraceMode,
void *  aData 
)
overridevirtual

virtual function FlashPadCustom

Parameters
aPadPosPosition of the shape (center of the rectangle
aSize= size of round reference pad
aPolygonsthe shape as polygon set
aTraceModeFILLED or SKETCH
aDataan auxiliary info (mainly for gerber format attributes)

Implements PLOTTER.

Definition at line 870 of file GERBER_plotter.cpp.

References GBR_NETLIST_METADATA::ClearAttribute(), FILLED, FILLED_SHAPE, FlashPadCircle(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, PLOTTER::GetCurrentLineWidth(), SHAPE_POLY_SET::Inflate(), GBR_METADATA::IsCopper(), GBR_METADATA::m_NetlistMetadata, min, NO_FILL, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), PlotPoly(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), GBR_METADATA::SetApertureAttrib(), SetCurrentLineWidth(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

874 {
875  // A Pad custom is plotted as polygon.
876 
877  // A flashed circle @aPadPos is added (anchor pad)
878  // However, because the anchor pad can be circle or rect, we use only
879  // a circle not bigger than the rect.
880  // the main purpose is to print a flashed DCode as pad anchor
881  if( aTraceMode == FILLED )
882  FlashPadCircle( aPadPos, std::min( aSize.x, aSize.y ), aTraceMode, aData );
883 
884  GBR_METADATA gbr_metadata;
885 
886  if( aData )
887  {
888  gbr_metadata = *static_cast<GBR_METADATA*>( aData );
889  // If the pad is drawn on a copper layer,
890  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
891  if( gbr_metadata.IsCopper() )
893 
894  wxString attrname( ".P" );
895  gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
896  }
897 
898  SHAPE_POLY_SET polyshape = *aPolygons;
899 
900  if( aTraceMode != FILLED )
901  {
903  polyshape.Inflate( -GetCurrentLineWidth()/2, 16 );
904  }
905 
906  std::vector< wxPoint > cornerList;
907 
908  for( int cnt = 0; cnt < polyshape.OutlineCount(); ++cnt )
909  {
910  SHAPE_LINE_CHAIN& poly = polyshape.Outline( cnt );
911 
912  cornerList.clear();
913 
914  for( int ii = 0; ii < poly.PointCount(); ++ii )
915  cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
916 
917  // Close polygon
918  cornerList.push_back( cornerList[0] );
919 
920  PlotPoly( cornerList,
921  aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
922  aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
923  }
924 }
int OutlineCount() const
Returns the number of outlines in the set
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
Definition: gbr_metadata.h:170
int PointCount() const
Function PointCount()
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Class SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
Class SHAPE_LINE_CHAIN.
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
VECTOR2I & Point(int aIndex)
Function Point()
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:142
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
#define min(a, b)
Definition: auxiliary.h:85

◆ FlashPadOval()

void GERBER_PLOTTER::FlashPadOval ( const wxPoint &  pos,
const wxSize &  size,
double  orient,
EDA_DRAW_MODE_T  trace_mode,
void *  aData 
)
overridevirtual

Filled oval flashes are handled as aperture in the 90 degree positions only.

Implements PLOTTER.

Definition at line 668 of file GERBER_plotter.cpp.

References GBR_NETLIST_METADATA::ClearAttribute(), delta, emitDcode(), FILLED, FlashPadCircle(), formatNetAttribute(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, GBR_METADATA::GetApertureAttrib(), GBR_METADATA::IsCopper(), GBR_METADATA::m_NetlistMetadata, PLOTTER::outputFile, APERTURE::Oval, RotatePoint(), selectAperture(), GBR_METADATA::SetApertureAttrib(), PLOTTER::sketchOval(), ThickSegment(), and PLOTTER::userToDeviceCoordinates().

Referenced by GERBER_WRITER::createDrillFile().

670 {
671  wxASSERT( outputFile );
672  wxSize size( aSize );
673  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
674 
675  /* Plot a flashed shape. */
676  if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
677  && trace_mode == FILLED )
678  {
679  if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
680  std::swap( size.x, size.y );
681 
682  DPOINT pos_dev = userToDeviceCoordinates( pos );
683  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
684  selectAperture( size, APERTURE::Oval, aperture_attrib );
685 
686  if( gbr_metadata )
687  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
688 
689  emitDcode( pos_dev, 3 );
690  }
691  else /* Plot pad as a segment. */
692  {
693  if( size.x > size.y )
694  {
695  std::swap( size.x, size.y );
696 
697  if( orient < 2700 )
698  orient += 900;
699  else
700  orient -= 2700;
701  }
702 
703  if( trace_mode == FILLED )
704  {
705  // TODO: use an aperture macro to declare the rotated pad
706 
707  // Flash a pad anchor, if a netlist attribute is set
708  if( aData )
709  FlashPadCircle( pos, size.x, trace_mode, aData );
710 
711  // The pad is reduced to an segment with dy > dx
712  int delta = size.y - size.x;
713  int x0 = 0;
714  int y0 = -delta / 2;
715  int x1 = 0;
716  int y1 = delta / 2;
717  RotatePoint( &x0, &y0, orient );
718  RotatePoint( &x1, &y1, orient );
719  GBR_METADATA metadata;
720 
721  if( gbr_metadata )
722  {
723  metadata = *gbr_metadata;
724 
725  // If the pad is drawn on a copper layer,
726  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
727  if( metadata.IsCopper() )
729 
730  // Clear .P attribute, only allowed for flashed items
731  wxString attrname( ".P" );
732  metadata.m_NetlistMetadata.ClearAttribute( &attrname );
733  }
734 
735  ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
736  wxPoint( pos.x + x1, pos.y + y1 ),
737  size.x, trace_mode, &metadata );
738  }
739  else
740  {
741  sketchOval( pos, size, orient, -1 );
742  }
743  }
744 }
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
Definition: gbr_metadata.h:170
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
static const int delta[8][2]
Definition: solve.cpp:112
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:147
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:96
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:142
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:408

◆ FlashPadRect()

void GERBER_PLOTTER::FlashPadRect ( const wxPoint &  pos,
const wxSize &  size,
double  orient,
EDA_DRAW_MODE_T  trace_mode,
void *  aData 
)
overridevirtual

Filled rect flashes are handled as aperture in the 0 90 180 or 270 degree orientation only and as polygon for other orientations TODO: always use flashed shapes (aperture macros)

Implements PLOTTER.

Definition at line 747 of file GERBER_plotter.cpp.

References PLOTTER::currentPenWidth, emitDcode(), FlashPadTrapez(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), GBR_METADATA::m_NetlistMetadata, NO_FILL, PLOTTER::outputFile, APERTURE::Rect, Rect(), selectAperture(), SetCurrentLineWidth(), SKETCH, PLOTTER::USE_DEFAULT_LINE_WIDTH, and PLOTTER::userToDeviceCoordinates().

750 {
751  wxASSERT( outputFile );
752  wxSize size( aSize );
753  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
754 
755  // Plot as an aperture flash
756  switch( int( orient ) )
757  {
758  case 900:
759  case 2700: // rotation of 90 degrees or 270 swaps sizes
760  std::swap( size.x, size.y );
761  // Pass through
762  case 0:
763  case 1800:
764  if( trace_mode == SKETCH )
765  {
767 
768  if( gbr_metadata )
769  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
770 
771  Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
772  pos.y - (size.y - currentPenWidth) / 2 ),
773  wxPoint( pos.x + (size.x - currentPenWidth) / 2,
774  pos.y + (size.y - currentPenWidth) / 2 ),
776  }
777  else
778  {
779  DPOINT pos_dev = userToDeviceCoordinates( pos );
780  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
781  selectAperture( size, APERTURE::Rect, aperture_attrib );
782 
783  if( gbr_metadata )
784  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
785 
786  emitDcode( pos_dev, 3 );
787  }
788  break;
789 
790  default: // plot pad shape as polygon
791  {
792  // XXX to do: use an aperture macro to declare the rotated pad
793  wxPoint coord[4];
794  // coord[0] is assumed the lower left
795  // coord[1] is assumed the upper left
796  // coord[2] is assumed the upper right
797  // coord[3] is assumed the lower right
798 
799  /* Trace the outline. */
800  coord[0].x = -size.x/2; // lower left
801  coord[0].y = size.y/2;
802  coord[1].x = -size.x/2; // upper left
803  coord[1].y = -size.y/2;
804  coord[2].x = size.x/2; // upper right
805  coord[2].y = -size.y/2;
806  coord[3].x = size.x/2; // lower right
807  coord[3].y = size.y/2;
808 
809  FlashPadTrapez( pos, coord, orient, trace_mode, aData );
810  }
811  break;
812  }
813 }
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Trapezoidal pad at the moment are never handled as aperture, since they require aperture macros TODO:...
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:147
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:96
int currentPenWidth
Definition: plotter.h:560
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181

◆ FlashPadRoundRect()

void GERBER_PLOTTER::FlashPadRoundRect ( const wxPoint &  aPadPos,
const wxSize &  aSize,
int  aCornerRadius,
double  aOrient,
EDA_DRAW_MODE_T  aTraceMode,
void *  aData 
)
overridevirtual

Roundrect pad at the moment are not handled as aperture, since they require aperture macros TODO: always use flashed shapes (aperture macros)

Implements PLOTTER.

Definition at line 815 of file GERBER_plotter.cpp.

References GBR_NETLIST_METADATA::ClearAttribute(), FILLED, FILLED_SHAPE, FlashPadCircle(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, PLOTTER::GetCurrentLineWidth(), SHAPE_POLY_SET::Inflate(), GBR_METADATA::IsCopper(), GBR_METADATA::m_NetlistMetadata, min, NO_FILL, SHAPE_POLY_SET::Outline(), PlotPoly(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), GBR_METADATA::SetApertureAttrib(), SetCurrentLineWidth(), TransformRoundRectToPolygon(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

819 {
820  GBR_METADATA gbr_metadata;
821 
822  if( aData )
823  {
824  gbr_metadata = *static_cast<GBR_METADATA*>( aData );
825  // If the pad is drawn on a copper layer,
826  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
827  if( gbr_metadata.IsCopper() )
829 
830  wxString attrname( ".P" );
831  gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
832  }
833 
834  if( aTraceMode != FILLED )
836 
837  // Currently, a Pad RoundRect is plotted as polygon.
838  // TODO: use Aperture macro and flash it
839  SHAPE_POLY_SET outline;
840  const int segmentToCircleCount = 64;
841  TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
842  aCornerRadius, segmentToCircleCount );
843 
844  if( aTraceMode != FILLED )
845  outline.Inflate( -GetCurrentLineWidth()/2, 16 );
846 
847  std::vector< wxPoint > cornerList;
848  // TransformRoundRectToPolygon creates only one convex polygon
849  SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
850  cornerList.reserve( poly.PointCount() + 1 );
851 
852  for( int ii = 0; ii < poly.PointCount(); ++ii )
853  cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
854 
855  // Close polygon
856  cornerList.push_back( cornerList[0] );
857 
858  PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
859  aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
860 
861  // Now, flash a pad anchor, if a netlist attribute is set
862  // (remove me when a Aperture macro will be used)
863  if( aData && aTraceMode == FILLED )
864  {
865  int diameter = std::min( aSize.x, aSize.y );
866  FlashPadCircle( aPadPos, diameter, aTraceMode , aData );
867  }
868 }
void TransformRoundRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, int aCircleToSegmentsCount)
Function TransformRoundRectToPolygon convert a rectangle with rounded corners to a polygon Convert ar...
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
Definition: gbr_metadata.h:170
int PointCount() const
Function PointCount()
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Class SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
Class SHAPE_LINE_CHAIN.
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
VECTOR2I & Point(int aIndex)
Function Point()
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:142
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
#define min(a, b)
Definition: auxiliary.h:85

◆ FlashPadTrapez()

void GERBER_PLOTTER::FlashPadTrapez ( const wxPoint &  aPadPos,
const wxPoint *  aCorners,
double  aPadOrient,
EDA_DRAW_MODE_T  aTraceMode,
void *  aData 
)
overridevirtual

Trapezoidal pad at the moment are never handled as aperture, since they require aperture macros TODO: always use flashed shapes (aperture macros)

Implements PLOTTER.

Definition at line 927 of file GERBER_plotter.cpp.

References GBR_NETLIST_METADATA::ClearAttribute(), dist, FILLED, FILLED_SHAPE, FlashPadCircle(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, PLOTTER::GetCurrentLineWidth(), GBR_METADATA::IsCopper(), SEG::LineDistance(), GBR_METADATA::m_NetlistMetadata, min, NO_FILL, PlotPoly(), RotatePoint(), GBR_METADATA::SetApertureAttrib(), SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

Referenced by FlashPadRect().

930 {
931  // Currently, a Pad Trapezoid is plotted as polygon.
932  // TODO: use Aperture macro and flash it
933 
934  // polygon corners list
935  std::vector< wxPoint > cornerList;
936 
937  for( int ii = 0; ii < 4; ii++ )
938  cornerList.push_back( aCorners[ii] );
939 
940  // Now, flash a pad anchor, if a netlist attribute is set
941  // (remove me when a Aperture macro will be used)
942  if( aData && ( aTrace_Mode == FILLED ) )
943  {
944  // Calculate the radius of the circle inside the shape
945  // It is the smaller dist from shape pos to edges
946  int radius = INT_MAX;
947 
948  for( unsigned ii = 0, jj = cornerList.size()-1; ii < cornerList.size();
949  jj = ii, ii++ )
950  {
951  SEG segment( aCorners[ii], aCorners[jj] );
952  int dist = segment.LineDistance( VECTOR2I( 0, 0) );
953  radius = std::min( radius, dist );
954  }
955 
956  FlashPadCircle( aPadPos, radius*2, aTrace_Mode, aData );
957  }
958 
959  // Draw the polygon and fill the interior as required
960  for( unsigned ii = 0; ii < 4; ii++ )
961  {
962  RotatePoint( &cornerList[ii], aPadOrient );
963  cornerList[ii] += aPadPos;
964  }
965 
966  // Close the polygon
967  cornerList.push_back( cornerList[0] );
968  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
969 
970  GBR_METADATA metadata;
971 
972  if( gbr_metadata )
973  {
974  metadata = *gbr_metadata;
975  // If the pad is drawn on a copper layer,
976  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
977  if( metadata.IsCopper() )
979 
980  wxString attrname( ".P" );
981  metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
982  }
983 
985  PlotPoly( cornerList, aTrace_Mode == FILLED ? FILLED_SHAPE : NO_FILL,
986  aTrace_Mode == FILLED ? 0 : GetCurrentLineWidth(),
987  &metadata );
988 }
static const int dist[10][10]
Definition: ar_matrix.cpp:320
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
bool IsCopper()
Allowed attributes are not the same on board copper layers and on other layers Therefore a flag can b...
Definition: gbr_metadata.h:170
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
Definition: seg.h:36
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:142
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
#define min(a, b)
Definition: auxiliary.h:85

◆ formatNetAttribute()

void GERBER_PLOTTER::formatNetAttribute ( GBR_NETLIST_METADATA aData)
protected

print a Gerber net attribute object record.

In a gerber file, a net attribute is owned by a graphic object formatNetAttribute must be called before creating the object

Parameters
aDatacontains the dato to format. the generated string depends on the type of netlist info

Definition at line 139 of file GERBER_plotter.cpp.

References clearNetAttribute(), FormatNetAttribute(), m_objectAttributesDictionnary, m_useNetAttributes, m_useX2format, and PLOTTER::outputFile.

Referenced by FlashPadCircle(), FlashPadOval(), FlashPadRect(), PlotPoly(), Text(), ThickArc(), ThickCircle(), ThickRect(), and ThickSegment().

140 {
141  // print a Gerber net attribute record.
142  // it is added to the object attributes dictionnary
143  // On file, only modified or new attributes are printed.
144  if( aData == NULL )
145  return;
146 
147  if( !m_useNetAttributes )
148  return;
149 
150  bool useX1StructuredComment = !m_useX2format;
151 
152  bool clearDict;
153  std::string short_attribute_string;
154 
155  if( !FormatNetAttribute( short_attribute_string, m_objectAttributesDictionnary,
156  aData, clearDict, useX1StructuredComment ) )
157  return;
158 
159  if( clearDict )
161 
162  if( !short_attribute_string.empty() )
163  fputs( short_attribute_string.c_str(), outputFile );
164 }
void clearNetAttribute()
clear a Gerber net attribute record (clear object attribute dictionnary) and output the clear object ...
bool m_useNetAttributes
Definition: plotter.h:1227
bool FormatNetAttribute(std::string &aPrintedText, std::string &aLastNetAttributes, GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes, bool aUseX1StructuredComment)
Generates the string to print to a gerber file, to set a net attribute for a graphic object...
bool m_useX2format
Definition: plotter.h:1224
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
std::string m_objectAttributesDictionnary
Definition: plotter.h:1204

◆ getAperture()

std::vector< APERTURE >::iterator GERBER_PLOTTER::getAperture ( const wxSize &  aSize,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
protected

Function getAperture returns a reference to the aperture which meets the size anf type of tool if the aperture does not exist, it is created and entered in aperture list.

Parameters
aSize= the size of tool
aType= the type ( shape ) of tool
aApertureAttribute= an aperture attribute of the tool (a tool can have onlu one attribute) 0 = no specific attribute

Definition at line 286 of file GERBER_plotter.cpp.

References apertures, APERTURE::m_ApertureAttribute, APERTURE::m_DCode, APERTURE::m_Size, and APERTURE::m_Type.

Referenced by selectAperture().

288 {
289  int last_D_code = 9;
290 
291  // Search an existing aperture
292  std::vector<APERTURE>::iterator tool = apertures.begin();
293 
294  while( tool != apertures.end() )
295  {
296  last_D_code = tool->m_DCode;
297 
298  if( (tool->m_Type == aType) && (tool->m_Size == aSize) &&
299  (tool->m_ApertureAttribute == aApertureAttribute) )
300  return tool;
301 
302  ++tool;
303  }
304 
305  // Allocate a new aperture
306  APERTURE new_tool;
307  new_tool.m_Size = aSize;
308  new_tool.m_Type = aType;
309  new_tool.m_DCode = last_D_code + 1;
310  new_tool.m_ApertureAttribute = aApertureAttribute;
311 
312  apertures.push_back( new_tool );
313 
314  return apertures.end() - 1;
315 }
APERTURE_TYPE m_Type
Definition: plotter.h:1003
wxSize m_Size
Definition: plotter.h:1002
std::vector< APERTURE > apertures
Definition: plotter.h:1218
int m_DCode
Definition: plotter.h:1004
int m_ApertureAttribute
Definition: plotter.h:1005

◆ GetColorMode()

bool PLOTTER::GetColorMode ( ) const
inlineinherited

Definition at line 131 of file plotter.h.

References PLOTTER::colorMode.

Referenced by PLOT_CONTROLLER::GetColorMode(), LIB_TEXT::Plot(), LIB_PART::Plot(), LIB_PART::PlotLibFields(), and PlotWorkSheet().

132  {
133  return colorMode;
134  }
bool colorMode
Definition: plotter.h:557

◆ GetCurrentLineWidth()

◆ GetDashGapLenIU()

double PLOTTER::GetDashGapLenIU ( ) const
protectedinherited

Definition at line 148 of file plotter.cpp.

References DASH_GAP_LEN, PLOTTER::GetCurrentLineWidth(), and PLOTTER::userToDeviceSize().

Referenced by PS_PLOTTER::SetDash(), PDF_PLOTTER::SetDash(), and SVG_PLOTTER::setSVGPlotStyle().

149 {
151 }
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) ...
Definition: plotter.cpp:121
#define DASH_GAP_LEN(aLineWidth)

◆ GetDashMarkLenIU()

double PLOTTER::GetDashMarkLenIU ( ) const
protectedinherited

Definition at line 142 of file plotter.cpp.

References DASH_MARK_LEN, PLOTTER::GetCurrentLineWidth(), and PLOTTER::userToDeviceSize().

Referenced by PS_PLOTTER::SetDash(), PDF_PLOTTER::SetDash(), and SVG_PLOTTER::setSVGPlotStyle().

143 {
145 }
#define DASH_MARK_LEN(aLineWidth)
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) ...
Definition: plotter.cpp:121

◆ GetDefaultFileExtension()

static wxString GERBER_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 1021 of file plotter.h.

Referenced by GetDefaultPlotExtension().

1022  {
1023  return wxString( wxT( "gbr" ) );
1024  }

◆ GetDotMarkLenIU()

double PLOTTER::GetDotMarkLenIU ( ) const
protectedinherited

Definition at line 136 of file plotter.cpp.

References DOT_MARK_LEN, PLOTTER::GetCurrentLineWidth(), and PLOTTER::userToDeviceSize().

Referenced by PS_PLOTTER::SetDash(), PDF_PLOTTER::SetDash(), and SVG_PLOTTER::setSVGPlotStyle().

137 {
139 }
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
#define DOT_MARK_LEN(aLineWidth)
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) ...
Definition: plotter.cpp:121

◆ GetIUsPerDecimil()

double PLOTTER::GetIUsPerDecimil ( ) const
inlineinherited

The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establishing the viewport.

Here they can be get back again

Definition at line 217 of file plotter.h.

References PLOTTER::m_IUsPerDecimil.

Referenced by PlotWorkSheet().

217 { return m_IUsPerDecimil; }
double m_IUsPerDecimil
Definition: plotter.h:539

◆ GetPlotterType()

virtual PlotFormat GERBER_PLOTTER::GetPlotterType ( ) const
inlineoverridevirtual

Returns the effective plot engine in use.

It's not very OO but for now is required since some things are only done with some output devices (like drill marks, emitted only for postscript

Implements PLOTTER.

Definition at line 1016 of file plotter.h.

References PLOT_FORMAT_GERBER.

1017  {
1018  return PLOT_FORMAT_GERBER;
1019  }

◆ LineTo()

void PLOTTER::LineTo ( const wxPoint &  pos)
inlineinherited

Definition at line 246 of file plotter.h.

References PLOTTER::PenTo().

Referenced by PLOTTER::Arc(), DXF_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadRoundRect(), DXF_PLOTTER::FlashPadTrapez(), SCH_SHEET::Plot(), HPGL_PLOTTER::PlotPoly(), PlotPoly(), DXF_PLOTTER::PlotPoly(), LIB_PIN::PlotSymbol(), and DXF_PLOTTER::Rect().

247  {
248  PenTo( pos, 'D' );
249  }
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the &#39;pen&#39; to the specified direction

◆ Marker()

void PLOTTER::Marker ( const wxPoint &  position,
int  diametre,
unsigned  aShapeId 
)
inherited

Draw a pattern shape number aShapeId, to coord position.

Diameter diameter = (coord table) hole AShapeId = index (used to generate forms characters)

Definition at line 281 of file plotter.cpp.

References PLOTTER::MARKER_COUNT, PLOTTER::markerBackSlash(), PLOTTER::markerCircle(), PLOTTER::markerHBar(), PLOTTER::markerLozenge(), PLOTTER::markerSlash(), PLOTTER::markerSquare(), and PLOTTER::markerVBar().

Referenced by GENDRILL_WRITER_BASE::genDrillMapFile(), and GENDRILL_WRITER_BASE::plotDrillMarks().

282 {
283  int radius = diametre / 2;
284  /* Marker are composed by a series of 'parts' superimposed; not every
285  combination make sense, obviously. Since they are used in order I
286  tried to keep the uglier/more complex constructions at the end.
287  Also I avoided the |/ |\ -/ -\ construction because they're *very*
288  ugly... if needed they could be added anyway... I'd like to see
289  a board with more than 58 drilling/slotting tools!
290  If Visual C++ supported the 0b literals they would be optimally
291  and easily encoded as an integer array. We have to do with octal */
292  static const unsigned char marker_patterns[MARKER_COUNT] = {
293  // Bit order: O Square Lozenge - | \ /
294  // First choice: simple shapes
295  0003, // X
296  0100, // O
297  0014, // +
298  0040, // Sq
299  0020, // Lz
300  // Two simple shapes
301  0103, // X O
302  0017, // X +
303  0043, // X Sq
304  0023, // X Lz
305  0114, // O +
306  0140, // O Sq
307  0120, // O Lz
308  0054, // + Sq
309  0034, // + Lz
310  0060, // Sq Lz
311  // Three simple shapes
312  0117, // X O +
313  0143, // X O Sq
314  0123, // X O Lz
315  0057, // X + Sq
316  0037, // X + Lz
317  0063, // X Sq Lz
318  0154, // O + Sq
319  0134, // O + Lz
320  0074, // + Sq Lz
321  // Four simple shapes
322  0174, // O Sq Lz +
323  0163, // X O Sq Lz
324  0157, // X O Sq +
325  0137, // X O Lz +
326  0077, // X Sq Lz +
327  // This draws *everything *
328  0177, // X O Sq Lz +
329  // Here we use the single bars... so the cross is forbidden
330  0110, // O -
331  0104, // O |
332  0101, // O /
333  0050, // Sq -
334  0044, // Sq |
335  0041, // Sq /
336  0030, // Lz -
337  0024, // Lz |
338  0021, // Lz /
339  0150, // O Sq -
340  0144, // O Sq |
341  0141, // O Sq /
342  0130, // O Lz -
343  0124, // O Lz |
344  0121, // O Lz /
345  0070, // Sq Lz -
346  0064, // Sq Lz |
347  0061, // Sq Lz /
348  0170, // O Sq Lz -
349  0164, // O Sq Lz |
350  0161, // O Sq Lz /
351  // Last resort: the backlash component (easy to confound)
352  0102, // \ O
353  0042, // \ Sq
354  0022, // \ Lz
355  0142, // \ O Sq
356  0122, // \ O Lz
357  0062, // \ Sq Lz
358  0162 // \ O Sq Lz
359  };
360  if( aShapeId >= MARKER_COUNT )
361  {
362  // Fallback shape
363  markerCircle( position, radius );
364  }
365  else
366  {
367  // Decode the pattern and draw the corresponding parts
368  unsigned char pat = marker_patterns[aShapeId];
369  if( pat & 0001 )
370  markerSlash( position, radius );
371  if( pat & 0002 )
372  markerBackSlash( position, radius );
373  if( pat & 0004 )
374  markerVBar( position, radius );
375  if( pat & 0010 )
376  markerHBar( position, radius );
377  if( pat & 0020 )
378  markerLozenge( position, radius );
379  if( pat & 0040 )
380  markerSquare( position, radius );
381  if( pat & 0100 )
382  markerCircle( position, radius );
383  }
384 }
void markerHBar(const wxPoint &pos, int radius)
Plot a - bar centered on the position.
Definition: plotter.cpp:253
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:401
void markerSlash(const wxPoint &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:260
void markerLozenge(const wxPoint &position, int radius)
Plot a lozenge centered on the position.
Definition: plotter.cpp:229
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:223
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:274
void markerSquare(const wxPoint &position, int radius)
Plot a square centered on the position.
Definition: plotter.cpp:198
void markerBackSlash(const wxPoint &pos, int radius)
Plot a \ bar centered on the position.
Definition: plotter.cpp:267

◆ markerBackSlash()

void PLOTTER::markerBackSlash ( const wxPoint &  pos,
int  radius 
)
protectedinherited

Plot a \ bar centered on the position.

Building block for markers

Definition at line 267 of file plotter.cpp.

References PLOTTER::FinishTo(), and PLOTTER::MoveTo().

Referenced by PLOTTER::Marker().

268 {
269  MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
270  FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
271 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241

◆ markerCircle()

void PLOTTER::markerCircle ( const wxPoint &  pos,
int  radius 
)
protectedinherited

Plot a circle centered on the position.

Building block for markers

Definition at line 223 of file plotter.cpp.

References PLOTTER::Circle(), PLOTTER::GetCurrentLineWidth(), and NO_FILL.

Referenced by PLOTTER::Marker().

224 {
225  Circle( position, radius * 2, NO_FILL, GetCurrentLineWidth() );
226 }
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

◆ markerHBar()

void PLOTTER::markerHBar ( const wxPoint &  pos,
int  radius 
)
protectedinherited

Plot a - bar centered on the position.

Building block for markers

Definition at line 253 of file plotter.cpp.

References PLOTTER::FinishTo(), and PLOTTER::MoveTo().

Referenced by PLOTTER::Marker().

254 {
255  MoveTo( wxPoint( pos.x - radius, pos.y ) );
256  FinishTo( wxPoint( pos.x + radius, pos.y ) );
257 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241

◆ markerLozenge()

void PLOTTER::markerLozenge ( const wxPoint &  position,
int  radius 
)
protectedinherited

Plot a lozenge centered on the position.

Building block for markers

Definition at line 229 of file plotter.cpp.

References PLOTTER::GetCurrentLineWidth(), NO_FILL, and PLOTTER::PlotPoly().

Referenced by PLOTTER::Marker().

230 {
231  std::vector< wxPoint > corner_list;
232  wxPoint corner;
233  corner.x = position.x;
234  corner.y = position.y + radius;
235  corner_list.push_back( corner );
236  corner.x = position.x + radius;
237  corner.y = position.y,
238  corner_list.push_back( corner );
239  corner.x = position.x;
240  corner.y = position.y - radius;
241  corner_list.push_back( corner );
242  corner.x = position.x - radius;
243  corner.y = position.y;
244  corner_list.push_back( corner );
245  corner.x = position.x;
246  corner.y = position.y + radius;
247  corner_list.push_back( corner );
248 
249  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
250 }
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152

◆ markerSlash()

void PLOTTER::markerSlash ( const wxPoint &  pos,
int  radius 
)
protectedinherited

Plot a / bar centered on the position.

Building block for markers

Definition at line 260 of file plotter.cpp.

References PLOTTER::FinishTo(), and PLOTTER::MoveTo().

Referenced by PLOTTER::Marker().

261 {
262  MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
263  FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
264 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241

◆ markerSquare()

void PLOTTER::markerSquare ( const wxPoint &  position,
int  radius 
)
protectedinherited

Plot a square centered on the position.

Building block for markers

Definition at line 198 of file plotter.cpp.

References PLOTTER::GetCurrentLineWidth(), KiROUND(), NO_FILL, and PLOTTER::PlotPoly().

Referenced by PLOTTER::Marker().

199 {
200  double r = KiROUND( radius / 1.4142 );
201  std::vector< wxPoint > corner_list;
202  wxPoint corner;
203  corner.x = position.x + r;
204  corner.y = position.y + r;
205  corner_list.push_back( corner );
206  corner.x = position.x + r;
207  corner.y = position.y - r;
208  corner_list.push_back( corner );
209  corner.x = position.x - r;
210  corner.y = position.y - r;
211  corner_list.push_back( corner );
212  corner.x = position.x - r;
213  corner.y = position.y + r;
214  corner_list.push_back( corner );
215  corner.x = position.x + r;
216  corner.y = position.y + r;
217  corner_list.push_back( corner );
218 
219  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
220 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152

◆ markerVBar()

void PLOTTER::markerVBar ( const wxPoint &  pos,
int  radius 
)
protectedinherited

Plot a | bar centered on the position.

Building block for markers

Definition at line 274 of file plotter.cpp.

References PLOTTER::FinishTo(), and PLOTTER::MoveTo().

Referenced by PLOTTER::Marker().

275 {
276  MoveTo( wxPoint( pos.x, pos.y - radius ) );
277  FinishTo( wxPoint( pos.x, pos.y + radius ) );
278 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241

◆ MoveTo()

◆ OpenFile()

bool PLOTTER::OpenFile ( const wxString &  aFullFilename)
virtualinherited

Open or create the plot file aFullFilename.

Parameters
aFullFilename= the full file name of the file to create
Returns
true if success, false if the file cannot be created/opened

Virtual because some plotters use ascii files, some others binary files (PDF) The base class open the file in text mode

Reimplemented in PDF_PLOTTER.

Definition at line 79 of file plotter.cpp.

References PLOTTER::filename, and PLOTTER::outputFile.

Referenced by GERBER_WRITER::createDrillFile(), GENDRILL_WRITER_BASE::genDrillMapFile(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG(), StartPlotBoard(), and LIB_EDIT_FRAME::SVG_PlotComponent().

80 {
81  filename = aFullFilename;
82 
83  wxASSERT( !outputFile );
84 
85  // Open the file in text mode (not suitable for all plotters
86  // but only for most of them
87  outputFile = wxFopen( filename, wxT( "wt" ) );
88 
89  if( outputFile == NULL )
90  return false ;
91 
92  return true;
93 }
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
wxString filename
Definition: plotter.h:566

◆ PenFinish()

void PLOTTER::PenFinish ( )
inlineinherited

Definition at line 257 of file plotter.h.

References PLOTTER::PenTo().

Referenced by HPGL_PLOTTER::Arc(), HPGL_PLOTTER::Circle(), HPGL_PLOTTER::FlashPadCircle(), HPGL_PLOTTER::PlotPoly(), PlotPoly(), DXF_PLOTTER::PlotPoly(), and HPGL_PLOTTER::Rect().

258  {
259  // The point is not important with Z motion
260  PenTo( wxPoint( 0, 0 ), 'Z' );
261  }
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the &#39;pen&#39; to the specified direction

◆ PenTo()

void GERBER_PLOTTER::PenTo ( const wxPoint &  pos,
char  plume 
)
overridevirtual

moveto/lineto primitive, moves the 'pen' to the specified direction

Parameters
posis the target position
plumespecifies the kind of motion: 'U' only moves the pen, 'D' draw a line from the current position and 'Z' finish the drawing and returns the 'pen' to rest (flushes the trace)

Implements PLOTTER.

Definition at line 422 of file GERBER_plotter.cpp.

References emitDcode(), PLOTTER::outputFile, PLOTTER::penState, and PLOTTER::userToDeviceCoordinates().

423 {
424  wxASSERT( outputFile );
425  DPOINT pos_dev = userToDeviceCoordinates( aPos );
426 
427  switch( plume )
428  {
429  case 'Z':
430  break;
431 
432  case 'U':
433  emitDcode( pos_dev, 2 );
434  break;
435 
436  case 'D':
437  emitDcode( pos_dev, 1 );
438  }
439 
440  penState = plume;
441 }
char penState
Current pen state: &#39;U&#39;, &#39;D&#39; or &#39;Z&#39; (see PenTo)
Definition: plotter.h:562
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:96
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554

◆ PlotImage()

void PLOTTER::PlotImage ( const wxImage &  aImage,
const wxPoint &  aPos,
double  aScaleFactor 
)
virtualinherited

Function PlotImage Only Postscript plotters can plot bitmaps for plotters that cannot plot a bitmap, a rectangle is plotted.

Draw an image bitmap

Parameters
aImage= the bitmap
aPos= position of the center of the bitmap
aScaleFactor= the scale factor to apply to the bitmap size (this is not the plot scale factor)

Reimplemented in SVG_PLOTTER, PDF_PLOTTER, and PS_PLOTTER.

Definition at line 181 of file plotter.cpp.

References NO_FILL, and PLOTTER::Rect().

Referenced by BITMAP_BASE::PlotImage(), and SVG_PLOTTER::PlotImage().

182 {
183  wxSize size( aImage.GetWidth() * aScaleFactor,
184  aImage.GetHeight() * aScaleFactor );
185 
186  wxPoint start = aPos;
187  start.x -= size.x / 2;
188  start.y -= size.y / 2;
189 
190  wxPoint end = start;
191  end.x += size.x;
192  end.y += size.y;
193 
194  Rect( start, end, NO_FILL );
195 }
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

◆ PlotPoly() [1/2]

void PLOTTER::PlotPoly ( const SHAPE_LINE_CHAIN aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = NULL 
)
virtualinherited

Function PlotPoly.

Draw a polygon ( filled or not )

Parameters
aCornerList= corners list (a SHAPE_LINE_CHAIN)
aFill= type of fill
aWidth= line width
aDataan auxiliary info (mainly for gerber format)

Definition at line 525 of file plotter.cpp.

References SHAPE_LINE_CHAIN::CPoint(), PLOTTER::PlotPoly(), and SHAPE_LINE_CHAIN::PointCount().

527 {
528  std::vector< wxPoint > cornerList;
529 
530  for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
531  cornerList.push_back( wxPoint( aCornerList.CPoint( ii ) ) );
532 
533  PlotPoly( cornerList , aFill, aWidth, aData );
534 }
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()

◆ PlotPoly() [2/2]

void GERBER_PLOTTER::PlotPoly ( const std::vector< wxPoint > &  aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = NULL 
)
overridevirtual

Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.

Implements PLOTTER.

Definition at line 497 of file GERBER_plotter.cpp.

References PLOTTER::FinishTo(), formatNetAttribute(), PLOTTER::LineTo(), GBR_METADATA::m_NetlistMetadata, PLOTTER::MoveTo(), PLOTTER::outputFile, PLOTTER::PenFinish(), and SetCurrentLineWidth().

Referenced by FlashPadCustom(), FlashPadRoundRect(), FlashPadTrapez(), and Rect().

499 {
500  if( aCornerList.size() <= 1 )
501  return;
502 
503  // Gerber format does not know filled polygons with thick outline
504  // Therefore, to plot a filled polygon with outline having a thickness,
505  // one should plot outline as thick segments
506  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
507 
508  SetCurrentLineWidth( aWidth, gbr_metadata );
509 
510  if( gbr_metadata )
511  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
512 
513  if( aFill )
514  {
515  fputs( "G36*\n", outputFile );
516 
517  MoveTo( aCornerList[0] );
518  fputs( "G01*\n", outputFile ); // Set linear interpolation.
519 
520  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
521  LineTo( aCornerList[ii] );
522 
523  FinishTo( aCornerList[0] );
524  fputs( "G37*\n", outputFile );
525  }
526 
527  if( aWidth > 0 )
528  {
529  MoveTo( aCornerList[0] );
530 
531  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
532  LineTo( aCornerList[ii] );
533 
534  // Ensure the thick outline is closed for filled polygons
535  // (if not filled, could be only a polyline)
536  if( aFill && ( aCornerList[aCornerList.size()-1] != aCornerList[0] ) )
537  LineTo( aCornerList[0] );
538 
539  PenFinish();
540  }
541 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void PenFinish()
Definition: plotter.h:257
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
void LineTo(const wxPoint &pos)
Definition: plotter.h:246
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181

◆ Rect()

void GERBER_PLOTTER::Rect ( const wxPoint &  p1,
const wxPoint &  p2,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 444 of file GERBER_plotter.cpp.

References PlotPoly().

Referenced by FlashPadRect(), and ThickRect().

445 {
446  std::vector< wxPoint > cornerList;
447 
448  // Build corners list
449  cornerList.push_back( p1 );
450  wxPoint corner(p1.x, p2.y);
451  cornerList.push_back( corner );
452  cornerList.push_back( p2 );
453  corner.x = p2.x;
454  corner.y = p1.y;
455  cornerList.push_back( corner );
456  cornerList.push_back( p1 );
457 
458  PlotPoly( cornerList, fill, width );
459 }
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.

◆ segmentAsOval()

void PLOTTER::segmentAsOval ( const wxPoint &  start,
const wxPoint &  end,
int  width,
EDA_DRAW_MODE_T  tracemode 
)
protectedinherited

Cdonvert a thick segment and plot it as an oval.

Definition at line 387 of file plotter.cpp.

References ArcTangente(), EuclideanNorm(), PLOTTER::FlashPadOval(), and KiROUND().

Referenced by PLOTTER::ThickSegment(), HPGL_PLOTTER::ThickSegment(), and ThickSegment().

389 {
390  wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
391  wxSize size( end.x - start.x, end.y - start.y );
392  double orient;
393 
394  if( size.y == 0 )
395  orient = 0;
396  else if( size.x == 0 )
397  orient = 900;
398  else
399  orient = -ArcTangente( size.y, size.x );
400 
401  size.x = KiROUND( EuclideanNorm( size ) ) + width;
402  size.y = width;
403 
404  FlashPadOval( center, size, orient, tracemode, NULL );
405 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:112
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:170
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadOval

◆ selectAperture()

void GERBER_PLOTTER::selectAperture ( const wxSize &  aSize,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
protected

Pick an existing aperture or create a new one, matching the size, type and attributes.

write the DCode selection on gerber file

Definition at line 318 of file GERBER_plotter.cpp.

References apertures, currentAperture, getAperture(), m_useNetAttributes, and PLOTTER::outputFile.

Referenced by FlashPadCircle(), FlashPadOval(), FlashPadRect(), and SetCurrentLineWidth().

321 {
322  bool change = ( currentAperture == apertures.end() ) ||
323  ( currentAperture->m_Type != aType ) ||
324  ( currentAperture->m_Size != aSize );
325 
326  if( !m_useNetAttributes )
327  aApertureAttribute = 0;
328  else
329  change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
330 
331  if( change )
332  {
333  // Pick an existing aperture or create a new one
334  currentAperture = getAperture( aSize, aType, aApertureAttribute );
335  fprintf( outputFile, "D%d*\n", currentAperture->m_DCode );
336  }
337 }
std::vector< APERTURE >::iterator getAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Function getAperture returns a reference to the aperture which meets the size anf type of tool if the...
bool m_useNetAttributes
Definition: plotter.h:1227
std::vector< APERTURE > apertures
Definition: plotter.h:1218
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1219

◆ SetColor()

virtual void GERBER_PLOTTER::SetColor ( COLOR4D  color)
inlineoverridevirtual

Implements PLOTTER.

Definition at line 1038 of file plotter.h.

1038 {}

◆ SetColorMode()

virtual void PLOTTER::SetColorMode ( bool  aColorMode)
inlinevirtualinherited

◆ SetCreator()

◆ SetCurrentLineWidth()

void GERBER_PLOTTER::SetCurrentLineWidth ( int  width,
void *  aData = NULL 
)
overridevirtual

Set the line width for the next drawing.

Parameters
widthis specified in IUs
aDatais an auxiliary parameter, mainly used in gerber plotter

Implements PLOTTER.

Definition at line 266 of file GERBER_plotter.cpp.

References PLOTTER::currentPenWidth, PLOTTER::defaultPenWidth, PLOTTER::DO_NOT_SET_LINE_WIDTH, GBR_METADATA::GetApertureAttrib(), APERTURE::Plotting, and selectAperture().

Referenced by Arc(), FlashPadCircle(), FlashPadCustom(), FlashPadRect(), FlashPadRoundRect(), FlashPadTrapez(), PlotPoly(), ThickArc(), ThickCircle(), ThickRect(), and ThickSegment().

267 {
268  if( width == DO_NOT_SET_LINE_WIDTH )
269  return;
270 
271  int pen_width;
272 
273  if( width > 0 )
274  pen_width = width;
275  else
276  pen_width = defaultPenWidth;
277 
278  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
279  int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
280 
281  selectAperture( wxSize( pen_width, pen_width ), APERTURE::Plotting, aperture_attribute );
282  currentPenWidth = pen_width;
283 }
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:147
int currentPenWidth
Definition: plotter.h:560
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:559
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101

◆ SetDash()

virtual void GERBER_PLOTTER::SetDash ( int  dashed)
inlineoverridevirtual

Implements PLOTTER.

Definition at line 1037 of file plotter.h.

1037 {}

◆ SetDefaultLineWidth()

void GERBER_PLOTTER::SetDefaultLineWidth ( int  width)
overridevirtual

Set the default line width.

Used at the beginning and when a width of -1 (USE_DEFAULT_LINE_WIDTH) is requested.

Parameters
widthis specified in IUs

Implements PLOTTER.

Definition at line 259 of file GERBER_plotter.cpp.

References apertures, currentAperture, and PLOTTER::defaultPenWidth.

Referenced by SetViewport().

260 {
261  defaultPenWidth = width;
262  currentAperture = apertures.end();
263 }
std::vector< APERTURE > apertures
Definition: plotter.h:1218
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:559
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1219

◆ SetGerberCoordinatesFormat()

void GERBER_PLOTTER::SetGerberCoordinatesFormat ( int  aResolution,
bool  aUseInches = false 
)
overridevirtual

Function SetGerberCoordinatesFormat selection of Gerber units and resolution (number of digits in mantissa)

Parameters
aResolution= number of digits in mantissa of coordinate use 5 or 6 for mm and 6 or 7 for inches do not use value > 6 (mm) or > 7 (in) to avoid overflow
aUseInches= true to use inches, false to use mm (default)

Should be called only after SetViewport() is called

Reimplemented from PLOTTER.

Definition at line 89 of file GERBER_plotter.cpp.

References PLOTTER::iuPerDeviceUnit, m_gerberUnitFmt, m_gerberUnitInch, and PLOTTER::m_IUsPerDecimil.

Referenced by GERBER_WRITER::createDrillFile().

90 {
91  m_gerberUnitInch = aUseInches;
92  m_gerberUnitFmt = aResolution;
93 
94  iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
95 
96  if( ! m_gerberUnitInch )
97  iuPerDeviceUnit *= 25.4; // gerber output in mm
98 }
double m_IUsPerDecimil
Definition: plotter.h:539
bool m_gerberUnitInch
Definition: plotter.h:1221
int m_gerberUnitFmt
Definition: plotter.h:1222
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:542

◆ SetLayerPolarity()

void GERBER_PLOTTER::SetLayerPolarity ( bool  aPositive)
overridevirtual

Change the plot polarity and begin a new layer Used to 'scratch off' silk screen away from solder mask.

Reimplemented from PLOTTER.

Definition at line 1007 of file GERBER_plotter.cpp.

References PLOTTER::outputFile.

1008 {
1009  if( aPositive )
1010  fprintf( outputFile, "%%LPD*%%\n" );
1011  else
1012  fprintf( outputFile, "%%LPC*%%\n" );
1013 }
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554

◆ SetNegative()

virtual void PLOTTER::SetNegative ( bool  aNegative)
inlinevirtualinherited

Definition at line 118 of file plotter.h.

References PLOTTER::negativeMode.

Referenced by FillNegativeKnockout().

119  {
120  negativeMode = aNegative;
121  }
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:558

◆ SetPageSettings()

◆ SetTextMode()

virtual void PLOTTER::SetTextMode ( PlotTextMode  mode)
inlinevirtualinherited

Change the current text mode.

See the PlotTextMode explanation at the beginning of the file

Reimplemented in DXF_PLOTTER, and PSLIKE_PLOTTER.

Definition at line 428 of file plotter.h.

Referenced by initializePlotter(), and PlotOneBoardLayer().

429  {
430  // NOP for most plotters.
431  }

◆ SetTitle()

virtual void PLOTTER::SetTitle ( const wxString &  aTitle)
inlinevirtualinherited

Definition at line 166 of file plotter.h.

References PLOTTER::title.

Referenced by DIALOG_PLOT_SCHEMATIC::createPDFFile().

167  {
168  title = aTitle;
169  }
wxString title
Definition: plotter.h:567

◆ SetViewport()

void GERBER_PLOTTER::SetViewport ( const wxPoint &  aOffset,
double  aIusPerDecimil,
double  aScale,
bool  aMirror 
)
overridevirtual

Set the plot offset and scaling for the current plot.

Parameters
aOffsetis the plot offset
aIusPerDecimilgives the scaling factor from IUs to device units
aScaleis the user set plot scaling factor (either explicitly or using 'fit to A4')
aMirrorflips the plot in the Y direction (useful for toner transfers or some kind of film)

Implements PLOTTER.

Definition at line 67 of file GERBER_plotter.cpp.

References PLOTTER::iuPerDeviceUnit, m_gerberUnitFmt, PLOTTER::m_IUsPerDecimil, PLOTTER::m_plotMirror, PLOTTER::paperSize, PLOTTER::plotOffset, PLOTTER::plotScale, and SetDefaultLineWidth().

Referenced by GERBER_WRITER::createDrillFile().

69 {
70  wxASSERT( aMirror == false );
71  m_plotMirror = false;
72  plotOffset = aOffset;
73  wxASSERT( aScale == 1 ); // aScale parameter is not used in Gerber
74  plotScale = 1; // Plot scale is *always* 1.0
75 
76  m_IUsPerDecimil = aIusPerDecimil;
77  // gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
78  // which could be modified later by calling SetGerberCoordinatesFormat()
79  iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
80 
81  // We don't handle the filmbox, and it's more useful to keep the
82  // origin at the origin
83  paperSize.x = 0;
84  paperSize.y = 0;
85  SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
86 }
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
double m_IUsPerDecimil
Definition: plotter.h:539
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:545
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:549
int m_gerberUnitFmt
Definition: plotter.h:1222
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:533
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:542
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:570

◆ sketchOval()

void PLOTTER::sketchOval ( const wxPoint &  pos,
const wxSize &  size,
double  orient,
int  width 
)
protectedinherited

Definition at line 408 of file plotter.cpp.

References AddAngles(), PLOTTER::Arc(), PLOTTER::currentPenWidth, PLOTTER::FinishTo(), PLOTTER::MoveTo(), NO_FILL, RotatePoint(), and PLOTTER::SetCurrentLineWidth().

Referenced by HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), FlashPadOval(), and DXF_PLOTTER::FlashPadOval().

409 {
410  SetCurrentLineWidth( width );
411  width = currentPenWidth;
412  int radius, deltaxy, cx, cy;
413  wxSize size( aSize );
414 
415  if( size.x > size.y )
416  {
417  std::swap( size.x, size.y );
418  orient = AddAngles( orient, 900 );
419  }
420 
421  deltaxy = size.y - size.x; /* distance between centers of the oval */
422  radius = ( size.x - width ) / 2;
423  cx = -radius;
424  cy = -deltaxy / 2;
425  RotatePoint( &cx, &cy, orient );
426  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
427  cx = -radius;
428  cy = deltaxy / 2;
429  RotatePoint( &cx, &cy, orient );
430  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
431 
432  cx = radius;
433  cy = -deltaxy / 2;
434  RotatePoint( &cx, &cy, orient );
435  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
436  cx = radius;
437  cy = deltaxy / 2;
438  RotatePoint( &cx, &cy, orient );
439  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
440 
441  cx = 0;
442  cy = deltaxy / 2;
443  RotatePoint( &cx, &cy, orient );
444  Arc( wxPoint( cx + pos.x, cy + pos.y ),
445  orient + 1800, orient + 3600,
446  radius, NO_FILL );
447  cx = 0;
448  cy = -deltaxy / 2;
449  RotatePoint( &cx, &cy, orient );
450  Arc( wxPoint( cx + pos.x, cy + pos.y ),
451  orient, orient + 1800,
452  radius, NO_FILL );
453 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
Definition: trigo.h:288
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
int currentPenWidth
Definition: plotter.h:560
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:154
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

◆ StartBlock()

void GERBER_PLOTTER::StartBlock ( void *  aData)
overridevirtual

calling this function allows one to define the beginning of a group of drawing items (used in X2 format with netlist attributes)

Parameters
aDatacan define any parameter

Reimplemented from PLOTTER.

Definition at line 125 of file GERBER_plotter.cpp.

References EndBlock().

126 {
127  // Currently, it is the same as EndBlock(): clear all aperture net attributes
128  EndBlock( aData );
129 }
virtual void EndBlock(void *aData) override
calling this function allows one to define the end of a group of drawing items the group is started b...

◆ StartPlot()

bool GERBER_PLOTTER::StartPlot ( )
overridevirtual

Function StartPlot Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.

Implements PLOTTER.

Definition at line 167 of file GERBER_plotter.cpp.

References PLOTTER::creator, DateAndTime(), PLOTTER::filename, finalFile, GetBuildVersion(), m_gerberUnitFmt, m_gerberUnitInch, PLOTTER::m_headerExtraLines, m_workFilename, PLOTTER::outputFile, TO_UTF8, and workFile.

Referenced by GERBER_WRITER::createDrillFile().

168 {
169  wxASSERT( outputFile );
170 
171  finalFile = outputFile; // the actual gerber file will be created later
172 
173  // Create a temporary filename to store gerber file
174  // note tmpfile() does not work under Vista and W7 in user mode
175  m_workFilename = filename + wxT(".tmp");
176  workFile = wxFopen( m_workFilename, wxT( "wt" ));
178  wxASSERT( outputFile );
179 
180  if( outputFile == NULL )
181  return false;
182 
183  for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ )
184  {
185  if( ! m_headerExtraLines[ii].IsEmpty() )
186  fprintf( outputFile, "%s\n", TO_UTF8( m_headerExtraLines[ii] ) );
187  }
188 
189  // Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted
190  // the number of digits for the integer part of coordintes is needed
191  // in gerber format, but is not very important when omitting leading zeros
192  // It is fixed here to 3 (inch) or 4 (mm), but is not actually used
193  int leadingDigitCount = m_gerberUnitInch ? 3 : 4;
194 
195  fprintf( outputFile, "%%FSLAX%d%dY%d%d*%%\n",
196  leadingDigitCount, m_gerberUnitFmt,
197  leadingDigitCount, m_gerberUnitFmt );
198  fprintf( outputFile,
199  "G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n",
200  leadingDigitCount, m_gerberUnitFmt,
201  m_gerberUnitInch ? "inch" : "mm" );
202 
203  wxString Title = creator + wxT( " " ) + GetBuildVersion();
204  fprintf( outputFile, "G04 Created by KiCad (%s) date %s*\n",
205  TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
206 
207  /* Mass parameter: unit = INCHES/MM */
208  if( m_gerberUnitInch )
209  fputs( "%MOIN*%\n", outputFile );
210  else
211  fputs( "%MOMM*%\n", outputFile );
212 
213  // Be sure the usual dark polarity is selected:
214  fputs( "%LPD*%\n", outputFile );
215 
216  fputs( "G04 APERTURE LIST*\n", outputFile );
217 
218  return true;
219 }
bool m_gerberUnitInch
Definition: plotter.h:1221
wxArrayString m_headerExtraLines
Definition: plotter.h:572
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
int m_gerberUnitFmt
Definition: plotter.h:1222
FILE * finalFile
Definition: plotter.h:1210
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
wxString m_workFilename
Definition: plotter.h:1211
FILE * workFile
Definition: plotter.h:1209
wxString filename
Definition: plotter.h:566
wxString creator
Definition: plotter.h:565
wxString DateAndTime()
Function DateAndTime.
Definition: string.cpp:306

◆ Text()

void GERBER_PLOTTER::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 
)
overridevirtual

Draws text with the plotter.

Function PLOTTER::Text same as DrawGraphicText, but plot graphic text insteed of draw it.

For convenience it accept the color to use for specific plotters (GERBER) aData is used to pass extra parameters

Parameters
aPos= text position (according to aH_justify, aV_justify)
aColor(COLOR4D) = text color
aText= text to draw
aOrient= angle in 0.1 degree
aSize= text size (size.x or size.y can be < 0 for mirrored texts)
aH_justify= horizontal justification (Left, center, right)
aV_justify= vertical justification (bottom, center, top)
aWidth= line width (pen width) (default = 0) if width < 0 : draw segments in sketch mode, width = abs(width) Use a value min(aSize.x, aSize.y) / 5 for a bold text
aItalic= true to simulate an italic font
aBold= true to use a bold font Useful only with default width value (aWidth = 0)
aMultilineAllowed= true to plot text as multiline, otherwise single line
aData= a parameter used by some plotters in SetCurrentLineWidth(), not directly used here.

Reimplemented from PLOTTER.

Definition at line 991 of file GERBER_plotter.cpp.

References formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, and PLOTTER::Text().

996 {
997  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
998 
999  if( gbr_metadata )
1000  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1001 
1002  PLOTTER::Text( aPos, aColor, aText, aOrient, aSize,
1003  aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed, aData );
1004 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
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.
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181

◆ ThickArc()

void GERBER_PLOTTER::ThickArc ( const wxPoint &  centre,
double  StAngle,
double  EndAngle,
int  rayon,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 565 of file GERBER_plotter.cpp.

References Arc(), PLOTTER::currentPenWidth, PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, NO_FILL, SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

567 {
568  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
569  SetCurrentLineWidth( width, gbr_metadata );
570 
571  if( gbr_metadata )
572  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
573 
574  if( tracemode == FILLED )
575  Arc( centre, StAngle, EndAngle, radius, NO_FILL, DO_NOT_SET_LINE_WIDTH );
576  else
577  {
579  Arc( centre, StAngle, EndAngle,
580  radius - ( width - currentPenWidth ) / 2,
582  Arc( centre, StAngle, EndAngle,
583  radius + ( width - currentPenWidth ) / 2, NO_FILL,
585  }
586 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:560
virtual void Arc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101

◆ ThickCircle()

void GERBER_PLOTTER::ThickCircle ( const wxPoint &  pos,
int  diametre,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 617 of file GERBER_plotter.cpp.

References Circle(), PLOTTER::currentPenWidth, PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, NO_FILL, SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

619 {
620  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
621  SetCurrentLineWidth( width, gbr_metadata );
622 
623  if( gbr_metadata )
624  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
625 
626  if( tracemode == FILLED )
627  Circle( pos, diametre, NO_FILL, DO_NOT_SET_LINE_WIDTH );
628  else
629  {
631  Circle( pos, diametre - (width - currentPenWidth),
633  Circle( pos, diametre + (width - currentPenWidth),
635  }
636 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:560
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101

◆ ThickRect()

void GERBER_PLOTTER::ThickRect ( const wxPoint &  p1,
const wxPoint &  p2,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 589 of file GERBER_plotter.cpp.

References PLOTTER::currentPenWidth, PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, NO_FILL, Rect(), SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

591 {
592  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
593  SetCurrentLineWidth( width, gbr_metadata );
594 
595  if( gbr_metadata )
596  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
597 
598  if( tracemode == FILLED )
599  Rect( p1, p2, NO_FILL, DO_NOT_SET_LINE_WIDTH );
600  else
601  {
603  wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
604  p1.y - (width - currentPenWidth) / 2 );
605  wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
606  p2.y + (width - currentPenWidth) / 2 );
607  Rect( offsetp1, offsetp2, NO_FILL, -1 );
608  offsetp1.x += (width - currentPenWidth);
609  offsetp1.y += (width - currentPenWidth);
610  offsetp2.x -= (width - currentPenWidth);
611  offsetp2.y -= (width - currentPenWidth);
612  Rect( offsetp1, offsetp2, NO_FILL, DO_NOT_SET_LINE_WIDTH );
613  }
614 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:560
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101

◆ ThickSegment()

void GERBER_PLOTTER::ThickSegment ( const wxPoint &  start,
const wxPoint &  end,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 544 of file GERBER_plotter.cpp.

References FILLED, PLOTTER::FinishTo(), formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, PLOTTER::MoveTo(), PLOTTER::segmentAsOval(), SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

Referenced by GERBER_WRITER::createDrillFile(), and FlashPadOval().

546 {
547  if( tracemode == FILLED )
548  {
549  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
550  SetCurrentLineWidth( width, gbr_metadata );
551 
552  if( gbr_metadata )
553  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
554 
555  MoveTo( start );
556  FinishTo( end );
557  }
558  else
559  {
561  segmentAsOval( start, end, width, tracemode );
562  }
563 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:181
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode)
Cdonvert a thick segment and plot it as an oval.
Definition: plotter.cpp:387

◆ userToDeviceCoordinates()

DPOINT PLOTTER::userToDeviceCoordinates ( const wxPoint &  aCoordinate)
protectedvirtualinherited

Modifies coordinates according to the orientation, scale factor, and offsets trace.

Also convert from a wxPoint to DPOINT, since some output engines needs floating point coordinates.

Definition at line 96 of file plotter.cpp.

References PLOTTER::iuPerDeviceUnit, PLOTTER::m_mirrorIsHorizontal, PLOTTER::m_plotMirror, PLOTTER::m_yaxisReversed, PLOTTER::paperSize, PLOTTER::plotOffset, and PLOTTER::plotScale.

Referenced by HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), SVG_PLOTTER::Arc(), Arc(), DXF_PLOTTER::Arc(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), SVG_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PSLIKE_PLOTTER::computeTextParameters(), HPGL_PLOTTER::FlashPadCircle(), FlashPadCircle(), FlashPadOval(), FlashPadRect(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), PenTo(), DXF_PLOTTER::PenTo(), PS_PLOTTER::PlotImage(), PDF_PLOTTER::PlotImage(), PS_PLOTTER::PlotPoly(), PDF_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), HPGL_PLOTTER::Rect(), PS_PLOTTER::Rect(), PDF_PLOTTER::Rect(), SVG_PLOTTER::Rect(), PS_PLOTTER::Text(), and DXF_PLOTTER::Text().

97 {
98  wxPoint pos = aCoordinate - plotOffset;
99 
100  double x = pos.x * plotScale;
101  double y = ( paperSize.y - pos.y * plotScale );
102 
103  if( m_plotMirror )
104  {
106  x = ( paperSize.x - pos.x * plotScale );
107  else
108  y = pos.y * plotScale;
109  }
110 
111  if( m_yaxisReversed )
112  y = paperSize.y - y;
113 
114  x *= iuPerDeviceUnit;
115  y *= iuPerDeviceUnit;
116 
117  return DPOINT( x, y );
118 }
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:545
bool m_yaxisReversed
true to mirror horizontally (else vertically)
Definition: plotter.h:551
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:549
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:533
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:542
VECTOR2< double > DPOINT
Definition: vector2d.h:592
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:570
bool m_mirrorIsHorizontal
Definition: plotter.h:550

◆ userToDeviceSize() [1/2]

DPOINT PLOTTER::userToDeviceSize ( const wxSize &  size)
protectedvirtualinherited

◆ userToDeviceSize() [2/2]

double PLOTTER::userToDeviceSize ( double  size) const
protectedvirtualinherited

Modifies size according to the plotter scale factors (simple double version)

Definition at line 128 of file plotter.cpp.

References PLOTTER::iuPerDeviceUnit, and PLOTTER::plotScale.

129 {
130  return size * plotScale * iuPerDeviceUnit;
131 }
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:533
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:542

◆ UseX2format()

void GERBER_PLOTTER::UseX2format ( bool  aEnable)
inline

Definition at line 1137 of file plotter.h.

References m_useX2format.

Referenced by GERBER_WRITER::createDrillFile(), and StartPlotBoard().

1137 { m_useX2format = aEnable; }
bool m_useX2format
Definition: plotter.h:1224

◆ UseX2NetAttributes()

void GERBER_PLOTTER::UseX2NetAttributes ( bool  aEnable)
inline

Definition at line 1138 of file plotter.h.

References m_useNetAttributes.

Referenced by GERBER_WRITER::createDrillFile(), and StartPlotBoard().

1138 { m_useNetAttributes = aEnable; }
bool m_useNetAttributes
Definition: plotter.h:1227

◆ writeApertureList()

void GERBER_PLOTTER::writeApertureList ( )
protected

Generate the table of D codes.

Definition at line 340 of file GERBER_plotter.cpp.

References apertures, APERTURE::Circle, GBR_APERTURE_METADATA::FormatAttribute(), m_apertureAttribute, m_gerberUnitInch, PLOTTER::m_IUsPerDecimil, m_useX2format, PLOTTER::outputFile, APERTURE::Oval, PLOTTER::plotScale, APERTURE::Plotting, and APERTURE::Rect.

Referenced by EndPlot().

341 {
342  wxASSERT( outputFile );
343  char cbuf[1024];
344 
345  bool useX1StructuredComment = false;
346 
347  if( !m_useX2format )
348  useX1StructuredComment = true;
349 
350  // Init
351  for( std::vector<APERTURE>::iterator tool = apertures.begin();
352  tool != apertures.end(); ++tool )
353  {
354  // apertude sizes are in inch or mm, regardless the
355  // coordinates format
356  double fscale = 0.0001 * plotScale / m_IUsPerDecimil; // inches
357 
358  if(! m_gerberUnitInch )
359  fscale *= 25.4; // size in mm
360 
361  int attribute = tool->m_ApertureAttribute;
362 
363  if( attribute != m_apertureAttribute )
364  {
367  useX1StructuredComment ).c_str(), outputFile );
368  }
369 
370  char* text = cbuf + sprintf( cbuf, "%%ADD%d", tool->m_DCode );
371 
372  /* Please note: the Gerber specs for mass parameters say that
373  exponential syntax is *not* allowed and the decimal point should
374  also be always inserted. So the %g format is ruled out, but %f is fine
375  (the # modifier forces the decimal point). Sadly the %f formatter
376  can't remove trailing zeros but thats not a problem, since nothing
377  forbid it (the file is only slightly longer) */
378 
379  switch( tool->m_Type )
380  {
381  case APERTURE::Circle:
382  sprintf( text, "C,%#f*%%\n", tool->m_Size.x * fscale );
383  break;
384 
385  case APERTURE::Rect:
386  sprintf( text, "R,%#fX%#f*%%\n",
387  tool->m_Size.x * fscale,
388  tool->m_Size.y * fscale );
389  break;
390 
391  case APERTURE::Plotting:
392  sprintf( text, "C,%#f*%%\n", tool->m_Size.x * fscale );
393  break;
394 
395  case APERTURE::Oval:
396  sprintf( text, "O,%#fX%#f*%%\n",
397  tool->m_Size.x * fscale,
398  tool->m_Size.y * fscale );
399  break;
400  }
401 
402  fputs( cbuf, outputFile );
403 
404  m_apertureAttribute = attribute;
405 
406  // Currently reset the aperture attribute. Perhaps a better optimization
407  // is to store the last attribute
408  if( attribute )
409  {
410  if( m_useX2format )
411  fputs( "%TD*%\n", outputFile );
412  else
413  fputs( "G04 #@! TD*\n", outputFile );
414 
416  }
417 
418  }
419 }
std::vector< APERTURE > apertures
Definition: plotter.h:1218
double m_IUsPerDecimil
Definition: plotter.h:539
bool m_gerberUnitInch
Definition: plotter.h:1221
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:533
bool m_useX2format
Definition: plotter.h:1224
static std::string FormatAttribute(GBR_APERTURE_ATTRIB aAttribute, bool aUseX1StructuredComment)
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:554
int m_apertureAttribute
Definition: plotter.h:1207

Member Data Documentation

◆ apertures

std::vector<APERTURE> GERBER_PLOTTER::apertures
protected

◆ colorMode

◆ creator

wxString PLOTTER::creator
protectedinherited

◆ currentAperture

std::vector<APERTURE>::iterator GERBER_PLOTTER::currentAperture
protected

Definition at line 1219 of file plotter.h.

Referenced by GERBER_PLOTTER(), selectAperture(), and SetDefaultLineWidth().

◆ currentPenWidth

◆ defaultPenWidth

◆ DO_NOT_SET_LINE_WIDTH

const int PLOTTER::DO_NOT_SET_LINE_WIDTH = -2
staticinherited

Definition at line 101 of file plotter.h.

Referenced by FlashPadCircle(), SetCurrentLineWidth(), ThickArc(), ThickCircle(), and ThickRect().

◆ filename

wxString PLOTTER::filename
protectedinherited

◆ finalFile

FILE* GERBER_PLOTTER::finalFile
protected

Definition at line 1210 of file plotter.h.

Referenced by EndPlot(), GERBER_PLOTTER(), and StartPlot().

◆ iuPerDeviceUnit

◆ m_apertureAttribute

int GERBER_PLOTTER::m_apertureAttribute
protected

Definition at line 1207 of file plotter.h.

Referenced by GERBER_PLOTTER(), and writeApertureList().

◆ m_gerberUnitFmt

int GERBER_PLOTTER::m_gerberUnitFmt
protected

Definition at line 1222 of file plotter.h.

Referenced by GERBER_PLOTTER(), SetGerberCoordinatesFormat(), SetViewport(), and StartPlot().

◆ m_gerberUnitInch

bool GERBER_PLOTTER::m_gerberUnitInch
protected

◆ m_headerExtraLines

wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

Definition at line 572 of file plotter.h.

Referenced by PLOTTER::AddLineToHeader(), PLOTTER::ClearHeaderLinesList(), and StartPlot().

◆ m_IUsPerDecimil

◆ m_mirrorIsHorizontal

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited

◆ m_objectAttributesDictionnary

std::string GERBER_PLOTTER::m_objectAttributesDictionnary
protected

Definition at line 1204 of file plotter.h.

Referenced by clearNetAttribute(), and formatNetAttribute().

◆ m_plotMirror

◆ m_useNetAttributes

bool GERBER_PLOTTER::m_useNetAttributes
protected

Definition at line 1227 of file plotter.h.

Referenced by formatNetAttribute(), GERBER_PLOTTER(), selectAperture(), and UseX2NetAttributes().

◆ m_useX2format

bool GERBER_PLOTTER::m_useX2format
protected

◆ m_workFilename

wxString GERBER_PLOTTER::m_workFilename
protected

Definition at line 1211 of file plotter.h.

Referenced by EndPlot(), and StartPlot().

◆ m_yaxisReversed

bool PLOTTER::m_yaxisReversed
protectedinherited

true to mirror horizontally (else vertically)

Definition at line 551 of file plotter.h.

Referenced by SVG_PLOTTER::Arc(), PLOTTER::PLOTTER(), SVG_PLOTTER::SetViewport(), and PLOTTER::userToDeviceCoordinates().

◆ MARKER_COUNT

const unsigned PLOTTER::MARKER_COUNT = 58
staticinherited

Draw a marker (used for the drill map)

Definition at line 401 of file plotter.h.

Referenced by PLOTTER::Marker().

◆ negativeMode

bool PLOTTER::negativeMode
protectedinherited

true to plot in color, false to plot in black and white

Definition at line 558 of file plotter.h.

Referenced by PLOTTER::PLOTTER(), PSLIKE_PLOTTER::SetColor(), and PLOTTER::SetNegative().

◆ outputFile

FILE* PLOTTER::outputFile
protectedinherited

true if the Y axis is top to bottom (SVG)

Output file

Definition at line 554 of file plotter.h.

Referenced by HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), SVG_PLOTTER::Arc(), Arc(), DXF_PLOTTER::Arc(), HPGL_PLOTTER::Circle(), PS_PLOTTER::Circle(), SVG_PLOTTER::Circle(), DXF_PLOTTER::Circle(), clearNetAttribute(), PDF_PLOTTER::ClosePage(), PDF_PLOTTER::closePdfObject(), PDF_PLOTTER::closePdfStream(), emitDcode(), PS_PLOTTER::emitSetRGBColor(), HPGL_PLOTTER::EndPlot(), PS_PLOTTER::EndPlot(), PDF_PLOTTER::EndPlot(), SVG_PLOTTER::EndPlot(), EndPlot(), DXF_PLOTTER::EndPlot(), HPGL_PLOTTER::FlashPadCircle(), DXF_PLOTTER::FlashPadCircle(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), FlashPadOval(), DXF_PLOTTER::FlashPadOval(), FlashPadRect(), DXF_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadTrapez(), formatNetAttribute(), PLOTTER::OpenFile(), PDF_PLOTTER::OpenFile(), HPGL_PLOTTER::penControl(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), PenTo(), DXF_PLOTTER::PenTo(), PS_PLOTTER::PlotImage(), HPGL_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), PlotPoly(), PLOTTER::PLOTTER(), HPGL_PLOTTER::Rect(), PS_PLOTTER::Rect(), SVG_PLOTTER::Rect(), DXF_PLOTTER::Rect(), selectAperture(), PS_PLOTTER::SetCurrentLineWidth(), HPGL_PLOTTER::SetDash(), PS_PLOTTER::SetDash(), SetLayerPolarity(), SVG_PLOTTER::setSVGPlotStyle(), PS_PLOTTER::SetViewport(), PDF_PLOTTER::StartPage(), PDF_PLOTTER::startPdfObject(), PDF_PLOTTER::startPdfStream(), HPGL_PLOTTER::StartPlot(), PS_PLOTTER::StartPlot(), PDF_PLOTTER::StartPlot(), SVG_PLOTTER::StartPlot(), StartPlot(), DXF_PLOTTER::StartPlot(), PS_PLOTTER::Text(), DXF_PLOTTER::Text(), HPGL_PLOTTER::ThickSegment(), writeApertureList(), and PLOTTER::~PLOTTER().

◆ pageInfo

◆ paperSize

wxSize PLOTTER::paperSize
protectedinherited

◆ penLastpos

wxPoint PLOTTER::penLastpos
protectedinherited

Last pen positions; set to -1,-1 when the pen is at rest.

Definition at line 564 of file plotter.h.

Referenced by HPGL_PLOTTER::penControl(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), and DXF_PLOTTER::PenTo().

◆ penState

char PLOTTER::penState
protectedinherited

Current pen state: 'U', 'D' or 'Z' (see PenTo)

Definition at line 562 of file plotter.h.

Referenced by HPGL_PLOTTER::penControl(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), PenTo(), and PLOTTER::PLOTTER().

◆ plotOffset

wxPoint PLOTTER::plotOffset
protectedinherited

◆ plotScale

double PLOTTER::plotScale
protectedinherited

◆ title

wxString PLOTTER::title
protectedinherited

Definition at line 567 of file plotter.h.

Referenced by PDF_PLOTTER::EndPlot(), and PLOTTER::SetTitle().

◆ USE_DEFAULT_LINE_WIDTH

◆ workFile

FILE* GERBER_PLOTTER::workFile
protected

Definition at line 1209 of file plotter.h.

Referenced by EndPlot(), GERBER_PLOTTER(), and StartPlot().


The documentation for this class was generated from the following files: