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 SetDefaultLineWidth (int width) override
 Set the default line width. 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
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)
 
virtual int GetCurrentLineWidth () const
 
virtual void SetCreator (const wxString &aCreator)
 
virtual void SetTitle (const wxString &aTitle)
 
void AddLineToHeader (const wxString &aExtraString)
 Function AddLineToHeader Add a line to the list of free lines to print at the beginning of the file. More...
 
void ClearHeaderLinesList ()
 Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning of the file. More...
 
virtual bool OpenFile (const wxString &aFullFilename)
 Open or create the plot file aFullFilename. More...
 
double GetIUsPerDecimil () const
 The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establishing the viewport. More...
 
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 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 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
 true to plot in color, false to plot in black and white More...
 
int defaultPenWidth
 true to generate a negative image (PS mode mainly) More...
 
int currentPenWidth
 
char penState
 Current pen state: 'U', 'D' or 'Z' (see PenTo) More...
 
wxPoint penLastpos
 Last pen positions; set to -1,-1 when the pen is at rest. More...
 
wxString creator
 
wxString filename
 
wxString title
 
PAGE_INFO pageInfo
 
wxSize paperSize
 Paper size in IU - not in mils. More...
 
wxArrayString m_headerExtraLines
 

Detailed Description

Definition at line 1390 of file plotter.h.

Member Enumeration Documentation

◆ DXF_UNITS

Enumerator
INCHES 
MILLIMETERS 

Definition at line 1485 of file plotter.h.

1486  {
1487  INCHES = 0,
1488  MILLIMETERS = 1
1489  };

Constructor & Destructor Documentation

◆ DXF_PLOTTER()

DXF_PLOTTER::DXF_PLOTTER ( )
inline

Definition at line 1393 of file plotter.h.

1393  : textAsLines( false )
1394  {
1395  textAsLines = true;
1399  }
bool textAsLines
Definition: plotter.h:1530
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
COLOR4D m_currentColor
Definition: plotter.h:1531
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1532
Definition: colors.h:45

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

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

183  {
184  m_headerExtraLines.Add( aExtraString );
185  }
wxArrayString m_headerExtraLines
Definition: plotter.h:602

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 646 of file DXF_plotter.cpp.

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

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 203 of file plotter.cpp.

