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 UseX2Attributes (bool aEnable)
 
void UseX2NetAttributes (bool aEnable)
 
virtual void StartBlock (void *aData) override
 calling this function allows 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 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 _negative)
 
virtual void SetColorMode (bool _color_mode)
 
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_useX2Attributes
 
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 1010 of file plotter.h.

Constructor & Destructor Documentation

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_useX2Attributes, 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_useX2Attributes = false;
63  m_useNetAttributes = true;
64 }
bool m_useNetAttributes
Definition: plotter.h:1225
std::vector< APERTURE > apertures
Definition: plotter.h:1217
bool m_gerberUnitInch
Definition: plotter.h:1220
int m_gerberUnitFmt
Definition: plotter.h:1221
FILE * finalFile
Definition: plotter.h:1209
bool m_useX2Attributes
Definition: plotter.h:1223
int m_apertureAttribute
Definition: plotter.h:1206
FILE * workFile
Definition: plotter.h:1208
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1218

Member Function Documentation

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 175 of file plotter.h.

References PLOTTER::m_headerExtraLines.

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

176  {
177  m_headerExtraLines.Add( aExtraString );
178  }
wxArrayString m_headerExtraLines
Definition: plotter.h:571
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 473 of file GERBER_plotter.cpp.

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

Referenced by Circle(), and ThickArc().

475 {
476  SetCurrentLineWidth( aWidth );
477 
478  wxPoint start, end;
479  start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) );
480  start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) );
481  MoveTo( start );
482  end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
483  end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
484  DPOINT devEnd = userToDeviceCoordinates( end );
485  DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
486 
487  fprintf( outputFile, "G75*\n" ); // Multiquadrant mode
488 
489  if( aStAngle < aEndAngle )
490  fprintf( outputFile, "G03" );
491  else
492  fprintf( outputFile, "G02" );
493 
494  fprintf( outputFile, "X%dY%dI%dJ%dD01*\n",
495  KiROUND( devEnd.x ), KiROUND( devEnd.y ),
496  KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
497  fprintf( outputFile, "G01*\n" ); // Back to linear interp.
498 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
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:240
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:99
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:553
void GERBER_PLOTTER::Circle ( const wxPoint pos,
int  diametre,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 467 of file GERBER_plotter.cpp.

References Arc().

Referenced by FlashPadCircle(), and ThickCircle().

468 {
469  Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
470 }
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.
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 184 of file plotter.h.

References PLOTTER::m_headerExtraLines, PLOTTER::OpenFile(), and PLOTTER::SetViewport().

Referenced by StartPlotBoard().

185  {
186  m_headerExtraLines.Clear();
187  }
wxArrayString m_headerExtraLines
Definition: plotter.h:571
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_useX2Attributes, 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_useX2Attributes )
117  fputs( "%TD*%\n", outputFile );
118  else
119  fputs( "G04 #@! TD*\n", outputFile );
120 
122 }
bool m_useX2Attributes
Definition: plotter.h:1223
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
std::string m_objectAttributesDictionnary
Definition: plotter.h:1203
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:106
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
void GERBER_PLOTTER::EndBlock ( void *  aData)
overridevirtual

calling this function allows 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 ...
bool GERBER_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 227 of file GERBER_plotter.cpp.

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

Referenced by GERBER_WRITER::createDrillFile().

228 {
229  char line[1024];
230  wxString msg;
231 
232  wxASSERT( outputFile );
233 
234  /* Outfile is actually a temporary file i.e. workFile */
235  fputs( "M02*\n", outputFile );
236  fflush( outputFile );
237 
238  fclose( workFile );
239  workFile = wxFopen( m_workFilename, wxT( "rt" ));
240  wxASSERT( workFile );
242 
243  // Placement of apertures in RS274X
244  while( fgets( line, 1024, workFile ) )
245  {
246  fputs( line, outputFile );
247 
248  if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 )
249  {
251  fputs( "G04 APERTURE END LIST*\n", outputFile );
252  }
253  }
254 
255  fclose( workFile );
256  fclose( finalFile );
257  ::wxRemoveFile( m_workFilename );
258  outputFile = 0;
259 
260  return true;
261 }
void writeApertureList()
Generate the table of D codes.
FILE * finalFile
Definition: plotter.h:1209
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
wxString m_workFilename
Definition: plotter.h:1210
FILE * workFile
Definition: plotter.h:1208
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 642 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().

643 {
644  wxSize size( diametre, diametre );
645  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
646 
647  if( trace_mode == SKETCH )
648  {
650 
651  if( gbr_metadata )
652  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
653 
655  }
656  else
657  {
658  DPOINT pos_dev = userToDeviceCoordinates( pos );
659 
660  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
661  selectAperture( size, APERTURE::Circle, aperture_attrib );
662 
663  if( gbr_metadata )
664  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
665 
666  emitDcode( pos_dev, 3 );
667  }
668 }
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:104
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:114
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:99
int currentPenWidth
Definition: plotter.h:559
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
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:103
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 873 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.

877 {
878  // A Pad custom is plotted as polygon.
879 
880  // A flashed circle @aPadPos is added (anchor pad)
881  // However, because the anchor pad can be circle or rect, we use only
882  // a circle not bigger than the rect.
883  // the main purpose is to print a flashed DCode as pad anchor
884  if( aTraceMode == FILLED )
885  FlashPadCircle( aPadPos, std::min( aSize.x, aSize.y ), aTraceMode, aData );
886 
887  GBR_METADATA gbr_metadata;
888 
889  if( aData )
890  {
891  gbr_metadata = *static_cast<GBR_METADATA*>( aData );
892  // If the pad is drawn on a copper layer,
893  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
894  if( gbr_metadata.IsCopper() )
896 
897  wxString attrname( ".P" );
898  gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
899  }
900 
901  SHAPE_POLY_SET polyshape = *aPolygons;
902 
903  if( aTraceMode != FILLED )
904  {
906  polyshape.Inflate( -GetCurrentLineWidth()/2, 16 );
907  }
908 
909  std::vector< wxPoint > cornerList;
910 
911  for( int cnt = 0; cnt < polyshape.OutlineCount(); ++cnt )
912  {
913  SHAPE_LINE_CHAIN& poly = polyshape.Outline( cnt );
914 
915  cornerList.clear();
916 
917  for( int ii = 0; ii < poly.PointCount(); ++ii )
918  cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
919 
920  // Close polygon
921  cornerList.push_back( cornerList[0] );
922 
923  PlotPoly( cornerList,
924  aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
925  aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
926  }
927 }
int PointCount() const
Function PointCount()
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:137
int OutlineCount() const
Returns the number of outlines in the set
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
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:51
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
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:109
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
#define min(a, b)
Definition: auxiliary.h:85
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 671 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(), PLOTTER::userToDeviceCoordinates(), wxPoint::x, and wxPoint::y.

Referenced by GERBER_WRITER::createDrillFile().

673 {
674  wxASSERT( outputFile );
675  wxSize size( aSize );
676  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
677 
678  /* Plot a flashed shape. */
679  if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
680  && trace_mode == FILLED )
681  {
682  if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
683  std::swap( size.x, size.y );
684 
685  DPOINT pos_dev = userToDeviceCoordinates( pos );
686  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
687  selectAperture( size, APERTURE::Oval, aperture_attrib );
688 
689  if( gbr_metadata )
690  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
691 
692  emitDcode( pos_dev, 3 );
693  }
694  else /* Plot pad as a segment. */
695  {
696  if( size.x > size.y )
697  {
698  std::swap( size.x, size.y );
699 
700  if( orient < 2700 )
701  orient += 900;
702  else
703  orient -= 2700;
704  }
705 
706  if( trace_mode == FILLED )
707  {
708  // TODO: use an aperture macro to declare the rotated pad
709 
710  // Flash a pad anchor, if a netlist attribute is set
711  if( aData )
712  FlashPadCircle( pos, size.x, trace_mode, aData );
713 
714  // The pad is reduced to an segment with dy > dx
715  int delta = size.y - size.x;
716  int x0 = 0;
717  int y0 = -delta / 2;
718  int x1 = 0;
719  int y1 = delta / 2;
720  RotatePoint( &x0, &y0, orient );
721  RotatePoint( &x1, &y1, orient );
722  GBR_METADATA metadata;
723 
724  if( gbr_metadata )
725  {
726  metadata = *gbr_metadata;
727 
728  // If the pad is drawn on a copper layer,
729  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
730  if( metadata.IsCopper() )
732 
733  // Clear .P attribute, only allowed for flashed items
734  wxString attrname( ".P" );
735  metadata.m_NetlistMetadata.ClearAttribute( &attrname );
736  }
737 
738  ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
739  wxPoint( pos.x + x1, pos.y + y1 ),
740  size.x, trace_mode, &metadata );
741  }
742  else
743  {
744  sketchOval( pos, size, orient, -1 );
745  }
746  }
747 }
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:137
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:114
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:51
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:99
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
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:109
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:409
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 750 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, PLOTTER::userToDeviceCoordinates(), wxPoint::x, and wxPoint::y.

753 {
754  wxASSERT( outputFile );
755  wxSize size( aSize );
756  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
757 
758  // Plot as an aperture flash
759  switch( int( orient ) )
760  {
761  case 900:
762  case 2700: // rotation of 90 degrees or 270 swaps sizes
763  std::swap( size.x, size.y );
764  // Pass through
765  case 0:
766  case 1800:
767  if( trace_mode == SKETCH )
768  {
770 
771  if( gbr_metadata )
772  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
773 
774  Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
775  pos.y - (size.y - currentPenWidth) / 2 ),
776  wxPoint( pos.x + (size.x - currentPenWidth) / 2,
777  pos.y + (size.y - currentPenWidth) / 2 ),
779  }
780  else
781  {
782  DPOINT pos_dev = userToDeviceCoordinates( pos );
783  int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
784  selectAperture( size, APERTURE::Rect, aperture_attrib );
785 
786  if( gbr_metadata )
787  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
788 
789  emitDcode( pos_dev, 3 );
790  }
791  break;
792 
793  default: // plot pad shape as polygon
794  {
795  // XXX to do: use an aperture macro to declare the rotated pad
796  wxPoint coord[4];
797  // coord[0] is assumed the lower left
798  // coord[1] is assumed the upper left
799  // coord[2] is assumed the upper right
800  // coord[3] is assumed the lower right
801 
802  /* Trace the outline. */
803  coord[0].x = -size.x/2; // lower left
804  coord[0].y = size.y/2;
805  coord[1].x = -size.x/2; // upper left
806  coord[1].y = -size.y/2;
807  coord[2].x = size.x/2; // upper right
808  coord[2].y = -size.y/2;
809  coord[3].x = size.x/2; // lower right
810  coord[3].y = size.y/2;
811 
812  FlashPadTrapez( pos, coord, orient, trace_mode, aData );
813  }
814  break;
815  }
816 }
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 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:104
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:114
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:99
int currentPenWidth
Definition: plotter.h:559
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
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 818 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.

822 {
823  GBR_METADATA gbr_metadata;
824 
825  if( aData )
826  {
827  gbr_metadata = *static_cast<GBR_METADATA*>( aData );
828  // If the pad is drawn on a copper layer,
829  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
830  if( gbr_metadata.IsCopper() )
832 
833  wxString attrname( ".P" );
834  gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
835  }
836 
837  if( aTraceMode != FILLED )
839 
840  // Currently, a Pad RoundRect is plotted as polygon.
841  // TODO: use Aperture macro and flash it
842  SHAPE_POLY_SET outline;
843  const int segmentToCircleCount = 64;
844  TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
845  aCornerRadius, segmentToCircleCount );
846 
847  if( aTraceMode != FILLED )
848  outline.Inflate( -GetCurrentLineWidth()/2, 16 );
849 
850  std::vector< wxPoint > cornerList;
851  // TransformRoundRectToPolygon creates only one convex polygon
852  SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
853  cornerList.reserve( poly.PointCount() + 1 );
854 
855  for( int ii = 0; ii < poly.PointCount(); ++ii )
856  cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
857 
858  // Close polygon
859  cornerList.push_back( cornerList[0] );
860 
861  PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
862  aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
863 
864  // Now, flash a pad anchor, if a netlist attribute is set
865  // (remove me when a Aperture macro will be used)
866  if( aData && aTraceMode == FILLED )
867  {
868  int diameter = std::min( aSize.x, aSize.y );
869  FlashPadCircle( aPadPos, diameter, aTraceMode , aData );
870  }
871 }
int PointCount() const
Function PointCount()
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:137
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
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:51
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
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:109
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
#define min(a, b)
Definition: auxiliary.h:85
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 930 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().

933 {
934  // Currently, a Pad Trapezoid is plotted as polygon.
935  // TODO: use Aperture macro and flash it
936 
937  // polygon corners list
938  std::vector< wxPoint > cornerList;
939 
940  for( int ii = 0; ii < 4; ii++ )
941  cornerList.push_back( aCorners[ii] );
942 
943  // Now, flash a pad anchor, if a netlist attribute is set
944  // (remove me when a Aperture macro will be used)
945  if( aData && ( aTrace_Mode == FILLED ) )
946  {
947  // Calculate the radius of the circle inside the shape
948  // It is the smaller dist from shape pos to edges
949  int radius = INT_MAX;
950 
951  for( unsigned ii = 0, jj = cornerList.size()-1; ii < cornerList.size();
952  jj = ii, ii++ )
953  {
954  SEG segment( aCorners[ii], aCorners[jj] );
955  int dist = segment.LineDistance( VECTOR2I( 0, 0) );
956  radius = std::min( radius, dist );
957  }
958 
959  FlashPadCircle( aPadPos, radius*2, aTrace_Mode, aData );
960  }
961 
962  // Draw the polygon and fill the interior as required
963  for( unsigned ii = 0; ii < 4; ii++ )
964  {
965  RotatePoint( &cornerList[ii], aPadOrient );
966  cornerList[ii] += aPadPos;
967  }
968 
969  // Close the polygon
970  cornerList.push_back( cornerList[0] );
971  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
972 
973  GBR_METADATA metadata;
974 
975  if( gbr_metadata )
976  {
977  metadata = *gbr_metadata;
978  // If the pad is drawn on a copper layer,
979  // set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
980  if( metadata.IsCopper() )
982 
983  wxString attrname( ".P" );
984  metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
985  }
986 
988  PlotPoly( cornerList, aTrace_Mode == FILLED ? FILLED_SHAPE : NO_FILL,
989  aTrace_Mode == FILLED ? 0 : GetCurrentLineWidth(),
990  &metadata );
991 }
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.
static const int dist[10][10]
Definition: dist.cpp:57
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:137
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
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:51
Definition: seg.h:36
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
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:109
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
#define min(a, b)
Definition: auxiliary.h:85
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_useX2Attributes, 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  bool useX1StructuredComment = false;
148 
149  if( !m_useX2Attributes )
150  useX1StructuredComment = true;
151  else if( !m_useNetAttributes )
152  return;
153 
154  bool clearDict;
155  std::string short_attribute_string;
156 
157  if( !FormatNetAttribute( short_attribute_string, m_objectAttributesDictionnary,
158  aData, clearDict, useX1StructuredComment ) )
159  return;
160 
161  if( clearDict )
163 
164  if( !short_attribute_string.empty() )
165  fputs( short_attribute_string.c_str(), outputFile );
166 }
void clearNetAttribute()
clear a Gerber net attribute record (clear object attribute dictionnary) and output the clear object ...
bool m_useNetAttributes
Definition: plotter.h:1225
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_useX2Attributes
Definition: plotter.h:1223
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
std::string m_objectAttributesDictionnary
Definition: plotter.h:1203
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 291 of file GERBER_plotter.cpp.

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

Referenced by selectAperture().

293 {
294  int last_D_code = 9;
295 
296  // Search an existing aperture
297  std::vector<APERTURE>::iterator tool = apertures.begin();
298 
299  while( tool != apertures.end() )
300  {
301  last_D_code = tool->m_DCode;
302 
303  if( (tool->m_Type == aType) && (tool->m_Size == aSize) &&
304  (tool->m_ApertureAttribute == aApertureAttribute) )
305  return tool;
306 
307  ++tool;
308  }
309 
310  // Allocate a new aperture
311  APERTURE new_tool;
312  new_tool.m_Size = aSize;
313  new_tool.m_Type = aType;
314  new_tool.m_DCode = last_D_code + 1;
315  new_tool.m_ApertureAttribute = aApertureAttribute;
316 
317  apertures.push_back( new_tool );
318 
319  return apertures.end() - 1;
320 }
APERTURE_TYPE m_Type
Definition: plotter.h:1002
wxSize m_Size
Definition: plotter.h:1001
std::vector< APERTURE > apertures
Definition: plotter.h:1217
int m_DCode
Definition: plotter.h:1003
int m_ApertureAttribute
Definition: plotter.h:1004
bool PLOTTER::GetColorMode ( ) const
inlineinherited
double PLOTTER::GetDashGapLenIU ( ) const
protectedinherited

Definition at line 150 of file plotter.cpp.

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

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

151 {
152  return 3.0 * GetDotMarkLenIU() + userToDeviceSize( 2 * GetCurrentLineWidth() );
153 }
double GetDotMarkLenIU() const
Definition: plotter.cpp:137
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) ...
Definition: plotter.cpp:124
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
double PLOTTER::GetDashMarkLenIU ( ) const
protectedinherited

Definition at line 144 of file plotter.cpp.

References PLOTTER::GetDashGapLenIU(), PLOTTER::GetDotMarkLenIU(), and max.

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

145 {
146  return std::max( GetDashGapLenIU(), 5.0 * GetDotMarkLenIU() );
147 }
double GetDotMarkLenIU() const
Definition: plotter.cpp:137
#define max(a, b)
Definition: auxiliary.h:86
double GetDashGapLenIU() const
Definition: plotter.cpp:150
static wxString GERBER_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 1020 of file plotter.h.

References PLOTTER::EndPlot(), PLOTTER::SetCurrentLineWidth(), PLOTTER::SetDefaultLineWidth(), and PLOTTER::StartPlot().

Referenced by GetDefaultPlotExtension().

1021  {
1022  return wxString( wxT( "gbr" ) );
1023  }
double PLOTTER::GetDotMarkLenIU ( ) const
protectedinherited

Definition at line 137 of file plotter.cpp.

References PLOTTER::GetCurrentLineWidth(), PLOTTER::m_dotMarkLength_mm, PLOTTER::m_IUsPerDecimil, max, and PLOTTER::userToDeviceSize().

Referenced by PLOTTER::EndBlock(), PLOTTER::GetDashGapLenIU(), PLOTTER::GetDashMarkLenIU(), PS_PLOTTER::SetDash(), PDF_PLOTTER::SetDash(), and SVG_PLOTTER::setSVGPlotStyle().

138 {
139  return userToDeviceSize( std::max( 1.0,
140  m_dotMarkLength_mm * 10000 / 25.4 * m_IUsPerDecimil - GetCurrentLineWidth() ) );
141 }
double m_dotMarkLength_mm
Dotted line parameter in mm: segment.
Definition: plotter.h:99
double m_IUsPerDecimil
Definition: plotter.h:538
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT) ...
Definition: plotter.cpp:124
virtual int GetCurrentLineWidth() const
Definition: plotter.h:151
#define max(a, b)
Definition: auxiliary.h:86
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 216 of file plotter.h.

References PLOTTER::Arc(), PLOTTER::Circle(), PLOTTER::m_IUsPerDecimil, PLOTTER::PenTo(), and PLOTTER::Rect().

Referenced by PlotWorkSheet().

216 { return m_IUsPerDecimil; }
double m_IUsPerDecimil
Definition: plotter.h:538
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 1015 of file plotter.h.

References PLOT_FORMAT_GERBER.

1016  {
1017  return PLOT_FORMAT_GERBER;
1018  }
void PLOTTER::LineTo ( const wxPoint pos)
inlineinherited

Definition at line 245 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().

246  {
247  PenTo( pos, 'D' );
248  }
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the &#39;pen&#39; to the specified direction
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 282 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().

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

Plot a \ bar centered on the position.

Building block for markers

Definition at line 268 of file plotter.cpp.

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), wxPoint::x, and wxPoint::y.

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

269 {
270  MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
271  FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
272 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
void PLOTTER::markerCircle ( const wxPoint pos,
int  radius 
)
protectedinherited

Plot a circle centered on the position.

Building block for markers

Definition at line 224 of file plotter.cpp.

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

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

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

Plot a - bar centered on the position.

Building block for markers

Definition at line 254 of file plotter.cpp.

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), wxPoint::x, and wxPoint::y.

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

255 {
256  MoveTo( wxPoint( pos.x - radius, pos.y ) );
257  FinishTo( wxPoint( pos.x + radius, pos.y ) );
258 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
void PLOTTER::markerLozenge ( const wxPoint position,
int  radius 
)
protectedinherited

Plot a lozenge centered on the position.

Building block for markers

Definition at line 230 of file plotter.cpp.

References PLOTTER::GetCurrentLineWidth(), NO_FILL, PLOTTER::PlotPoly(), wxPoint::x, and wxPoint::y.

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

231 {
232  std::vector< wxPoint > corner_list;
233  wxPoint corner;
234  corner.x = position.x;
235  corner.y = position.y + radius;
236  corner_list.push_back( corner );
237  corner.x = position.x + radius;
238  corner.y = position.y,
239  corner_list.push_back( corner );
240  corner.x = position.x;
241  corner.y = position.y - radius;
242  corner_list.push_back( corner );
243  corner.x = position.x - radius;
244  corner.y = position.y;
245  corner_list.push_back( corner );
246  corner.x = position.x;
247  corner.y = position.y + radius;
248  corner_list.push_back( corner );
249 
250  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
251 }
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:151
void PLOTTER::markerSlash ( const wxPoint pos,
int  radius 
)
protectedinherited

Plot a / bar centered on the position.

Building block for markers

Definition at line 261 of file plotter.cpp.

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), wxPoint::x, and wxPoint::y.

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

262 {
263  MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
264  FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
265 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
void PLOTTER::markerSquare ( const wxPoint position,
int  radius 
)
protectedinherited

Plot a square centered on the position.

Building block for markers

Definition at line 199 of file plotter.cpp.

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

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

200 {
201  double r = KiROUND( radius / 1.4142 );
202  std::vector< wxPoint > corner_list;
203  wxPoint corner;
204  corner.x = position.x + r;
205  corner.y = position.y + r;
206  corner_list.push_back( corner );
207  corner.x = position.x + r;
208  corner.y = position.y - r;
209  corner_list.push_back( corner );
210  corner.x = position.x - r;
211  corner.y = position.y - r;
212  corner_list.push_back( corner );
213  corner.x = position.x - r;
214  corner.y = position.y + r;
215  corner_list.push_back( corner );
216  corner.x = position.x + r;
217  corner.y = position.y + r;
218  corner_list.push_back( corner );
219 
220  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
221 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
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:151
void PLOTTER::markerVBar ( const wxPoint pos,
int  radius 
)
protectedinherited

Plot a | bar centered on the position.

Building block for markers

Definition at line 275 of file plotter.cpp.

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), wxPoint::x, and wxPoint::y.

Referenced by PLOTTER::EndBlock(), and PLOTTER::Marker().

276 {
277  MoveTo( wxPoint( pos.x, pos.y - radius ) );
278  FinishTo( wxPoint( pos.x, pos.y + radius ) );
279 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
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 82 of file plotter.cpp.

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

Referenced by PLOTTER::ClearHeaderLinesList(), GERBER_WRITER::createDrillFile(), GENDRILL_WRITER_BASE::genDrillMapFile(), PDF_PLOTTER::GetDefaultFileExtension(), 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().

83 {
84  filename = aFullFilename;
85 
86  wxASSERT( !outputFile );
87 
88  // Open the file in text mode (not suitable for all plotters
89  // but only for most of them
90  outputFile = wxFopen( filename, wxT( "wt" ) );
91 
92  if( outputFile == NULL )
93  return false ;
94 
95  return true;
96 }
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
wxString filename
Definition: plotter.h:565
void PLOTTER::PenFinish ( )
inlineinherited
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 427 of file GERBER_plotter.cpp.

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

428 {
429  wxASSERT( outputFile );
430  DPOINT pos_dev = userToDeviceCoordinates( aPos );
431 
432  switch( plume )
433  {
434  case 'Z':
435  break;
436 
437  case 'U':
438  emitDcode( pos_dev, 2 );
439  break;
440 
441  case 'D':
442  emitDcode( pos_dev, 1 );
443  }
444 
445  penState = plume;
446 }
char penState
Current pen state: &#39;U&#39;, &#39;D&#39; or &#39;Z&#39; (see PenTo)
Definition: plotter.h:561
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:99
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
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 182 of file plotter.cpp.

References NO_FILL, PLOTTER::Rect(), wxPoint::x, and wxPoint::y.

Referenced by PDF_PLOTTER::GetDefaultFileExtension(), PS_PLOTTER::GetPlotterType(), SVG_PLOTTER::GetPlotterType(), PLOTTER::PenFinish(), BITMAP_BASE::PlotImage(), and SVG_PLOTTER::PlotImage().

183 {
184  wxSize size( aImage.GetWidth() * aScaleFactor,
185  aImage.GetHeight() * aScaleFactor );
186 
187  wxPoint start = aPos;
188  start.x -= size.x / 2;
189  start.y -= size.y / 2;
190 
191  wxPoint end = start;
192  end.x += size.x;
193  end.y += size.y;
194 
195  Rect( start, end, NO_FILL );
196 }
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
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 526 of file plotter.cpp.

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

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

503 {
504  if( aCornerList.size() <= 1 )
505  return;
506 
507  // Gerber format does not know filled polygons with thick outline
508  // Therefore, to plot a filled polygon with outline having a thickness,
509  // one should plot outline as thick segments
510  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
511 
512  SetCurrentLineWidth( aWidth, gbr_metadata );
513 
514  if( gbr_metadata )
515  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
516 
517  if( aFill )
518  {
519  fputs( "G36*\n", outputFile );
520 
521  MoveTo( aCornerList[0] );
522 
523  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
524  LineTo( aCornerList[ii] );
525 
526  FinishTo( aCornerList[0] );
527  fputs( "G37*\n", outputFile );
528  }
529 
530  if( aWidth > 0 )
531  {
532  MoveTo( aCornerList[0] );
533 
534  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
535  LineTo( aCornerList[ii] );
536 
537  // Ensure the thick outline is closed for filled polygons
538  // (if not filled, could be only a polyline)
539  if( aFill && ( aCornerList[aCornerList.size()-1] != aCornerList[0] ) )
540  LineTo( aCornerList[0] );
541 
542  PenFinish();
543  }
544 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void PenFinish()
Definition: plotter.h:256
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
void LineTo(const wxPoint &pos)
Definition: plotter.h:245
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:240
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
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 449 of file GERBER_plotter.cpp.

References PlotPoly(), wxPoint::x, and wxPoint::y.

Referenced by FlashPadRect(), and ThickRect().

450 {
451  std::vector< wxPoint > cornerList;
452 
453  // Build corners list
454  cornerList.push_back( p1 );
455  wxPoint corner(p1.x, p2.y);
456  cornerList.push_back( corner );
457  cornerList.push_back( p2 );
458  corner.x = p2.x;
459  corner.y = p1.y;
460  cornerList.push_back( corner );
461  cornerList.push_back( p1 );
462 
463  PlotPoly( cornerList, fill, width );
464 }
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.
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 388 of file plotter.cpp.

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

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

390 {
391  wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
392  wxSize size( end.x - start.x, end.y - start.y );
393  double orient;
394 
395  if( size.y == 0 )
396  orient = 0;
397  else if( size.x == 0 )
398  orient = 900;
399  else
400  orient = -ArcTangente( size.y, size.x );
401 
402  size.x = KiROUND( EuclideanNorm( size ) ) + width;
403  size.y = width;
404 
405  FlashPadOval( center, size, orient, tracemode, NULL );
406 }
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:106
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
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 323 of file GERBER_plotter.cpp.

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

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

326 {
327  bool change = ( currentAperture == apertures.end() ) ||
328  ( currentAperture->m_Type != aType ) ||
329  ( currentAperture->m_Size != aSize );
330 
332  aApertureAttribute = 0;
333  else
334  change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
335 
336  if( change )
337  {
338  // Pick an existing aperture or create a new one
339  currentAperture = getAperture( aSize, aType, aApertureAttribute );
340  fprintf( outputFile, "D%d*\n", currentAperture->m_DCode );
341  }
342 }
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:1225
std::vector< APERTURE > apertures
Definition: plotter.h:1217
bool m_useX2Attributes
Definition: plotter.h:1223
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1218
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 271 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().

272 {
273  if( width == DO_NOT_SET_LINE_WIDTH )
274  return;
275 
276  int pen_width;
277 
278  if( width > 0 )
279  pen_width = width;
280  else
281  pen_width = defaultPenWidth;
282 
283  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
284  int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
285 
286  selectAperture( wxSize( pen_width, pen_width ), APERTURE::Plotting, aperture_attribute );
287  currentPenWidth = pen_width;
288 }
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:114
int currentPenWidth
Definition: plotter.h:559
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:558
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:103
virtual void GERBER_PLOTTER::SetDash ( int  dashed)
inlineoverridevirtual

Implements PLOTTER.

Definition at line 1036 of file plotter.h.

1036 {}
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 264 of file GERBER_plotter.cpp.

References apertures, currentAperture, and PLOTTER::defaultPenWidth.

Referenced by SetViewport().

265 {
266  defaultPenWidth = width;
267  currentAperture = apertures.end();
268 }
std::vector< APERTURE > apertures
Definition: plotter.h:1217
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:558
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1218
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:538
bool m_gerberUnitInch
Definition: plotter.h:1220
int m_gerberUnitFmt
Definition: plotter.h:1221
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:541
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 1010 of file GERBER_plotter.cpp.

References PLOTTER::outputFile.

1011 {
1012  if( aPositive )
1013  fprintf( outputFile, "%%LPD*%%\n" );
1014  else
1015  fprintf( outputFile, "%%LPC*%%\n" );
1016 }
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:553
virtual void PLOTTER::SetNegative ( bool  _negative)
inlinevirtualinherited

Definition at line 120 of file plotter.h.

References PLOTTER::negativeMode.

Referenced by FillNegativeKnockout().

121  {
122  negativeMode = _negative;
123  }
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:557
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 427 of file plotter.h.

Referenced by initializePlotter(), and PlotOneBoardLayer().

428  {
429  // NOP for most plotters.
430  }
virtual void PLOTTER::SetTitle ( const wxString &  aTitle)
inlinevirtualinherited

Definition at line 165 of file plotter.h.

References PLOTTER::title.

Referenced by DIALOG_PLOT_SCHEMATIC::createPDFFile().

166  {
167  title = aTitle;
168  }
wxString title
Definition: plotter.h:566
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:538
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:544
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:548
int m_gerberUnitFmt
Definition: plotter.h:1221
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:532
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:541
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:569
void PLOTTER::sketchOval ( const wxPoint pos,
const wxSize &  size,
double  orient,
int  width 
)
protectedinherited

Definition at line 409 of file plotter.cpp.

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

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

410 {
411  SetCurrentLineWidth( width );
412  width = currentPenWidth;
413  int radius, deltaxy, cx, cy;
414  wxSize size( aSize );
415 
416  if( size.x > size.y )
417  {
418  std::swap( size.x, size.y );
419  orient = AddAngles( orient, 900 );
420  }
421 
422  deltaxy = size.y - size.x; /* distance between centers of the oval */
423  radius = ( size.x - width ) / 2;
424  cx = -radius;
425  cy = -deltaxy / 2;
426  RotatePoint( &cx, &cy, orient );
427  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
428  cx = -radius;
429  cy = deltaxy / 2;
430  RotatePoint( &cx, &cy, orient );
431  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
432 
433  cx = radius;
434  cy = -deltaxy / 2;
435  RotatePoint( &cx, &cy, orient );
436  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
437  cx = radius;
438  cy = deltaxy / 2;
439  RotatePoint( &cx, &cy, orient );
440  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
441 
442  cx = 0;
443  cy = deltaxy / 2;
444  RotatePoint( &cx, &cy, orient );
445  Arc( wxPoint( cx + pos.x, cy + pos.y ),
446  orient + 1800, orient + 3600,
447  radius, NO_FILL );
448  cx = 0;
449  cy = -deltaxy / 2;
450  RotatePoint( &cx, &cy, orient );
451  Arc( wxPoint( cx + pos.x, cy + pos.y ),
452  orient, orient + 1800,
453  radius, NO_FILL );
454 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
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:240
int currentPenWidth
Definition: plotter.h:559
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:155
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
void GERBER_PLOTTER::StartBlock ( void *  aData)
overridevirtual

calling this function allows 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 to define the end of a group of drawing items the group is started by St...
bool GERBER_PLOTTER::StartPlot ( )
overridevirtual

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

Implements PLOTTER.

Definition at line 169 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().

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

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

999 {
1000  GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1001 
1002  if( gbr_metadata )
1003  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1004 
1005  PLOTTER::Text( aPos, aColor, aText, aOrient, aSize,
1006  aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed, aData );
1007 }
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:148
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 568 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.

570 {
571  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
572  SetCurrentLineWidth( width, gbr_metadata );
573 
574  if( gbr_metadata )
575  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
576 
577  if( tracemode == FILLED )
578  Arc( centre, StAngle, EndAngle, radius, NO_FILL, DO_NOT_SET_LINE_WIDTH );
579  else
580  {
582  Arc( centre, StAngle, EndAngle,
583  radius - ( width - currentPenWidth ) / 2,
585  Arc( centre, StAngle, EndAngle,
586  radius + ( width - currentPenWidth ) / 2, NO_FILL,
588  }
589 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:559
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:148
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:103
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 620 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.

622 {
623  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
624  SetCurrentLineWidth( width, gbr_metadata );
625 
626  if( gbr_metadata )
627  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
628 
629  if( tracemode == FILLED )
630  Circle( pos, diametre, NO_FILL, DO_NOT_SET_LINE_WIDTH );
631  else
632  {
634  Circle( pos, diametre - (width - currentPenWidth),
636  Circle( pos, diametre + (width - currentPenWidth),
638  }
639 }
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:559
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
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:103
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 592 of file GERBER_plotter.cpp.

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

594 {
595  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
596  SetCurrentLineWidth( width, gbr_metadata );
597 
598  if( gbr_metadata )
599  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
600 
601  if( tracemode == FILLED )
602  Rect( p1, p2, NO_FILL, DO_NOT_SET_LINE_WIDTH );
603  else
604  {
606  wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
607  p1.y - (width - currentPenWidth) / 2 );
608  wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
609  p2.y + (width - currentPenWidth) / 2 );
610  Rect( offsetp1, offsetp2, NO_FILL, -1 );
611  offsetp1.x += (width - currentPenWidth);
612  offsetp1.y += (width - currentPenWidth);
613  offsetp2.x -= (width - currentPenWidth);
614  offsetp2.y -= (width - currentPenWidth);
615  Rect( offsetp1, offsetp2, NO_FILL, DO_NOT_SET_LINE_WIDTH );
616  }
617 }
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:104
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
int currentPenWidth
Definition: plotter.h:559
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:103
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 547 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().

549 {
550  if( tracemode == FILLED )
551  {
552  GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
553  SetCurrentLineWidth( width, gbr_metadata );
554 
555  if( gbr_metadata )
556  formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
557 
558  MoveTo( start );
559  FinishTo( end );
560  }
561  else
562  {
564  segmentAsOval( start, end, width, tracemode );
565  }
566 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:104
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:240
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:148
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:388
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 99 of file plotter.cpp.

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

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(), PLOTTER::EndBlock(), 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().

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

Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)

Definition at line 124 of file plotter.cpp.

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

Referenced by PS_PLOTTER::Arc(), SVG_PLOTTER::Arc(), DXF_PLOTTER::Arc(), HPGL_PLOTTER::Circle(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), SVG_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PSLIKE_PLOTTER::computeTextParameters(), PLOTTER::EndBlock(), HPGL_PLOTTER::FlashPadCircle(), PLOTTER::GetDashGapLenIU(), PLOTTER::GetDotMarkLenIU(), PDF_PLOTTER::PlotImage(), HPGL_PLOTTER::SetCurrentLineWidth(), PS_PLOTTER::SetCurrentLineWidth(), PDF_PLOTTER::SetCurrentLineWidth(), SVG_PLOTTER::setSVGPlotStyle(), PDF_PLOTTER::StartPage(), HPGL_PLOTTER::StartPlot(), PS_PLOTTER::StartPlot(), PS_PLOTTER::Text(), PDF_PLOTTER::Text(), and DXF_PLOTTER::Text().

125 {
126  return DPOINT( size.x * plotScale * iuPerDeviceUnit,
127  size.y * plotScale * iuPerDeviceUnit );
128 }
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:532
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:541
VECTOR2< double > DPOINT
Definition: vector2d.h:594
double PLOTTER::userToDeviceSize ( double  size) const
protectedvirtualinherited

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

Definition at line 131 of file plotter.cpp.

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

132 {
133  return size * plotScale * iuPerDeviceUnit;
134 }
double plotScale
Plot scale - chosen by the user (even implicitly with &#39;fit in a4&#39;)
Definition: plotter.h:532
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:541
void GERBER_PLOTTER::UseX2Attributes ( bool  aEnable)
inline

Definition at line 1136 of file plotter.h.

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

1136 { m_useX2Attributes = aEnable; }
bool m_useX2Attributes
Definition: plotter.h:1223
void GERBER_PLOTTER::UseX2NetAttributes ( bool  aEnable)
inline

Definition at line 1137 of file plotter.h.

References PLOTTER::EndBlock(), and PLOTTER::StartBlock().

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

1137 { m_useNetAttributes = aEnable; }
bool m_useNetAttributes
Definition: plotter.h:1225
void GERBER_PLOTTER::writeApertureList ( )
protected

Generate the table of D codes.

Definition at line 345 of file GERBER_plotter.cpp.

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

Referenced by EndPlot().

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

Member Data Documentation

std::vector<APERTURE> GERBER_PLOTTER::apertures
protected
wxString PLOTTER::creator
protectedinherited
std::vector<APERTURE>::iterator GERBER_PLOTTER::currentAperture
protected

Definition at line 1218 of file plotter.h.

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

const int PLOTTER::DO_NOT_SET_LINE_WIDTH = -2
staticinherited

Definition at line 103 of file plotter.h.

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

wxString PLOTTER::filename
protectedinherited
FILE* GERBER_PLOTTER::finalFile
protected

Definition at line 1209 of file plotter.h.

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

int GERBER_PLOTTER::m_apertureAttribute
protected

Definition at line 1206 of file plotter.h.

Referenced by GERBER_PLOTTER(), and writeApertureList().

int GERBER_PLOTTER::m_gerberUnitFmt
protected

Definition at line 1221 of file plotter.h.

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

bool GERBER_PLOTTER::m_gerberUnitInch
protected
wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

Definition at line 571 of file plotter.h.

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

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited
std::string GERBER_PLOTTER::m_objectAttributesDictionnary
protected

Definition at line 1203 of file plotter.h.

Referenced by clearNetAttribute(), and formatNetAttribute().

bool GERBER_PLOTTER::m_useNetAttributes
protected

Definition at line 1225 of file plotter.h.

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

bool GERBER_PLOTTER::m_useX2Attributes
protected
wxString GERBER_PLOTTER::m_workFilename
protected

Definition at line 1210 of file plotter.h.

Referenced by EndPlot(), and StartPlot().

bool PLOTTER::m_yaxisReversed
protectedinherited

true to mirror horizontally (else vertically)

Definition at line 550 of file plotter.h.

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

const unsigned PLOTTER::MARKER_COUNT = 58
staticinherited

Draw a marker (used for the drill map)

Definition at line 400 of file plotter.h.

Referenced by PLOTTER::Marker().

bool PLOTTER::negativeMode
protectedinherited

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

Definition at line 557 of file plotter.h.

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

FILE* PLOTTER::outputFile
protectedinherited

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

Output file

Definition at line 553 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().

wxSize PLOTTER::paperSize
protectedinherited
wxPoint PLOTTER::penLastpos
protectedinherited

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

Definition at line 563 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().

char PLOTTER::penState
protectedinherited

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

Definition at line 561 of file plotter.h.

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

double PLOTTER::plotScale
protectedinherited
wxString PLOTTER::title
protectedinherited

Definition at line 566 of file plotter.h.

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

FILE* GERBER_PLOTTER::workFile
protected

Definition at line 1208 of file plotter.h.

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


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