KiCad PCB EDA Suite
DXF_PLOTTER Class Reference

#include <plotter.h>

Inheritance diagram for DXF_PLOTTER:
PLOTTER

Public Types

enum  DXF_UNITS { DXF_UNITS::INCHES = 0, DXF_UNITS::MILLIMETERS = 1 }
 

Public Member Functions

 DXF_PLOTTER ()
 
virtual PLOT_FORMAT GetPlotterType () const override
 Returns the effective plot engine in use. More...
 
virtual void SetTextMode (PLOT_TEXT_MODE mode) override
 DXF handles NATIVE text emitting TEXT entities. More...
 
virtual bool StartPlot () override
 Opens the DXF plot with a skeleton header. 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 SetDash (PLOT_DASH_TYPE dashed) override
 
virtual void SetColor (COLOR4D color) override
 The DXF exporter handles 'colors' as layers... More...
 
virtual void SetViewport (const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
 Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring. More...
 
virtual void Rect (const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 DXF rectangle: fill not supported. More...
 
virtual void Circle (const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide as the radius. More...
 
virtual void PlotPoly (const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
 DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline. More...
 
virtual void ThickSegment (const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
 
virtual void Arc (const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 Generic fallback: arc rendered as a polyline. More...
 
virtual void PenTo (const wxPoint &pos, char plume) override
 moveto/lineto primitive, moves the 'pen' to the specified direction More...
 
virtual void FlashPadCircle (const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
 DXF round pad: always done in sketch mode; it could be filled but it isn't pretty if other kinds of pad aren't... More...
 
virtual void FlashPadOval (const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
 DXF oval pad: always done in sketch mode. More...
 
virtual void FlashPadRect (const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
 DXF rectangular pad: alwayd done in sketch mode. More...
 
virtual void FlashPadRoundRect (const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
 virtual function FlashPadRoundRect 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
 DXF trapezoidal pad: only sketch mode is supported. More...
 
virtual void FlashRegularPolygon (const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
 Flash a regular polygon. 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...
 
void SetUnits (DXF_UNITS aUnit)
 Set the units to use for plotting the DXF file. More...
 
DXF_UNITS GetUnits () const
 The units currently enabled for plotting. More...
 
double GetUnitScaling () const
 Get the scale factor to apply to convert the device units to be in the currently set units. More...
 
unsigned int GetMeasurementDirective () const
 Get the correct value for the $MEASUREMENT field given the current units. More...
 
virtual void SetNegative (bool aNegative)
 
virtual void SetColorMode (bool aColorMode)
 Plot in B/W or color. More...
 
bool GetColorMode () const
 
void SetRenderSettings (RENDER_SETTINGS *aSettings)
 
RENDER_SETTINGSRenderSettings ()
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)
 
PAGE_INFOPageSettings ()
 
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...
 
int GetPlotterArcLowDef () const
 
int GetPlotterArcHighDef () const
 
virtual void BezierCurve (const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH)
 Generic fallback: Cubic Bezier curve rendered as a polyline In Kicad the bezier curves have 4 control points: start ctrl1 ctrl2 end. 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...
 
virtual void ThickArc (const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData)
 
virtual void ThickRect (const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData)
 
virtual void ThickCircle (const wxPoint &pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void *aData)
 
void Marker (const wxPoint &position, int diametre, unsigned aShapeId)
 Draw a pattern shape number aShapeId, to coord position. More...
 
virtual void SetLayerPolarity (bool aPositive)
 Function SetLayerPolarity sets current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerber file, respectively. More...
 
virtual void SetGerberCoordinatesFormat (int aResolution, bool aUseInches=false)
 
virtual void SetSvgCoordinatesFormat (unsigned aResolution, bool aUseInches=false)
 
virtual void StartBlock (void *aData)
 calling this function allows one to define the beginning of a group of drawing items, for instance in SVG or Gerber format. More...
 
virtual void EndBlock (void *aData)
 calling this function allows one to define the end of a group of drawing items for instance in SVG or Gerber format. 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 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

bool m_textAsLines
 
COLOR4D m_currentColor
 
PLOT_DASH_TYPE m_currentLineType
 
DXF_UNITS m_plotUnits
 
double m_unitScalingFactor
 
unsigned int m_measurementDirective
 
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
 
int currentPenWidth
 
char penState
 
wxPoint penLastpos
 
wxString creator
 
wxString filename
 
wxString title
 
PAGE_INFO pageInfo
 
wxSize paperSize
 
wxArrayString m_headerExtraLines
 
RENDER_SETTINGSm_renderSettings
 

Detailed Description

Definition at line 1434 of file plotter.h.

Member Enumeration Documentation

◆ DXF_UNITS

Enumerator
INCHES 
MILLIMETERS 

Definition at line 1523 of file plotter.h.

1524  {
1525  INCHES = 0,
1526  MILLIMETERS = 1
1527  };

Constructor & Destructor Documentation

◆ DXF_PLOTTER()

DXF_PLOTTER::DXF_PLOTTER ( )
inline

Definition at line 1437 of file plotter.h.

1437  : m_textAsLines( false )
1438  {
1439  m_textAsLines = true;
1443  }
bool m_textAsLines
Definition: plotter.h:1568
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
Definition: color4d.h:44
COLOR4D m_currentColor
Definition: plotter.h:1569
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1570

References BLACK, INCHES, m_currentColor, m_currentLineType, m_textAsLines, SetUnits(), and SOLID.

Member Function Documentation

◆ AddLineToHeader()

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

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

Parameters
aExtraStringis the string to print

Definition at line 179 of file plotter.h.

180  {
181  m_headerExtraLines.Add( aExtraString );
182  }
wxArrayString m_headerExtraLines
Definition: plotter.h:601

References PLOTTER::m_headerExtraLines.

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

◆ Arc()

void DXF_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 647 of file DXF_plotter.cpp.

649 {
650  wxASSERT( outputFile );
651 
652  if( radius <= 0 )
653  return;
654 
655  // In DXF, arcs are drawn CCW.
656  // In Kicad, arcs are CW or CCW
657  // If StAngle > EndAngle, it is CW. So transform it to CCW
658  if( StAngle > EndAngle )
659  {
660  std::swap( StAngle, EndAngle );
661  }
662 
663  DPOINT centre_dev = userToDeviceCoordinates( centre );
664  double radius_dev = userToDeviceSize( radius );
665 
666  // Emit a DXF ARC entity
667  wxString cname = getDXFColorName( m_currentColor );
668  fprintf( outputFile,
669  "0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
670  TO_UTF8( cname ),
671  centre_dev.x, centre_dev.y, radius_dev,
672  StAngle / 10.0, EndAngle / 10.0 );
673 }
static wxString getDXFColorName(COLOR4D aColor)
COLOR4D m_currentColor
Definition: plotter.h:1569
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:125
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:94
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
#define TO_UTF8(wxstring)

References getDXFColorName(), m_currentColor, PLOTTER::outputFile, TO_UTF8, PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BezierCurve()

void PLOTTER::BezierCurve ( const wxPoint aStart,
const wxPoint aControl1,
const wxPoint aControl2,
const wxPoint aEnd,
int  aTolerance,
int  aLineThickness = USE_DEFAULT_LINE_WIDTH 
)
virtualinherited

Generic fallback: Cubic Bezier curve rendered as a polyline In Kicad the bezier curves have 4 control points: start ctrl1 ctrl2 end.

Reimplemented in SVG_PLOTTER.

Definition at line 204 of file plotter.cpp.

207 {
208  // Generic fallback: Quadratic Bezier curve plotted as a polyline
209  int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
210 
211  std::vector<wxPoint> ctrlPoints;
212  ctrlPoints.push_back( aStart );
213  ctrlPoints.push_back( aControl1 );
214  ctrlPoints.push_back( aControl2 );
215  ctrlPoints.push_back( aEnd );
216 
217  BEZIER_POLY bezier_converter( ctrlPoints );
218 
219  std::vector<wxPoint> approxPoints;
220  bezier_converter.GetPoly( approxPoints, minSegLen );
221 
222  SetCurrentLineWidth( aLineThickness );
223  MoveTo( aStart );
224 
225  for( unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
226  LineTo( approxPoints[ii] );
227 
228  FinishTo( aEnd );
229 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

References PLOTTER::FinishTo(), BEZIER_POLY::GetPoly(), PLOTTER::LineTo(), PLOTTER::MoveTo(), and PLOTTER::SetCurrentLineWidth().

Referenced by SVG_PLOTTER::BezierCurve(), BRDITEMS_PLOTTER::PlotDrawSegment(), and BRDITEMS_PLOTTER::PlotFootprintGraphicItem().

◆ Circle()

void DXF_PLOTTER::Circle ( const wxPoint centre,
int  diameter,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide as the radius.

I could use this trick to do other filled primitives

Implements PLOTTER.

Definition at line 443 of file DXF_plotter.cpp.

444 {
445  wxASSERT( outputFile );
446  double radius = userToDeviceSize( diameter / 2 );
447  DPOINT centre_dev = userToDeviceCoordinates( centre );
448  if( radius > 0 )
449  {
450  wxString cname = getDXFColorName( m_currentColor );
451 
452  if( !fill )
453  {
454  fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
455  TO_UTF8( cname ),
456  centre_dev.x, centre_dev.y, radius );
457  }
458 
459  if( fill == FILLED_SHAPE )
460  {
461  double r = radius*0.5;
462  fprintf( outputFile, "0\nPOLYLINE\n");
463  fprintf( outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ));
464  fprintf( outputFile, "40\n%g\n41\n%g\n", radius, radius);
465  fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
466  fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
467  centre_dev.x-r, centre_dev.y );
468  fprintf( outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ));
469  fprintf( outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
470  centre_dev.x+r, centre_dev.y );
471  fprintf( outputFile, "0\nSEQEND\n");
472  }
473  }
474 }
static wxString getDXFColorName(COLOR4D aColor)
COLOR4D m_currentColor
Definition: plotter.h:1569
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:125
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:94
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
#define TO_UTF8(wxstring)

References FILLED_SHAPE, getDXFColorName(), m_currentColor, PLOTTER::outputFile, TO_UTF8, PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadCircle().

◆ ClearHeaderLinesList()

void PLOTTER::ClearHeaderLinesList ( )
inlineinherited

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

Definition at line 188 of file plotter.h.

189  {
190  m_headerExtraLines.Clear();
191  }
wxArrayString m_headerExtraLines
Definition: plotter.h:601

References PLOTTER::m_headerExtraLines.

Referenced by StartPlotBoard().

◆ EndBlock()

virtual void PLOTTER::EndBlock ( void *  aData)
inlinevirtualinherited

calling this function allows one to define the end of a group of drawing items for instance in SVG or Gerber format.

the group is started by StartBlock()

Parameters
aDatacan define any parameter for most of plotters: do nothing

Reimplemented in GERBER_PLOTTER, and SVG_PLOTTER.

Definition at line 486 of file plotter.h.

486 {}

Referenced by SCH_COMPONENT::Plot(), BRDITEMS_PLOTTER::PlotFilledAreas(), and PlotStandardLayer().

◆ EndPlot()

bool DXF_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 392 of file DXF_plotter.cpp.

393 {
394  wxASSERT( outputFile );
395 
396  // DXF FOOTER
397  fputs( " 0\n"
398  "ENDSEC\n"
399  " 0\n"
400  "EOF\n", outputFile );
401  fclose( outputFile );
402  outputFile = NULL;
403 
404  return true;
405 }
#define NULL
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586

References NULL, and PLOTTER::outputFile.

Referenced by DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF().

◆ FinishTo()

◆ FlashPadCircle()

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

DXF round pad: always done in sketch mode; it could be filled but it isn't pretty if other kinds of pad aren't...

Implements PLOTTER.

Definition at line 700 of file DXF_plotter.cpp.

702 {
703  wxASSERT( outputFile );
704  Circle( pos, diametre, NO_FILL );
705 }
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide a...
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586

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

◆ FlashPadCustom()

void DXF_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 794 of file DXF_plotter.cpp.

797 {
798  for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
799  {
800  SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
801 
802  MoveTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
803 
804  for( int ii = 1; ii < poly.PointCount(); ++ii )
805  LineTo( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
806 
807  FinishTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
808  }
809 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
int OutlineCount() const
Returns the number of outlines in the set
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
SHAPE_LINE_CHAIN.

References SHAPE_LINE_CHAIN::CPoint(), PLOTTER::FinishTo(), PLOTTER::LineTo(), PLOTTER::MoveTo(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadOval()

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

DXF oval pad: always done in sketch mode.

Implements PLOTTER.

Definition at line 678 of file DXF_plotter.cpp.

680 {
681  wxASSERT( outputFile );
682  wxSize size( aSize );
683 
684  /* The chip is reduced to an oval tablet with size.y > size.x
685  * (Oval vertical orientation 0) */
686  if( size.x > size.y )
687  {
688  std::swap( size.x, size.y );
689  orient = AddAngles( orient, 900 );
690  }
691 
692  sketchOval( pos, size, orient, -1 );
693 }
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
Definition: trigo.h:304
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:459

References AddAngles(), PLOTTER::outputFile, and PLOTTER::sketchOval().

◆ FlashPadRect()

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

DXF rectangular pad: alwayd done in sketch mode.

Implements PLOTTER.

Definition at line 711 of file DXF_plotter.cpp.

713 {
714  wxASSERT( outputFile );
715  wxSize size;
716  int ox, oy, fx, fy;
717 
718  size.x = padsize.x / 2;
719  size.y = padsize.y / 2;
720 
721  if( size.x < 0 )
722  size.x = 0;
723  if( size.y < 0 )
724  size.y = 0;
725 
726  // If a dimension is zero, the trace is reduced to 1 line
727  if( size.x == 0 )
728  {
729  ox = pos.x;
730  oy = pos.y - size.y;
731  RotatePoint( &ox, &oy, pos.x, pos.y, orient );
732  fx = pos.x;
733  fy = pos.y + size.y;
734  RotatePoint( &fx, &fy, pos.x, pos.y, orient );
735  MoveTo( wxPoint( ox, oy ) );
736  FinishTo( wxPoint( fx, fy ) );
737  return;
738  }
739  if( size.y == 0 )
740  {
741  ox = pos.x - size.x;
742  oy = pos.y;
743  RotatePoint( &ox, &oy, pos.x, pos.y, orient );
744  fx = pos.x + size.x;
745  fy = pos.y;
746  RotatePoint( &fx, &fy, pos.x, pos.y, orient );
747  MoveTo( wxPoint( ox, oy ) );
748  FinishTo( wxPoint( fx, fy ) );
749  return;
750  }
751 
752  ox = pos.x - size.x;
753  oy = pos.y - size.y;
754  RotatePoint( &ox, &oy, pos.x, pos.y, orient );
755  MoveTo( wxPoint( ox, oy ) );
756 
757  fx = pos.x - size.x;
758  fy = pos.y + size.y;
759  RotatePoint( &fx, &fy, pos.x, pos.y, orient );
760  LineTo( wxPoint( fx, fy ) );
761 
762  fx = pos.x + size.x;
763  fy = pos.y + size.y;
764  RotatePoint( &fx, &fy, pos.x, pos.y, orient );
765  LineTo( wxPoint( fx, fy ) );
766 
767  fx = pos.x + size.x;
768  fy = pos.y - size.y;
769  RotatePoint( &fx, &fy, pos.x, pos.y, orient );
770  LineTo( wxPoint( fx, fy ) );
771 
772  FinishTo( wxPoint( ox, oy ) );
773 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586

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

◆ FlashPadRoundRect()

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

virtual function FlashPadRoundRect

Parameters
aPadPosPosition of the shape (center of the rectangle
aSize= size of rounded rect
aCornerRadiusRadius of the rounded corners
aOrientThe rotation of the shape
aTraceModeFILLED or SKETCH
aDataan auxiliary info (mainly for gerber format attributes)

Implements PLOTTER.

Definition at line 775 of file DXF_plotter.cpp.

778 {
779  SHAPE_POLY_SET outline;
780  TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient,
781  aCornerRadius, 0.0, 0, GetPlotterArcHighDef() );
782 
783  // TransformRoundRectToPolygon creates only one convex polygon
784  SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
785 
786  MoveTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
787 
788  for( int ii = 1; ii < poly.PointCount(); ++ii )
789  LineTo( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
790 
791  FinishTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
792 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
SHAPE_LINE_CHAIN.
int GetPlotterArcHighDef() const
Definition: plotter.h:223
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aError)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...

References SHAPE_LINE_CHAIN::CPoint(), PLOTTER::FinishTo(), PLOTTER::GetPlotterArcHighDef(), PLOTTER::LineTo(), PLOTTER::MoveTo(), SHAPE_POLY_SET::Outline(), SHAPE_LINE_CHAIN::PointCount(), TransformRoundChamferedRectToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadTrapez()

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

DXF trapezoidal pad: only sketch mode is supported.

Implements PLOTTER.

Definition at line 815 of file DXF_plotter.cpp.

817 {
818  wxASSERT( outputFile );
819  wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
820 
821  for( int ii = 0; ii < 4; ii++ )
822  {
823  coord[ii] = aCorners[ii];
824  RotatePoint( &coord[ii], aPadOrient );
825  coord[ii] += aPadPos;
826  }
827 
828  // Plot edge:
829  MoveTo( coord[0] );
830  LineTo( coord[1] );
831  LineTo( coord[2] );
832  LineTo( coord[3] );
833  FinishTo( coord[0] );
834 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586

References PLOTTER::FinishTo(), PLOTTER::LineTo(), PLOTTER::MoveTo(), PLOTTER::outputFile, and RotatePoint().

◆ FlashRegularPolygon()

void DXF_PLOTTER::FlashRegularPolygon ( const wxPoint aShapePos,
int  aDiameter,
int  aCornerCount,
double  aOrient,
EDA_DRAW_MODE_T  aTraceMode,
void *  aData 
)
overridevirtual

Flash a regular polygon.

Usefull only in Gerber files to flash a regular polygon

Parameters
aShapePosis the center of the circle containing the polygon
aRadiusis the radius of the circle containing the polygon
aCornerCountis the number of vertices
aOrientis the polygon rotation in degrees
aDatais a auxiliary parameter used (if needed) to handle extra info specific to the plotter

Implements PLOTTER.

Definition at line 837 of file DXF_plotter.cpp.

840 {
841  // Do nothing
842  wxASSERT( 0 );
843 }

◆ GetColorMode()

◆ GetCurrentLineWidth()

◆ GetDashGapLenIU()

double PLOTTER::GetDashGapLenIU ( ) const
protectedinherited

Definition at line 152 of file plotter.cpp.

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

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

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

◆ GetDashMarkLenIU()

double PLOTTER::GetDashMarkLenIU ( ) const
protectedinherited

Definition at line 146 of file plotter.cpp.

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

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

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

◆ GetDefaultFileExtension()

static wxString DXF_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 1450 of file plotter.h.

1451  {
1452  return wxString( wxT( "dxf" ) );
1453  }

Referenced by DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), and GetDefaultPlotExtension().

◆ GetDotMarkLenIU()

double PLOTTER::GetDotMarkLenIU ( ) const
protectedinherited

Definition at line 140 of file plotter.cpp.

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

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

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

◆ GetIUsPerDecimil()

double PLOTTER::GetIUsPerDecimil ( ) const
inlineinherited

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

Here they can be get back again

Definition at line 220 of file plotter.h.

220 { return m_IUsPerDecimil; }
double m_IUsPerDecimil
Definition: plotter.h:571

References PLOTTER::m_IUsPerDecimil.

Referenced by PlotWorkSheet().

◆ GetMeasurementDirective()

unsigned int DXF_PLOTTER::GetMeasurementDirective ( ) const
inline

Get the correct value for the $MEASUREMENT field given the current units.

Returns
the $MEASUREMENT directive field value

Definition at line 1562 of file plotter.h.

1563  {
1564  return m_measurementDirective;
1565  }
unsigned int m_measurementDirective
Definition: plotter.h:1574

References m_measurementDirective.

Referenced by StartPlot().

◆ GetPlotterArcHighDef()

int PLOTTER::GetPlotterArcHighDef ( ) const
inlineinherited

◆ GetPlotterArcLowDef()

int PLOTTER::GetPlotterArcLowDef ( ) const
inlineinherited

Definition at line 222 of file plotter.h.

222 { return m_IUsPerDecimil * 8; }
double m_IUsPerDecimil
Definition: plotter.h:571

References PLOTTER::m_IUsPerDecimil.

◆ GetPlotterType()

virtual PLOT_FORMAT DXF_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 1445 of file plotter.h.

1446  {
1447  return PLOT_FORMAT::DXF;
1448  }

References DXF.

◆ GetUnits()

DXF_UNITS DXF_PLOTTER::GetUnits ( ) const
inline

The units currently enabled for plotting.

Returns
The currently configured units

Definition at line 1541 of file plotter.h.

1542  {
1543  return m_plotUnits;
1544  }
DXF_UNITS m_plotUnits
Definition: plotter.h:1572

References m_plotUnits.

◆ GetUnitScaling()

double DXF_PLOTTER::GetUnitScaling ( ) const
inline

Get the scale factor to apply to convert the device units to be in the currently set units.

Returns
Scaling factor to apply for unit conversion

Definition at line 1552 of file plotter.h.

1553  {
1554  return m_unitScalingFactor;
1555  }
double m_unitScalingFactor
Definition: plotter.h:1573

References m_unitScalingFactor.

Referenced by SetViewport().

◆ LineTo()

void PLOTTER::LineTo ( const wxPoint pos)
inlineinherited

Definition at line 262 of file plotter.h.

263  {
264  PenTo( pos, 'D' );
265  }
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the 'pen' to the specified direction

References PLOTTER::PenTo().

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

◆ Marker()

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

Draw a pattern shape number aShapeId, to coord position.

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

Definition at line 332 of file plotter.cpp.

333 {
334  int radius = diametre / 2;
335  /* Marker are composed by a series of 'parts' superimposed; not every
336  combination make sense, obviously. Since they are used in order I
337  tried to keep the uglier/more complex constructions at the end.
338  Also I avoided the |/ |\ -/ -\ construction because they're *very*
339  ugly... if needed they could be added anyway... I'd like to see
340  a board with more than 58 drilling/slotting tools!
341  If Visual C++ supported the 0b literals they would be optimally
342  and easily encoded as an integer array. We have to do with octal */
343  static const unsigned char marker_patterns[MARKER_COUNT] = {
344  // Bit order: O Square Lozenge - | \ /
345  // First choice: simple shapes
346  0003, // X
347  0100, // O
348  0014, // +
349  0040, // Sq
350  0020, // Lz
351  // Two simple shapes
352  0103, // X O
353  0017, // X +
354  0043, // X Sq
355  0023, // X Lz
356  0114, // O +
357  0140, // O Sq
358  0120, // O Lz
359  0054, // + Sq
360  0034, // + Lz
361  0060, // Sq Lz
362  // Three simple shapes
363  0117, // X O +
364  0143, // X O Sq
365  0123, // X O Lz
366  0057, // X + Sq
367  0037, // X + Lz
368  0063, // X Sq Lz
369  0154, // O + Sq
370  0134, // O + Lz
371  0074, // + Sq Lz
372  // Four simple shapes
373  0174, // O Sq Lz +
374  0163, // X O Sq Lz
375  0157, // X O Sq +
376  0137, // X O Lz +
377  0077, // X Sq Lz +
378  // This draws *everything *
379  0177, // X O Sq Lz +
380  // Here we use the single bars... so the cross is forbidden
381  0110, // O -
382  0104, // O |
383  0101, // O /
384  0050, // Sq -
385  0044, // Sq |
386  0041, // Sq /
387  0030, // Lz -
388  0024, // Lz |
389  0021, // Lz /
390  0150, // O Sq -
391  0144, // O Sq |
392  0141, // O Sq /
393  0130, // O Lz -
394  0124, // O Lz |
395  0121, // O Lz /
396  0070, // Sq Lz -
397  0064, // Sq Lz |
398  0061, // Sq Lz /
399  0170, // O Sq Lz -
400  0164, // O Sq Lz |
401  0161, // O Sq Lz /
402  // Last resort: the backlash component (easy to confound)
403  0102, // \ O
404  0042, // \ Sq
405  0022, // \ Lz
406  0142, // \ O Sq
407  0122, // \ O Lz
408  0062, // \ Sq Lz
409  0162 // \ O Sq Lz
410  };
411  if( aShapeId >= MARKER_COUNT )
412  {
413  // Fallback shape
414  markerCircle( position, radius );
415  }
416  else
417  {
418  // Decode the pattern and draw the corresponding parts
419  unsigned char pat = marker_patterns[aShapeId];
420  if( pat & 0001 )
421  markerSlash( position, radius );
422  if( pat & 0002 )
423  markerBackSlash( position, radius );
424  if( pat & 0004 )
425  markerVBar( position, radius );
426  if( pat & 0010 )
427  markerHBar( position, radius );
428  if( pat & 0020 )
429  markerLozenge( position, radius );
430  if( pat & 0040 )
431  markerSquare( position, radius );
432  if( pat & 0100 )
433  markerCircle( position, radius );
434  }
435 }
void markerHBar(const wxPoint &pos, int radius)
Plot a - bar centered on the position.
Definition: plotter.cpp:304
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:428
void markerSlash(const wxPoint &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:311
void markerLozenge(const wxPoint &position, int radius)
Plot a lozenge centered on the position.
Definition: plotter.cpp:280
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:274
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:325
void markerSquare(const wxPoint &position, int radius)
Plot a square centered on the position.
Definition: plotter.cpp:249
void markerBackSlash(const wxPoint &pos, int radius)
Plot a \ bar centered on the position.
Definition: plotter.cpp:318

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().

◆ markerBackSlash()

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

Plot a \ bar centered on the position.

Building block for markers

Definition at line 318 of file plotter.cpp.

319 {
320  MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
321  FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
322 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257

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

Referenced by PLOTTER::Marker().

◆ markerCircle()

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

Plot a circle centered on the position.

Building block for markers

Definition at line 274 of file plotter.cpp.

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

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

Referenced by PLOTTER::Marker().

◆ markerHBar()

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

Plot a - bar centered on the position.

Building block for markers

Definition at line 304 of file plotter.cpp.

305 {
306  MoveTo( wxPoint( pos.x - radius, pos.y ) );
307  FinishTo( wxPoint( pos.x + radius, pos.y ) );
308 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257

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

Referenced by PLOTTER::Marker().

◆ markerLozenge()

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

Plot a lozenge centered on the position.

Building block for markers

Definition at line 280 of file plotter.cpp.

281 {
282  std::vector< wxPoint > corner_list;
283  wxPoint corner;
284  corner.x = position.x;
285  corner.y = position.y + radius;
286  corner_list.push_back( corner );
287  corner.x = position.x + radius;
288  corner.y = position.y,
289  corner_list.push_back( corner );
290  corner.x = position.x;
291  corner.y = position.y - radius;
292  corner_list.push_back( corner );
293  corner.x = position.x - radius;
294  corner.y = position.y;
295  corner_list.push_back( corner );
296  corner.x = position.x;
297  corner.y = position.y + radius;
298  corner_list.push_back( corner );
299 
300  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
301 }
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:158

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

Referenced by PLOTTER::Marker().

◆ markerSlash()

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

Plot a / bar centered on the position.

Building block for markers

Definition at line 311 of file plotter.cpp.

312 {
313  MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
314  FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
315 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257

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

Referenced by PLOTTER::Marker().

◆ markerSquare()

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

Plot a square centered on the position.

Building block for markers

Definition at line 249 of file plotter.cpp.

250 {
251  double r = KiROUND( radius / 1.4142 );
252  std::vector< wxPoint > corner_list;
253  wxPoint corner;
254  corner.x = position.x + r;
255  corner.y = position.y + r;
256  corner_list.push_back( corner );
257  corner.x = position.x + r;
258  corner.y = position.y - r;
259  corner_list.push_back( corner );
260  corner.x = position.x - r;
261  corner.y = position.y - r;
262  corner_list.push_back( corner );
263  corner.x = position.x - r;
264  corner.y = position.y + r;
265  corner_list.push_back( corner );
266  corner.x = position.x + r;
267  corner.y = position.y + r;
268  corner_list.push_back( corner );
269 
270  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
271 }
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:158
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

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

Referenced by PLOTTER::Marker().

◆ markerVBar()

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

Plot a | bar centered on the position.

Building block for markers

Definition at line 325 of file plotter.cpp.

326 {
327  MoveTo( wxPoint( pos.x, pos.y - radius ) );
328  FinishTo( wxPoint( pos.x, pos.y + radius ) );
329 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257

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

Referenced by PLOTTER::Marker().

◆ MoveTo()

◆ OpenFile()

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

Open or create the plot file aFullFilename.

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

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

Reimplemented in PDF_PLOTTER.

Definition at line 77 of file plotter.cpp.

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

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

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

◆ PageSettings()

PAGE_INFO& PLOTTER::PageSettings ( )
inlineinherited

◆ PenFinish()

void PLOTTER::PenFinish ( )
inlineinherited

Definition at line 273 of file plotter.h.

274  {
275  // The point is not important with Z motion
276  PenTo( wxPoint( 0, 0 ), 'Z' );
277  }
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the 'pen' to the specified direction

References PLOTTER::PenTo().

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

◆ PenTo()

void DXF_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 585 of file DXF_plotter.cpp.

586 {
587  wxASSERT( outputFile );
588  if( plume == 'Z' )
589  {
590  return;
591  }
592  DPOINT pos_dev = userToDeviceCoordinates( pos );
593  DPOINT pen_lastpos_dev = userToDeviceCoordinates( penLastpos );
594 
595  if( penLastpos != pos && plume == 'D' )
596  {
599  // DXF LINE
600  wxString cname = getDXFColorName( m_currentColor );
601  const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
602  fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
603  TO_UTF8( cname ), lname,
604  pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
605  }
606  penLastpos = pos;
607 }
static wxString getDXFColorName(COLOR4D aColor)
COLOR4D m_currentColor
Definition: plotter.h:1569
wxPoint penLastpos
Definition: plotter.h:593
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:94
static const char * getDXFLineType(PLOT_DASH_TYPE aType)
Definition: DXF_plotter.cpp:97
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1570
#define TO_UTF8(wxstring)

References FIRST_TYPE, getDXFColorName(), getDXFLineType(), LAST_TYPE, m_currentColor, m_currentLineType, PLOTTER::outputFile, PLOTTER::penLastpos, TO_UTF8, PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ PlotImage()

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

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

Draw an image bitmap

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

Reimplemented in SVG_PLOTTER, PDF_PLOTTER, and PS_PLOTTER.

Definition at line 232 of file plotter.cpp.

233 {
234  wxSize size( aImage.GetWidth() * aScaleFactor,
235  aImage.GetHeight() * aScaleFactor );
236 
237  wxPoint start = aPos;
238  start.x -= size.x / 2;
239  start.y -= size.y / 2;
240 
241  wxPoint end = start;
242  end.x += size.x;
243  end.y += size.y;
244 
245  Rect( start, end, NO_FILL );
246 }
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

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

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

◆ PlotPoly() [1/2]

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

Function PlotPoly.

Draw a polygon ( filled or not )

Parameters
aCornerList= corners list (a SHAPE_LINE_CHAIN). must be closed (IsClosed() == true) for a polygon. Otherwise this is a polyline
aFill= type of fill
aWidth= line width
aDataan auxiliary info (mainly for gerber format)

Definition at line 583 of file plotter.cpp.

585 {
586  std::vector<wxPoint> cornerList;
587  cornerList.reserve( aCornerList.PointCount() );
588 
589  for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
590  cornerList.emplace_back( aCornerList.CPoint( ii ) );
591 
592  if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
593  cornerList.emplace_back( aCornerList.CPoint( 0 ) );
594 
595  PlotPoly( cornerList, aFill, aWidth, aData );
596 }
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
bool IsClosed() const
Function IsClosed()

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

◆ PlotPoly() [2/2]

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

DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.

It does not know thhick segments, therefore filled polygons with thick outline are converted to inflated polygon by aWidth/2

Implements PLOTTER.

Definition at line 483 of file DXF_plotter.cpp.

485 {
486  if( aCornerList.size() <= 1 )
487  return;
488 
489  unsigned last = aCornerList.size() - 1;
490 
491  // Plot outlines with lines (thickness = 0) to define the polygon
492  if( aWidth <= 0 )
493  {
494  MoveTo( aCornerList[0] );
495 
496  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
497  LineTo( aCornerList[ii] );
498 
499  // Close polygon if 'fill' requested
500  if( aFill )
501  {
502  if( aCornerList[last] != aCornerList[0] )
503  LineTo( aCornerList[0] );
504  }
505 
506  PenFinish();
507 
508  return;
509  }
510 
511 
512  // if the polygon outline has thickness, and is not filled
513  // (i.e. is a polyline) plot outlines with thick segments
514  if( aWidth > 0 && !aFill )
515  {
516  MoveTo( aCornerList[0] );
517 
518  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
519  ThickSegment( aCornerList[ii-1], aCornerList[ii],
520  aWidth, FILLED, NULL );
521 
522  return;
523  }
524 
525  // The polygon outline has thickness, and is filled
526  // Build and plot the polygon which contains the initial
527  // polygon and its thick outline
528  SHAPE_POLY_SET bufferOutline;
529  SHAPE_POLY_SET bufferPolybase;
530 
531  bufferPolybase.NewOutline();
532 
533  // enter outline as polygon:
534  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
535  {
536  TransformSegmentToPolygon( bufferOutline,
537  aCornerList[ ii - 1 ], aCornerList[ ii ], GetPlotterArcHighDef(), aWidth );
538  }
539 
540  // enter the initial polygon:
541  for( unsigned ii = 0; ii < aCornerList.size(); ii++ )
542  {
543  bufferPolybase.Append( aCornerList[ii] );
544  }
545 
546  // Merge polygons to build the polygon which contains the initial
547  // polygon and its thick outline
548 
549  // create the outline which contains thick outline:
550  bufferPolybase.BooleanAdd( bufferOutline, SHAPE_POLY_SET::PM_FAST );
551  bufferPolybase.Fracture( SHAPE_POLY_SET::PM_FAST );
552 
553  if( bufferPolybase.OutlineCount() < 1 ) // should not happen
554  return;
555 
556  const SHAPE_LINE_CHAIN& path = bufferPolybase.COutline( 0 );
557 
558  if( path.PointCount() < 2 ) // should not happen
559  return;
560 
561  // Now, output the final polygon to DXF file:
562  last = path.PointCount() - 1;
563  VECTOR2I point = path.CPoint( 0 );
564 
565  wxPoint startPoint( point.x, point.y );
566  MoveTo( startPoint );
567 
568  for( int ii = 1; ii < path.PointCount(); ii++ )
569  {
570  point = path.CPoint( ii );
571  LineTo( wxPoint( point.x, point.y ) );
572  }
573 
574  // Close polygon, if needed
575  point = path.CPoint( last );
576  wxPoint endPoint( point.x, point.y );
577 
578  if( endPoint != startPoint )
579  LineTo( startPoint );
580 
581  PenFinish();
582 }
void PenFinish()
Definition: plotter.h:273
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
int PointCount() const
Function PointCount()
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
#define NULL
SHAPE_POLY_SET.
int NewOutline()
Creates a new empty polygon in the set and returns its index
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetPlotterArcHighDef() const
Definition: plotter.h:223
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), FILLED, SHAPE_POLY_SET::Fracture(), PLOTTER::GetPlotterArcHighDef(), PLOTTER::LineTo(), PLOTTER::MoveTo(), SHAPE_POLY_SET::NewOutline(), NULL, SHAPE_POLY_SET::OutlineCount(), PLOTTER::PenFinish(), SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::PointCount(), ThickSegment(), TransformSegmentToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ThickSegment().

◆ Rect()

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

DXF rectangle: fill not supported.

Implements PLOTTER.

Definition at line 426 of file DXF_plotter.cpp.

427 {
428  wxASSERT( outputFile );
429  MoveTo( p1 );
430  LineTo( wxPoint( p1.x, p2.y ) );
431  LineTo( wxPoint( p2.x, p2.y ) );
432  LineTo( wxPoint( p2.x, p1.y ) );
433  FinishTo( wxPoint( p1.x, p1.y ) );
434 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586

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

◆ RenderSettings()

◆ segmentAsOval()

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

Cdonvert a thick segment and plot it as an oval.

Definition at line 438 of file plotter.cpp.

440 {
441  wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
442  wxSize size( end.x - start.x, end.y - start.y );
443  double orient;
444 
445  if( size.y == 0 )
446  orient = 0;
447  else if( size.x == 0 )
448  orient = 900;
449  else
450  orient = -ArcTangente( size.y, size.x );
451 
452  size.x = KiROUND( EuclideanNorm( size ) ) + width;
453  size.y = width;
454 
455  FlashPadOval( center, size, orient, tracemode, NULL );
456 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
#define NULL
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadOval
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162

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

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

◆ SetColor()

void DXF_PLOTTER::SetColor ( COLOR4D  color)
overridevirtual

The DXF exporter handles 'colors' as layers...

Implements PLOTTER.

Definition at line 411 of file DXF_plotter.cpp.

412 {
413  if( ( colorMode )
414  || ( color == COLOR4D::BLACK )
415  || ( color == COLOR4D::WHITE ) )
416  {
418  }
419  else
421 }
int color
Definition: DXF_plotter.cpp:61
bool colorMode
Definition: plotter.h:589
Definition: color4d.h:44
COLOR4D m_currentColor
Definition: plotter.h:1569
Definition: color4d.h:48

References BLACK, color, PLOTTER::colorMode, m_currentColor, and WHITE.

Referenced by Text().

◆ SetColorMode()

virtual void PLOTTER::SetColorMode ( bool  aColorMode)
inlinevirtualinherited

◆ SetCreator()

◆ SetCurrentLineWidth()

virtual void DXF_PLOTTER::SetCurrentLineWidth ( int  width,
void *  aData = NULL 
)
inlineoverridevirtual

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

1469  {
1470  currentPenWidth = 0;
1471  }
int currentPenWidth
Definition: plotter.h:591

References PLOTTER::currentPenWidth.

◆ SetDash()

void DXF_PLOTTER::SetDash ( PLOT_DASH_TYPE  dashed)
overridevirtual

Implements PLOTTER.

Definition at line 610 of file DXF_plotter.cpp.

611 {
612  wxASSERT( aDashed >= PLOT_DASH_TYPE::FIRST_TYPE && aDashed <= PLOT_DASH_TYPE::LAST_TYPE );
613  m_currentLineType = aDashed;
614 }
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1570

References FIRST_TYPE, LAST_TYPE, and m_currentLineType.

◆ SetGerberCoordinatesFormat()

virtual void PLOTTER::SetGerberCoordinatesFormat ( int  aResolution,
bool  aUseInches = false 
)
inlinevirtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 460 of file plotter.h.

461  {
462  // NOP for most plotters. Only for Gerber plotter
463  }

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

◆ SetLayerPolarity()

virtual void PLOTTER::SetLayerPolarity ( bool  aPositive)
inlinevirtualinherited

Function SetLayerPolarity sets current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerber file, respectively.

(obviously starts a new Gerber layer, too)

Parameters
aPositiveis the layer polarity and true for positive. It's not useful with most other plotter since they can't 'scratch' the film like photoplotter imagers do

Reimplemented in GERBER_PLOTTER.

Definition at line 446 of file plotter.h.

447  {
448  // NOP for most plotters
449  }

Referenced by PlotOneBoardLayer().

◆ SetNegative()

virtual void PLOTTER::SetNegative ( bool  aNegative)
inlinevirtualinherited

Definition at line 135 of file plotter.h.

136  {
137  negativeMode = aNegative;
138  }
bool negativeMode
Definition: plotter.h:590

References PLOTTER::negativeMode.

Referenced by FillNegativeKnockout().

◆ SetPageSettings()

◆ SetRenderSettings()

◆ SetSvgCoordinatesFormat()

virtual void PLOTTER::SetSvgCoordinatesFormat ( unsigned  aResolution,
bool  aUseInches = false 
)
inlinevirtualinherited

Reimplemented in SVG_PLOTTER.

Definition at line 465 of file plotter.h.

466  {
467  // NOP for most plotters. Only for SVG plotter
468  }

Referenced by initializePlotter().

◆ SetTextMode()

virtual void DXF_PLOTTER::SetTextMode ( PLOT_TEXT_MODE  mode)
inlineoverridevirtual

DXF handles NATIVE text emitting TEXT entities.

Reimplemented from PLOTTER.

Definition at line 1458 of file plotter.h.

1459  {
1460  if( mode != PLOT_TEXT_MODE::DEFAULT )
1461  m_textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
1462  }
bool m_textAsLines
Definition: plotter.h:1568

References DEFAULT, m_textAsLines, and NATIVE.

◆ SetTitle()

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

Definition at line 169 of file plotter.h.

170  {
171  title = aTitle;
172  }
wxString title
Definition: plotter.h:597

References PLOTTER::title.

Referenced by DIALOG_PLOT_SCHEMATIC::createPDFFile().

◆ SetUnits()

void DXF_PLOTTER::SetUnits ( DXF_UNITS  aUnit)

Set the units to use for plotting the DXF file.

Parameters
aUnit- The units to use

Definition at line 129 of file DXF_plotter.cpp.

130 {
131  m_plotUnits = aUnit;
132 
133  switch( aUnit )
134  {
136  m_unitScalingFactor = 0.00254;
138  break;
139 
140  case DXF_UNITS::INCHES:
141  default:
142  m_unitScalingFactor = 0.0001;
144  }
145 }
double m_unitScalingFactor
Definition: plotter.h:1573
unsigned int m_measurementDirective
Definition: plotter.h:1574
DXF_UNITS m_plotUnits
Definition: plotter.h:1572

References INCHES, m_measurementDirective, m_plotUnits, m_unitScalingFactor, and MILLIMETERS.

Referenced by DXF_PLOTTER(), GENDRILL_WRITER_BASE::genDrillMapFile(), and StartPlotBoard().

◆ SetViewport()

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

Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring.

The output coordinate system is in the first quadrant (in mm)

Implements PLOTTER.

Definition at line 153 of file DXF_plotter.cpp.

155 {
156  plotOffset = aOffset;
157  plotScale = aScale;
158 
159  /* DXF paper is 'virtual' so there is no need of a paper size.
160  Also this way we can handle the aux origin which can be useful
161  (for example when aligning to a mechanical drawing) */
162  paperSize.x = 0;
163  paperSize.y = 0;
164 
165  /* Like paper size DXF units are abstract too. Anyway there is a
166  * system variable (MEASUREMENT) which will be set to 0 to indicate
167  * english units */
168  m_IUsPerDecimil = aIusPerDecimil;
169  iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
170  iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
171 
172  m_plotMirror = false; // No mirroring on DXF
174 }
Definition: color4d.h:44
COLOR4D m_currentColor
Definition: plotter.h:1569
double m_IUsPerDecimil
Definition: plotter.h:571
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:577
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
Definition: plotter.h:1552
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:581
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:565
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:574
wxSize paperSize
Definition: plotter.h:599

References BLACK, GetUnitScaling(), PLOTTER::iuPerDeviceUnit, m_currentColor, PLOTTER::m_IUsPerDecimil, PLOTTER::m_plotMirror, PLOTTER::paperSize, PLOTTER::plotOffset, and PLOTTER::plotScale.

Referenced by DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF().

◆ sketchOval()

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

Definition at line 459 of file plotter.cpp.

460 {
461  SetCurrentLineWidth( width );
462  width = currentPenWidth;
463  int radius, deltaxy, cx, cy;
464  wxSize size( aSize );
465 
466  if( size.x > size.y )
467  {
468  std::swap( size.x, size.y );
469  orient = AddAngles( orient, 900 );
470  }
471 
472  deltaxy = size.y - size.x; /* distance between centers of the oval */
473  radius = ( size.x - width ) / 2;
474  cx = -radius;
475  cy = -deltaxy / 2;
476  RotatePoint( &cx, &cy, orient );
477  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
478  cx = -radius;
479  cy = deltaxy / 2;
480  RotatePoint( &cx, &cy, orient );
481  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
482 
483  cx = radius;
484  cy = -deltaxy / 2;
485  RotatePoint( &cx, &cy, orient );
486  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
487  cx = radius;
488  cy = deltaxy / 2;
489  RotatePoint( &cx, &cy, orient );
490  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
491 
492  cx = 0;
493  cy = deltaxy / 2;
494  RotatePoint( &cx, &cy, orient );
495  Arc( wxPoint( cx + pos.x, cy + pos.y ),
496  orient + 1800, orient + 3600,
497  radius, NO_FILL );
498  cx = 0;
499  cy = -deltaxy / 2;
500  RotatePoint( &cx, &cy, orient );
501  Arc( wxPoint( cx + pos.x, cy + pos.y ),
502  orient, orient + 1800,
503  radius, NO_FILL );
504 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
Definition: trigo.h:304
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
int currentPenWidth
Definition: plotter.h:591
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:158
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

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

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

◆ StartBlock()

virtual void PLOTTER::StartBlock ( void *  aData)
inlinevirtualinherited

calling this function allows one to define the beginning of a group of drawing items, for instance in SVG or Gerber format.

(example: group all segments of a letter or a text)

Parameters
aDatacan define any parameter for most of plotters: do nothing

Reimplemented in GERBER_PLOTTER, and SVG_PLOTTER.

Definition at line 477 of file plotter.h.

477 {}

Referenced by SCH_COMPONENT::Plot(), BRDITEMS_PLOTTER::PlotFilledAreas(), and PlotStandardLayer().

◆ StartPlot()

bool DXF_PLOTTER::StartPlot ( )
overridevirtual

Opens the DXF plot with a skeleton header.

Implements PLOTTER.

Definition at line 179 of file DXF_plotter.cpp.

180 {
181  wxASSERT( outputFile );
182 
183  // DXF HEADER - Boilerplate
184  // Defines the minimum for drawing i.e. the angle system and the
185  // 4 linetypes (CONTINUOUS, DOTDASH, DASHED and DOTTED)
186  fprintf( outputFile,
187  " 0\n"
188  "SECTION\n"
189  " 2\n"
190  "HEADER\n"
191  " 9\n"
192  "$ANGBASE\n"
193  " 50\n"
194  "0.0\n"
195  " 9\n"
196  "$ANGDIR\n"
197  " 70\n"
198  "1\n"
199  " 9\n"
200  "$MEASUREMENT\n"
201  " 70\n"
202  "%u\n"
203  " 0\n"
204  "ENDSEC\n"
205  " 0\n"
206  "SECTION\n"
207  " 2\n"
208  "TABLES\n"
209  " 0\n"
210  "TABLE\n"
211  " 2\n"
212  "LTYPE\n"
213  " 70\n"
214  "4\n"
215  " 0\n"
216  "LTYPE\n"
217  " 5\n"
218  "40F\n"
219  " 2\n"
220  "CONTINUOUS\n"
221  " 70\n"
222  "0\n"
223  " 3\n"
224  "Solid line\n"
225  " 72\n"
226  "65\n"
227  " 73\n"
228  "0\n"
229  " 40\n"
230  "0.0\n"
231  " 0\n"
232  "LTYPE\n"
233  " 5\n"
234  "410\n"
235  " 2\n"
236  "DASHDOT\n"
237  " 70\n"
238  "0\n"
239  " 3\n"
240  "Dash Dot ____ _ ____ _\n"
241  " 72\n"
242  "65\n"
243  " 73\n"
244  "4\n"
245  " 40\n"
246  "2.0\n"
247  " 49\n"
248  "1.25\n"
249  " 49\n"
250  "-0.25\n"
251  " 49\n"
252  "0.25\n"
253  " 49\n"
254  "-0.25\n"
255  " 0\n"
256  "LTYPE\n"
257  " 5\n"
258  "411\n"
259  " 2\n"
260  "DASHED\n"
261  " 70\n"
262  "0\n"
263  " 3\n"
264  "Dashed __ __ __ __ __\n"
265  " 72\n"
266  "65\n"
267  " 73\n"
268  "2\n"
269  " 40\n"
270  "0.75\n"
271  " 49\n"
272  "0.5\n"
273  " 49\n"
274  "-0.25\n"
275  " 0\n"
276  "LTYPE\n"
277  " 5\n"
278  "43B\n"
279  " 2\n"
280  "DOTTED\n"
281  " 70\n"
282  "0\n"
283  " 3\n"
284  "Dotted . . . .\n"
285  " 72\n"
286  "65\n"
287  " 73\n"
288  "2\n"
289  " 40\n"
290  "0.2\n"
291  " 49\n"
292  "0.0\n"
293  " 49\n"
294  "-0.2\n"
295  " 0\n"
296  "ENDTAB\n",
298 
299  // Text styles table
300  // Defines 4 text styles, one for each bold/italic combination
301  fputs( " 0\n"
302  "TABLE\n"
303  " 2\n"
304  "STYLE\n"
305  " 70\n"
306  "4\n", outputFile );
307 
308  static const char *style_name[4] = {"KICAD", "KICADB", "KICADI", "KICADBI"};
309  for(int i = 0; i < 4; i++ )
310  {
311  fprintf( outputFile,
312  " 0\n"
313  "STYLE\n"
314  " 2\n"
315  "%s\n" // Style name
316  " 70\n"
317  "0\n" // Standard flags
318  " 40\n"
319  "0\n" // Non-fixed height text
320  " 41\n"
321  "1\n" // Width factor (base)
322  " 42\n"
323  "1\n" // Last height (mandatory)
324  " 50\n"
325  "%g\n" // Oblique angle
326  " 71\n"
327  "0\n" // Generation flags (default)
328  " 3\n"
329  // The standard ISO font (when kicad is build with it
330  // the dxf text in acad matches *perfectly*)
331  "isocp.shx\n", // Font name (when not bigfont)
332  // Apply a 15 degree angle to italic text
333  style_name[i], i < 2 ? 0 : DXF_OBLIQUE_ANGLE );
334  }
335 
336  EDA_COLOR_T numLayers = NBCOLORS;
337 
338  // If printing in monochrome, only output the black layer
339  if( !GetColorMode() )
340  numLayers = static_cast<EDA_COLOR_T>( 1 );
341 
342  // Layer table - one layer per color
343  fprintf( outputFile,
344  " 0\n"
345  "ENDTAB\n"
346  " 0\n"
347  "TABLE\n"
348  " 2\n"
349  "LAYER\n"
350  " 70\n"
351  "%d\n", numLayers );
352 
353  /* The layer/colors palette. The acad/DXF palette is divided in 3 zones:
354 
355  - The primary colors (1 - 9)
356  - An HSV zone (10-250, 5 values x 2 saturations x 10 hues
357  - Greys (251 - 255)
358  */
359 
360  wxASSERT( numLayers < NBCOLORS );
361 
362  for( EDA_COLOR_T i = BLACK; i < numLayers; i = static_cast<EDA_COLOR_T>( int( i ) + 1 ) )
363  {
364  fprintf( outputFile,
365  " 0\n"
366  "LAYER\n"
367  " 2\n"
368  "%s\n" // Layer name
369  " 70\n"
370  "0\n" // Standard flags
371  " 62\n"
372  "%d\n" // Color number
373  " 6\n"
374  "CONTINUOUS\n",// Linetype name
375  dxf_layer[i].name, dxf_layer[i].color );
376  }
377 
378  // End of layer table, begin entities
379  fputs( " 0\n"
380  "ENDTAB\n"
381  " 0\n"
382  "ENDSEC\n"
383  " 0\n"
384  "SECTION\n"
385  " 2\n"
386  "ENTITIES\n", outputFile );
387 
388  return true;
389 }
int color
Definition: DXF_plotter.cpp:61
static const struct @11 dxf_layer[NBCOLORS]
Definition: color4d.h:44
Number of colors.
Definition: color4d.h:74
static const double DXF_OBLIQUE_ANGLE
Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value....
Definition: DXF_plotter.cpp:42
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:41
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
Definition: plotter.h:1562
const char * name
Definition: DXF_plotter.cpp:60
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
bool GetColorMode() const
Definition: plotter.h:144

References BLACK, color, dxf_layer, DXF_OBLIQUE_ANGLE, PLOTTER::GetColorMode(), GetMeasurementDirective(), name, NBCOLORS, and PLOTTER::outputFile.

Referenced by DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF().

◆ Text()

void DXF_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  aPenWidth,
bool  aItalic,
bool  aBold,
bool  aMultilineAllowed = false,
void *  aData = NULL 
)
overridevirtual

Draws text with the plotter.

Function PLOTTER::Text same as GRText, 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)
aPenWidth= line width (if = 0, use plot default line width)
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 865 of file DXF_plotter.cpp.

877 {
878  // Fix me: see how to use DXF text mode for multiline texts
879  if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
880  aMultilineAllowed = false; // the text has only one line.
881 
882  bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) );
883 
884  if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
885  {
886  // output text as graphics.
887  // Perhaps multiline texts could be handled as DXF text entity
888  // but I do not want spend time about this (JPC)
889  PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
890  aWidth, aItalic, aBold, aMultilineAllowed );
891  }
892  else
893  {
894  /* Emit text as a text entity. This loses formatting and shape but it's
895  more useful as a CAD object */
896  DPOINT origin_dev = userToDeviceCoordinates( aPos );
897  SetColor( aColor );
898  wxString cname = getDXFColorName( m_currentColor );
899  DPOINT size_dev = userToDeviceSize( aSize );
900  int h_code = 0, v_code = 0;
901  switch( aH_justify )
902  {
904  h_code = 0;
905  break;
907  h_code = 1;
908  break;
910  h_code = 2;
911  break;
912  }
913  switch( aV_justify )
914  {
916  v_code = 3;
917  break;
919  v_code = 2;
920  break;
922  v_code = 1;
923  break;
924  }
925 
926  // Position, size, rotation and alignment
927  // The two alignment point usages is somewhat idiot (see the DXF ref)
928  // Anyway since we don't use the fit/aligned options, they're the same
929  fprintf( outputFile,
930  " 0\n"
931  "TEXT\n"
932  " 7\n"
933  "%s\n" // Text style
934  " 8\n"
935  "%s\n" // Layer name
936  " 10\n"
937  "%g\n" // First point X
938  " 11\n"
939  "%g\n" // Second point X
940  " 20\n"
941  "%g\n" // First point Y
942  " 21\n"
943  "%g\n" // Second point Y
944  " 40\n"
945  "%g\n" // Text height
946  " 41\n"
947  "%g\n" // Width factor
948  " 50\n"
949  "%g\n" // Rotation
950  " 51\n"
951  "%g\n" // Oblique angle
952  " 71\n"
953  "%d\n" // Mirror flags
954  " 72\n"
955  "%d\n" // H alignment
956  " 73\n"
957  "%d\n", // V alignment
958  aBold ? (aItalic ? "KICADBI" : "KICADB")
959  : (aItalic ? "KICADI" : "KICAD"),
960  TO_UTF8( cname ),
961  origin_dev.x, origin_dev.x,
962  origin_dev.y, origin_dev.y,
963  size_dev.y, fabs( size_dev.x / size_dev.y ),
964  aOrient / 10.0,
965  aItalic ? DXF_OBLIQUE_ANGLE : 0,
966  size_dev.x < 0 ? 2 : 0, // X mirror flag
967  h_code, v_code );
968 
969  /* There are two issue in emitting the text:
970  - Our overline character (~) must be converted to the appropriate
971  control sequence %%O or %%o
972  - Text encoding in DXF is more or less unspecified since depends on
973  the DXF declared version, the acad version reading it *and* some
974  system variables to be put in the header handled only by newer acads
975  Also before R15 unicode simply is not supported (you need to use
976  bigfonts which are a massive PITA). Common denominator solution:
977  use Latin1 (and however someone could choke on it, anyway). Sorry
978  for the extended latin people. If somewant want to try fixing this
979  recent version seems to use UTF-8 (and not UCS2 like the rest of
980  Windows)
981 
982  XXX Actually there is a *third* issue: older DXF formats are limited
983  to 255 bytes records (it was later raised to 2048); since I'm lazy
984  and text so long is not probable I just don't implement this rule.
985  If someone is interested in fixing this, you have to emit the first
986  partial lines with group code 3 (max 250 bytes each) and then finish
987  with a group code 1 (less than 250 bytes). The DXF refs explains it
988  in no more details...
989  */
990 
991  bool overlining = false;
992 
993  fputs( " 1\n", outputFile );
994 
995  for( unsigned i = 0; i < aText.length(); i++ )
996  {
997  /* Here I do a bad thing: writing the output one byte at a time!
998  but today I'm lazy and I have no idea on how to coerce a Unicode
999  wxString to spit out latin1 encoded text ...
1000 
1001  Atleast stdio is *supposed* to do output buffering, so there is
1002  hope is not too slow */
1003  wchar_t ch = aText[i];
1004 
1005  if( ch > 255 )
1006  {
1007  // I can't encode this...
1008  putc( '?', outputFile );
1009  }
1010  else
1011  {
1012  if( ch == '~' )
1013  {
1014  if( ++i == aText.length() )
1015  break;
1016 
1017  ch = aText[i];
1018 
1019  if( ch == '~' )
1020  {
1021  // double ~ is really a ~ so go ahead and process the second one
1022 
1023  // so what's a triple ~? It could be a real ~ followed by an overbar,
1024  // or it could be an overbar followed by a real ~. The old algorithm
1025  // did the former so we will too....
1026  }
1027  else
1028  {
1029  // Handle the overline toggle
1030  fputs( overlining ? "%%o" : "%%O", outputFile );
1031  overlining = !overlining;
1032  }
1033  }
1034 
1035  putc( ch, outputFile );
1036  }
1037  }
1038  putc( '\n', outputFile );
1039  }
1040 }
bool containsNonAsciiChars(const wxString &string)
Checks if a given string contains non-ASCII characters.
static wxString getDXFColorName(COLOR4D aColor)
bool m_textAsLines
Definition: plotter.h:1568
COLOR4D m_currentColor
Definition: plotter.h:1569
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.
Definition: gr_text.cpp:222
static const double DXF_OBLIQUE_ANGLE
Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value....
Definition: DXF_plotter.cpp:42
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:125
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:94
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
#define TO_UTF8(wxstring)
virtual void SetColor(COLOR4D color) override
The DXF exporter handles 'colors' as layers...

References containsNonAsciiChars(), DXF_OBLIQUE_ANGLE, getDXFColorName(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, m_currentColor, m_textAsLines, PLOTTER::outputFile, SetColor(), PLOTTER::Text(), TO_UTF8, PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ThickArc()

void PLOTTER::ThickArc ( const wxPoint centre,
double  StAngle,
double  EndAngle,
int  rayon,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 531 of file plotter.cpp.

533 {
534  if( tracemode == FILLED )
535  Arc( centre, StAngle, EndAngle, radius, NO_FILL, width );
536  else
537  {
538  SetCurrentLineWidth( -1 );
539  Arc( centre, StAngle, EndAngle,
540  radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 );
541  Arc( centre, StAngle, EndAngle,
542  radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 );
543  }
544 }
int currentPenWidth
Definition: plotter.h:591
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:158
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

References PLOTTER::Arc(), PLOTTER::currentPenWidth, FILLED, NO_FILL, and PLOTTER::SetCurrentLineWidth().

Referenced by BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), and PlotStandardLayer().

◆ ThickCircle()

void PLOTTER::ThickCircle ( const wxPoint pos,
int  diametre,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 569 of file plotter.cpp.

571 {
572  if( tracemode == FILLED )
573  Circle( pos, diametre, NO_FILL, width );
574  else
575  {
576  SetCurrentLineWidth( -1 );
577  Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 );
578  Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 );
579  }
580 }
int currentPenWidth
Definition: plotter.h:591
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

References PLOTTER::Circle(), PLOTTER::currentPenWidth, FILLED, NO_FILL, and PLOTTER::SetCurrentLineWidth().

Referenced by BRDITEMS_PLOTTER::PlotDrawSegment(), and BRDITEMS_PLOTTER::PlotFootprintGraphicItem().

◆ ThickRect()

void PLOTTER::ThickRect ( const wxPoint p1,
const wxPoint p2,
int  width,
EDA_DRAW_MODE_T  tracemode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 547 of file plotter.cpp.

549 {
550  if( tracemode == FILLED )
551  Rect( p1, p2, NO_FILL, width );
552  else
553  {
554  SetCurrentLineWidth( -1 );
555  wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
556  p1.y - (width - currentPenWidth) / 2 );
557  wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
558  p2.y + (width - currentPenWidth) / 2 );
559  Rect( offsetp1, offsetp2, NO_FILL, -1 );
560  offsetp1.x += (width - currentPenWidth);
561  offsetp1.y += (width - currentPenWidth);
562  offsetp2.x -= (width - currentPenWidth);
563  offsetp2.y -= (width - currentPenWidth);
564  Rect( offsetp1, offsetp2, NO_FILL, -1 );
565  }
566 }
int currentPenWidth
Definition: plotter.h:591
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.

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

◆ ThickSegment()

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

Reimplemented from PLOTTER.

Definition at line 617 of file DXF_plotter.cpp.

619 {
620  if( aPlotMode == SKETCH )
621  {
622  std::vector<wxPoint> cornerList;
623  SHAPE_POLY_SET outlineBuffer;
624  TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef() );
625  const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
626 
627  cornerList.reserve( path.PointCount() );
628  for( int jj = 0; jj < path.PointCount(); jj++ )
629  cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
630 
631  // Ensure the polygon is closed
632  if( cornerList[0] != cornerList[cornerList.size() - 1] )
633  cornerList.push_back( cornerList[0] );
634 
635  PlotPoly( cornerList, NO_FILL );
636  }
637  else
638  {
639  MoveTo( aStart );
640  FinishTo( aEnd );
641  }
642 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aError)
convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSeg...
SHAPE_POLY_SET.
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetPlotterArcHighDef() const
Definition: plotter.h:223

References SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), PLOTTER::FinishTo(), PLOTTER::GetPlotterArcHighDef(), PLOTTER::MoveTo(), NO_FILL, PlotPoly(), SHAPE_LINE_CHAIN::PointCount(), SKETCH, TransformOvalToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PlotPoly().

◆ userToDeviceCoordinates()

DPOINT PLOTTER::userToDeviceCoordinates ( const wxPoint aCoordinate)
protectedvirtualinherited

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

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

Definition at line 94 of file plotter.cpp.

95 {
96  wxPoint pos = aCoordinate - plotOffset;
97 
98  // Don't allow overflows; they can cause rendering failures in some file viewers
99  // (such as Acrobat)
100  int clampSize = MAX_PAGE_SIZE_MILS * m_IUsPerDecimil * 10 / 2;
101  pos.x = std::max( -clampSize, std::min( pos.x, clampSize ) );
102  pos.y = std::max( -clampSize, std::min( pos.y, clampSize ) );
103 
104  double x = pos.x * plotScale;
105  double y = ( paperSize.y - pos.y * plotScale );
106 
107  if( m_plotMirror )
108  {
110  x = ( paperSize.x - pos.x * plotScale );
111  else
112  y = pos.y * plotScale;
113  }
114 
115  if( m_yaxisReversed )
116  y = paperSize.y - y;
117 
118  x *= iuPerDeviceUnit;
119  y *= iuPerDeviceUnit;
120 
121  return DPOINT( x, y );
122 }
double m_IUsPerDecimil
Definition: plotter.h:571
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:577
bool m_yaxisReversed
true to mirror horizontally (else vertically)
Definition: plotter.h:583
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:581
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:565
#define MAX_PAGE_SIZE_MILS
Definition: page_info.h:41
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:574
VECTOR2< double > DPOINT
Definition: vector2d.h:599
wxSize paperSize
Definition: plotter.h:599
bool m_mirrorIsHorizontal
Definition: plotter.h:582

References PLOTTER::iuPerDeviceUnit, PLOTTER::m_IUsPerDecimil, PLOTTER::m_mirrorIsHorizontal, PLOTTER::m_plotMirror, PLOTTER::m_yaxisReversed, MAX_PAGE_SIZE_MILS, 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(), SVG_PLOTTER::BezierCurve(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), SVG_PLOTTER::Circle(), Circle(), PSLIKE_PLOTTER::computeTextParameters(), HPGL_PLOTTER::FlashPadCircle(), GERBER_PLOTTER::FlashPadCircle(), GERBER_PLOTTER::FlashPadOval(), GERBER_PLOTTER::FlashPadRect(), GERBER_PLOTTER::FlashRegularPolygon(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), GERBER_PLOTTER::PenTo(), PenTo(), GERBER_PLOTTER::plotArc(), 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(), SVG_PLOTTER::Text(), and Text().

◆ userToDeviceSize() [1/2]

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

◆ userToDeviceSize() [2/2]

double PLOTTER::userToDeviceSize ( double  size) const
protectedvirtualinherited

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

Definition at line 132 of file plotter.cpp.

133 {
134  return size * plotScale * iuPerDeviceUnit;
135 }
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:565
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:574

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

Member Data Documentation

◆ colorMode

bool PLOTTER::colorMode
protectedinherited

◆ creator

wxString PLOTTER::creator
protectedinherited

◆ currentPenWidth

◆ DO_NOT_SET_LINE_WIDTH

◆ filename

◆ iuPerDeviceUnit

◆ m_currentColor

COLOR4D DXF_PLOTTER::m_currentColor
protected

Definition at line 1569 of file plotter.h.

Referenced by Arc(), Circle(), DXF_PLOTTER(), PenTo(), SetColor(), SetViewport(), and Text().

◆ m_currentLineType

PLOT_DASH_TYPE DXF_PLOTTER::m_currentLineType
protected

Definition at line 1570 of file plotter.h.

Referenced by DXF_PLOTTER(), PenTo(), and SetDash().

◆ m_headerExtraLines

wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

◆ m_IUsPerDecimil

◆ m_measurementDirective

unsigned int DXF_PLOTTER::m_measurementDirective
protected

Definition at line 1574 of file plotter.h.

Referenced by GetMeasurementDirective(), and SetUnits().

◆ m_mirrorIsHorizontal

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited

◆ m_plotMirror

◆ m_plotUnits

DXF_UNITS DXF_PLOTTER::m_plotUnits
protected

Definition at line 1572 of file plotter.h.

Referenced by GetUnits(), and SetUnits().

◆ m_renderSettings

◆ m_textAsLines

bool DXF_PLOTTER::m_textAsLines
protected

Definition at line 1568 of file plotter.h.

Referenced by DXF_PLOTTER(), SetTextMode(), and Text().

◆ m_unitScalingFactor

double DXF_PLOTTER::m_unitScalingFactor
protected

Definition at line 1573 of file plotter.h.

Referenced by GetUnitScaling(), and SetUnits().

◆ m_yaxisReversed

bool PLOTTER::m_yaxisReversed
protectedinherited

true to mirror horizontally (else vertically)

Definition at line 583 of file plotter.h.

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

◆ MARKER_COUNT

const unsigned PLOTTER::MARKER_COUNT = 58
staticinherited

Draw a marker (used for the drill map)

Definition at line 428 of file plotter.h.

Referenced by PLOTTER::Marker().

◆ negativeMode

bool PLOTTER::negativeMode
protectedinherited

Definition at line 590 of file plotter.h.

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

◆ outputFile

FILE* PLOTTER::outputFile
protectedinherited

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

Output file

Definition at line 586 of file plotter.h.

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

◆ pageInfo

◆ paperSize

◆ penLastpos

wxPoint PLOTTER::penLastpos
protectedinherited

◆ penState

char PLOTTER::penState
protectedinherited

◆ plotOffset

◆ plotScale

◆ title

wxString PLOTTER::title
protectedinherited

Definition at line 597 of file plotter.h.

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

◆ USE_DEFAULT_LINE_WIDTH


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