206 {
207  // Generic fallback: Quadratic Bezier curve plotted as a polyline
208  int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
209 
210  std::vector<wxPoint> ctrlPoints;
211  ctrlPoints.push_back( aStart );
212  ctrlPoints.push_back( aControl1 );
213  ctrlPoints.push_back( aControl2 );
214  ctrlPoints.push_back( aEnd );
215 
216  BEZIER_POLY bezier_converter( ctrlPoints );
217 
218  std::vector<wxPoint> approxPoints;
219  bezier_converter.GetPoly( approxPoints, minSegLen );
220 
221  SetCurrentLineWidth( aLineThickness );
222  MoveTo( aStart );
223 
224  for( unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
225  LineTo( approxPoints[ii] );
226 
227  FinishTo( aEnd );
228 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:270
void LineTo(const wxPoint &pos)
Definition: plotter.h:265
void MoveTo(const wxPoint &pos)
Definition: plotter.h:260
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::Plot_1_EdgeModule(), and BRDITEMS_PLOTTER::PlotDrawSegment().

◆ 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 442 of file DXF_plotter.cpp.

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

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

192  {
193  m_headerExtraLines.Clear();
194  }
wxArrayString m_headerExtraLines
Definition: plotter.h:602

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

484 {}

Referenced by SCH_COMPONENT::Plot(), PlotSilkScreen(), and PlotStandardLayer().

◆ EndPlot()

bool DXF_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 391 of file DXF_plotter.cpp.

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

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 699 of file DXF_plotter.cpp.

701 {
702  wxASSERT( outputFile );
703  Circle( pos, diametre, NO_FILL );
704 }
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:584

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 793 of file DXF_plotter.cpp.

796 {
797  for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
798  {
799  SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
800 
801  MoveTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
802 
803  for( int ii = 1; ii < poly.PointCount(); ++ii )
804  LineTo( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
805 
806  FinishTo( wxPoint( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
807  }
808 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:270
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:265
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void MoveTo(const wxPoint &pos)
Definition: plotter.h:260
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 677 of file DXF_plotter.cpp.

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

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 710 of file DXF_plotter.cpp.

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

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 774 of file DXF_plotter.cpp.

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

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 814 of file DXF_plotter.cpp.

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

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 836 of file DXF_plotter.cpp.

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

◆ GetColorMode()

bool PLOTTER::GetColorMode ( ) const
inlineinherited

Definition at line 137 of file plotter.h.

138  {
139  return colorMode;
140  }
bool colorMode
Definition: plotter.h:587

References PLOTTER::colorMode.

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

◆ GetCurrentLineWidth()

◆ GetDashGapLenIU()

double PLOTTER::GetDashGapLenIU ( ) const
protectedinherited

Definition at line 151 of file plotter.cpp.

152 {
154 }
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:124
#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 145 of file plotter.cpp.

146 {
148 }
#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:124

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

1407  {
1408  return wxString( wxT( "dxf" ) );
1409  }

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

◆ GetDotMarkLenIU()

double PLOTTER::GetDotMarkLenIU ( ) const
protectedinherited

Definition at line 139 of file plotter.cpp.

140 {
142 }
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:124

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

223 { return m_IUsPerDecimil; }
double m_IUsPerDecimil
Definition: plotter.h:569

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

1525  {
1526  return m_measurementDirective;
1527  }
unsigned int m_measurementDirective
Definition: plotter.h:1536

References m_measurementDirective.

Referenced by StartPlot().

◆ GetPlotterArcHighDef()

int PLOTTER::GetPlotterArcHighDef ( ) const
inlineinherited

◆ GetPlotterArcLowDef()

int PLOTTER::GetPlotterArcLowDef ( ) const
inlineinherited

Definition at line 225 of file plotter.h.

225 { return m_IUsPerDecimil * 8; }
double m_IUsPerDecimil
Definition: plotter.h:569

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

1402  {
1403  return PLOT_FORMAT::DXF;
1404  }

References DXF.

◆ GetUnits()

DXF_UNITS DXF_PLOTTER::GetUnits ( ) const
inline

The units currently enabled for plotting.

Returns
The currently configured units

Definition at line 1503 of file plotter.h.

1504  {
1505  return m_plotUnits;
1506  }
DXF_UNITS m_plotUnits
Definition: plotter.h:1534

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

1515  {
1516  return m_unitScalingFactor;
1517  }
double m_unitScalingFactor
Definition: plotter.h:1535

References m_unitScalingFactor.

Referenced by SetViewport().

◆ LineTo()

void PLOTTER::LineTo ( const wxPoint pos)
inlineinherited

Definition at line 265 of file plotter.h.

266  {
267  PenTo( pos, 'D' );
268  }
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(), HPGL_PLOTTER::PlotPoly(), GERBER_PLOTTER::PlotPoly(), PlotPoly(), 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 331 of file plotter.cpp.

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

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 317 of file plotter.cpp.

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

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 273 of file plotter.cpp.

274 {
275  Circle( position, radius * 2, NO_FILL, GetCurrentLineWidth() );
276 }
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 303 of file plotter.cpp.

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

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 279 of file plotter.cpp.

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

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

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 248 of file plotter.cpp.

249 {
250  double r = KiROUND( radius / 1.4142 );
251  std::vector< wxPoint > corner_list;
252  wxPoint corner;
253  corner.x = position.x + r;
254  corner.y = position.y + r;
255  corner_list.push_back( corner );
256  corner.x = position.x + r;
257  corner.y = position.y - r;
258  corner_list.push_back( corner );
259  corner.x = position.x - r;
260  corner.y = position.y - r;
261  corner_list.push_back( corner );
262  corner.x = position.x - r;
263  corner.y = position.y + r;
264  corner_list.push_back( corner );
265  corner.x = position.x + r;
266  corner.y = position.y + r;
267  corner_list.push_back( corner );
268 
269  PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
270 }
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:61

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 324 of file plotter.cpp.

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

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 82 of file plotter.cpp.

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

◆ PenFinish()

void PLOTTER::PenFinish ( )
inlineinherited

Definition at line 276 of file plotter.h.

277  {
278  // The point is not important with Z motion
279  PenTo( wxPoint( 0, 0 ), 'Z' );
280  }
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 584 of file DXF_plotter.cpp.

585 {
586  wxASSERT( outputFile );
587  if( plume == 'Z' )
588  {
589  return;
590  }
591  DPOINT pos_dev = userToDeviceCoordinates( pos );
592  DPOINT pen_lastpos_dev = userToDeviceCoordinates( penLastpos );
593 
594  if( penLastpos != pos && plume == 'D' )
595  {
598  // DXF LINE
599  wxString cname = getDXFColorName( m_currentColor );
600  const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
601  fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
602  TO_UTF8( cname ), lname,
603  pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
604  }
605  penLastpos = pos;
606 }
static wxString getDXFColorName(COLOR4D aColor)
COLOR4D m_currentColor
Definition: plotter.h:1531
wxPoint penLastpos
Last pen positions; set to -1,-1 when the pen is at rest.
Definition: plotter.h:594
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:99
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:584
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1532

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 231 of file plotter.cpp.

232 {
233  wxSize size( aImage.GetWidth() * aScaleFactor,
234  aImage.GetHeight() * aScaleFactor );
235 
236  wxPoint start = aPos;
237  start.x -= size.x / 2;
238  start.y -= size.y / 2;
239 
240  wxPoint end = start;
241  end.x += size.x;
242  end.y += size.y;
243 
244  Rect( start, end, NO_FILL );
245 }
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 575 of file plotter.cpp.

577 {
578  std::vector<wxPoint> cornerList;
579  cornerList.reserve( aCornerList.PointCount() );
580 
581  for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
582  cornerList.emplace_back( aCornerList.CPoint( ii ) );
583 
584  if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
585  cornerList.emplace_back( aCornerList.CPoint( 0 ) );
586 
587  PlotPoly( cornerList, aFill, aWidth, aData );
588 }
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 482 of file DXF_plotter.cpp.

484 {
485  if( aCornerList.size() <= 1 )
486  return;
487 
488  unsigned last = aCornerList.size() - 1;
489 
490  // Plot outlines with lines (thickness = 0) to define the polygon
491  if( aWidth <= 0 )
492  {
493  MoveTo( aCornerList[0] );
494 
495  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
496  LineTo( aCornerList[ii] );
497 
498  // Close polygon if 'fill' requested
499  if( aFill )
500  {
501  if( aCornerList[last] != aCornerList[0] )
502  LineTo( aCornerList[0] );
503  }
504 
505  PenFinish();
506 
507  return;
508  }
509 
510 
511  // if the polygon outline has thickness, and is not filled
512  // (i.e. is a polyline) plot outlines with thick segments
513  if( aWidth > 0 && !aFill )
514  {
515  MoveTo( aCornerList[0] );
516 
517  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
518  ThickSegment( aCornerList[ii-1], aCornerList[ii],
519  aWidth, FILLED, NULL );
520 
521  return;
522  }
523 
524  // The polygon outline has thickness, and is filled
525  // Build and plot the polygon which contains the initial
526  // polygon and its thick outline
527  SHAPE_POLY_SET bufferOutline;
528  SHAPE_POLY_SET bufferPolybase;
529 
530  bufferPolybase.NewOutline();
531 
532  // enter outline as polygon:
533  for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
534  {
535  TransformSegmentToPolygon( bufferOutline,
536  aCornerList[ ii - 1 ], aCornerList[ ii ], GetPlotterArcHighDef(), aWidth );
537  }
538 
539  // enter the initial polygon:
540  for( unsigned ii = 0; ii < aCornerList.size(); ii++ )
541  {
542  bufferPolybase.Append( aCornerList[ii] );
543  }
544 
545  // Merge polygons to build the polygon which contains the initial
546  // polygon and its thick outline
547 
548  // create the outline which contains thick outline:
549  bufferPolybase.BooleanAdd( bufferOutline, SHAPE_POLY_SET::PM_FAST );
550  bufferPolybase.Fracture( SHAPE_POLY_SET::PM_FAST );
551 
552  if( bufferPolybase.OutlineCount() < 1 ) // should not happen
553  return;
554 
555  const SHAPE_LINE_CHAIN& path = bufferPolybase.COutline( 0 );
556 
557  if( path.PointCount() < 2 ) // should not happen
558  return;
559 
560  // Now, output the final polygon to DXF file:
561  last = path.PointCount() - 1;
562  VECTOR2I point = path.CPoint( 0 );
563 
564  wxPoint startPoint( point.x, point.y );
565  MoveTo( startPoint );
566 
567  for( int ii = 1; ii < path.PointCount(); ii++ )
568  {
569  point = path.CPoint( ii );
570  LineTo( wxPoint( point.x, point.y ) );
571  }
572 
573  // Close polygon, if needed
574  point = path.CPoint( last );
575  wxPoint endPoint( point.x, point.y );
576 
577  if( endPoint != startPoint )
578  LineTo( startPoint );
579 
580  PenFinish();
581 }
void PenFinish()
Definition: plotter.h:276
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:265
#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:260
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetPlotterArcHighDef() const
Definition: plotter.h:226
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 425 of file DXF_plotter.cpp.

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

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

◆ 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 437 of file plotter.cpp.

439 {
440  wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
441  wxSize size( end.x - start.x, end.y - start.y );
442  double orient;
443 
444  if( size.y == 0 )
445  orient = 0;
446  else if( size.x == 0 )
447  orient = 900;
448  else
449  orient = -ArcTangente( size.y, size.x );
450 
451  size.x = KiROUND( EuclideanNorm( size ) ) + width;
452  size.y = width;
453 
454  FlashPadOval( center, size, orient, tracemode, NULL );
455 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
#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:61
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 410 of file DXF_plotter.cpp.

411 {
412  if( ( colorMode )
413  || ( color == COLOR4D::BLACK )
414  || ( color == COLOR4D::WHITE ) )
415  {
417  }
418  else
420 }
int color
Definition: DXF_plotter.cpp:61
bool colorMode
Definition: plotter.h:587
COLOR4D m_currentColor
Definition: plotter.h:1531
Definition: colors.h:49
Definition: colors.h:45

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

1425  {
1426  currentPenWidth = 0;
1427  }
int currentPenWidth
Definition: plotter.h:590

References PLOTTER::currentPenWidth.

◆ SetDash()

void DXF_PLOTTER::SetDash ( PLOT_DASH_TYPE  dashed)
overridevirtual

Implements PLOTTER.

Definition at line 609 of file DXF_plotter.cpp.

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

References FIRST_TYPE, LAST_TYPE, and m_currentLineType.

◆ SetDefaultLineWidth()

virtual void DXF_PLOTTER::SetDefaultLineWidth ( int  width)
inlineoverridevirtual

Set the default line width.

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

Parameters
widthis specified in IUs

Implements PLOTTER.

Definition at line 1429 of file plotter.h.

1430  {
1431  // DXF lines are infinitesimal
1432  defaultPenWidth = 0;
1433  }
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:589

References PLOTTER::defaultPenWidth.

Referenced by SetViewport().

◆ SetGerberCoordinatesFormat()

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

Reimplemented in GERBER_PLOTTER.

Definition at line 463 of file plotter.h.

464  {
465  // NOP for most plotters. Only for Gerber plotter
466  }

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

450  {
451  // NOP for most plotters
452  }

Referenced by PlotOneBoardLayer().

◆ SetNegative()

virtual void PLOTTER::SetNegative ( bool  aNegative)
inlinevirtualinherited

Definition at line 124 of file plotter.h.

125  {
126  negativeMode = aNegative;
127  }
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:588

References PLOTTER::negativeMode.

Referenced by FillNegativeKnockout().

◆ SetPageSettings()

◆ SetTextMode()

virtual void DXF_PLOTTER::SetTextMode ( PLOT_TEXT_MODE  mode)
inlineoverridevirtual

DXF handles NATIVE text emitting TEXT entities.

Reimplemented from PLOTTER.

Definition at line 1414 of file plotter.h.

1415  {
1416  if( mode != PLOT_TEXT_MODE::DEFAULT )
1417  textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
1418  }
bool textAsLines
Definition: plotter.h:1530

References DEFAULT, NATIVE, and textAsLines.

◆ SetTitle()

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

Definition at line 172 of file plotter.h.

173  {
174  title = aTitle;
175  }
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:1535
unsigned int m_measurementDirective
Definition: plotter.h:1536
DXF_UNITS m_plotUnits
Definition: plotter.h:1534

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  SetDefaultLineWidth( 0 ); // No line width on DXF
173  m_plotMirror = false; // No mirroring on DXF
175 }
COLOR4D m_currentColor
Definition: plotter.h:1531
double m_IUsPerDecimil
Definition: plotter.h:569
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:575
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
Definition: plotter.h:1514
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:579
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:563
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: plotter.h:1429
Definition: colors.h:45
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:572
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:600

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

Referenced by DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF().

◆ sketchOval()

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

Definition at line 458 of file plotter.cpp.

459 {
460  SetCurrentLineWidth( width );
461  width = currentPenWidth;
462  int radius, deltaxy, cx, cy;
463  wxSize size( aSize );
464 
465  if( size.x > size.y )
466  {
467  std::swap( size.x, size.y );
468  orient = AddAngles( orient, 900 );
469  }
470 
471  deltaxy = size.y - size.x; /* distance between centers of the oval */
472  radius = ( size.x - width ) / 2;
473  cx = -radius;
474  cy = -deltaxy / 2;
475  RotatePoint( &cx, &cy, orient );
476  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
477  cx = -radius;
478  cy = deltaxy / 2;
479  RotatePoint( &cx, &cy, orient );
480  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
481 
482  cx = radius;
483  cy = -deltaxy / 2;
484  RotatePoint( &cx, &cy, orient );
485  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
486  cx = radius;
487  cy = deltaxy / 2;
488  RotatePoint( &cx, &cy, orient );
489  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
490 
491  cx = 0;
492  cy = deltaxy / 2;
493  RotatePoint( &cx, &cy, orient );
494  Arc( wxPoint( cx + pos.x, cy + pos.y ),
495  orient + 1800, orient + 3600,
496  radius, NO_FILL );
497  cx = 0;
498  cy = -deltaxy / 2;
499  RotatePoint( &cx, &cy, orient );
500  Arc( wxPoint( cx + pos.x, cy + pos.y ),
501  orient, orient + 1800,
502  radius, NO_FILL );
503 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:270
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:299
void MoveTo(const wxPoint &pos)
Definition: plotter.h:260
int currentPenWidth
Definition: plotter.h:590
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:157
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 475 of file plotter.h.

475 {}

Referenced by SCH_COMPONENT::Plot(), PlotSilkScreen(), and PlotStandardLayer().

◆ StartPlot()

bool DXF_PLOTTER::StartPlot ( )
overridevirtual

Opens the DXF plot with a skeleton header.

Implements PLOTTER.

Definition at line 180 of file DXF_plotter.cpp.

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

References BLACK, color, dxf_layer, DXF_OBLIQUE_ANGLE, PLOTTER::GetColorMode(), GetMeasurementDirective(), name, NBCOLORS, NextColor(), 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  aWidth,
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)
aWidth= line width (pen width) (default = 0) if width < 0 : draw segments in sketch mode, width = abs(width) Use a value min(aSize.x, aSize.y) / 5 for a bold text
aItalic= true to simulate an italic font
aBold= true to use a bold font Useful only with default width value (aWidth = 0)
aMultilineAllowed= true to plot text as multiline, otherwise single line
aData= a parameter used by some plotters in SetCurrentLineWidth(), not directly used here.

Reimplemented from PLOTTER.

Definition at line 864 of file DXF_plotter.cpp.

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

References containsNonAsciiChars(), DXF_OBLIQUE_ANGLE, ENABLE_SUBSCRIPT_MARKUP, ENABLE_SUPERSCRIPT_MARKUP, getDXFColorName(), GetTextMarkupFlags(), 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, PLOTTER::outputFile, SetColor(), PLOTTER::Text(), textAsLines, 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 523 of file plotter.cpp.

525 {
526  if( tracemode == FILLED )
527  Arc( centre, StAngle, EndAngle, radius, NO_FILL, width );
528  else
529  {
530  SetCurrentLineWidth( -1 );
531  Arc( centre, StAngle, EndAngle,
532  radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 );
533  Arc( centre, StAngle, EndAngle,
534  radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 );
535  }
536 }
int currentPenWidth
Definition: plotter.h:590
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:157
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::Plot_1_EdgeModule(), and BRDITEMS_PLOTTER::PlotDrawSegment().

◆ 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 561 of file plotter.cpp.

563 {
564  if( tracemode == FILLED )
565  Circle( pos, diametre, NO_FILL, width );
566  else
567  {
568  SetCurrentLineWidth( -1 );
569  Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 );
570  Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 );
571  }
572 }
int currentPenWidth
Definition: plotter.h:590
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::Plot_1_EdgeModule(), and BRDITEMS_PLOTTER::PlotDrawSegment().

◆ 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 539 of file plotter.cpp.

541 {
542  if( tracemode == FILLED )
543  Rect( p1, p2, NO_FILL, width );
544  else
545  {
546  SetCurrentLineWidth( -1 );
547  wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
548  p1.y - (width - currentPenWidth) / 2 );
549  wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
550  p2.y + (width - currentPenWidth) / 2 );
551  Rect( offsetp1, offsetp2, NO_FILL, -1 );
552  offsetp1.x += (width - currentPenWidth);
553  offsetp1.y += (width - currentPenWidth);
554  offsetp2.x -= (width - currentPenWidth);
555  offsetp2.y -= (width - currentPenWidth);
556  Rect( offsetp1, offsetp2, NO_FILL, -1 );
557  }
558 }
int currentPenWidth
Definition: plotter.h:590
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 616 of file DXF_plotter.cpp.

618 {
619  if( aPlotMode == SKETCH )
620  {
621  std::vector<wxPoint> cornerList;
622  SHAPE_POLY_SET outlineBuffer;
623  TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef() );
624  const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
625 
626  cornerList.reserve( path.PointCount() );
627  for( int jj = 0; jj < path.PointCount(); jj++ )
628  cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
629 
630  // Ensure the polygon is closed
631  if( cornerList[0] != cornerList[cornerList.size() - 1] )
632  cornerList.push_back( cornerList[0] );
633 
634  PlotPoly( cornerList, NO_FILL );
635  }
636  else
637  {
638  MoveTo( aStart );
639  FinishTo( aEnd );
640  }
641 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:270
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:260
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetPlotterArcHighDef() const
Definition: plotter.h:226

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 99 of file plotter.cpp.

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

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

Referenced by HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), SVG_PLOTTER::Arc(), GERBER_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(), 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 131 of file plotter.cpp.

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

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

Member Data Documentation

◆ colorMode

bool PLOTTER::colorMode
protectedinherited

◆ creator

wxString PLOTTER::creator
protectedinherited

◆ currentPenWidth

◆ defaultPenWidth

◆ DO_NOT_SET_LINE_WIDTH

const int PLOTTER::DO_NOT_SET_LINE_WIDTH = -2
staticinherited

◆ filename

◆ iuPerDeviceUnit

◆ m_currentColor

COLOR4D DXF_PLOTTER::m_currentColor
protected

Definition at line 1531 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 1532 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 1536 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 1534 of file plotter.h.

Referenced by GetUnits(), and SetUnits().

◆ m_unitScalingFactor

double DXF_PLOTTER::m_unitScalingFactor
protected

Definition at line 1535 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 581 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 431 of file plotter.h.

Referenced by PLOTTER::Marker().

◆ negativeMode

bool PLOTTER::negativeMode
protectedinherited

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

Definition at line 588 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 584 of file plotter.h.

Referenced by HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), SVG_PLOTTER::Arc(), GERBER_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(), 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::PlotGerberRegion(), PS_PLOTTER::PlotImage(), SVG_PLOTTER::PlotImage(), HPGL_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), GERBER_PLOTTER::PlotPoly(), 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

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

Definition at line 594 of file plotter.h.

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

◆ penState

char PLOTTER::penState
protectedinherited

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

Definition at line 592 of file plotter.h.

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

◆ plotOffset

◆ plotScale

◆ textAsLines

bool DXF_PLOTTER::textAsLines
protected

Definition at line 1530 of file plotter.h.

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

◆ 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: