KiCad PCB EDA Suite
DXF_PLOTTER Class Reference

#include <plotter_dxf.h>

Inheritance diagram for DXF_PLOTTER:
PLOTTER

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 (const wxString &aPageNumber) override
 Open the DXF plot with a skeleton header. More...
 
virtual bool EndPlot () override
 
virtual void SetCurrentLineWidth (int width, void *aData=nullptr) override
 Set the line width for the next drawing. More...
 
virtual void SetDash (int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
 
virtual void SetColor (const COLOR4D &color) override
 The DXF exporter handles 'colors' as layers... More...
 
virtual void SetViewport (const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
 Set the scale/position for the DXF plot. More...
 
virtual void Rect (const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 DXF rectangle: fill not supported. More...
 
virtual void Circle (const VECTOR2I &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< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) 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 VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData) override
 
virtual void PenTo (const VECTOR2I &pos, char plume) override
 Moveto/lineto primitive, moves the 'pen' to the specified direction. More...
 
virtual void FlashPadCircle (const VECTOR2I &pos, int diametre, OUTLINE_MODE 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 VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 DXF oval pad: always done in sketch mode. More...
 
virtual void FlashPadRect (const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 DXF rectangular pad: always done in sketch mode. More...
 
virtual void FlashPadRoundRect (const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadCustom (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadTrapez (const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
 DXF trapezoidal pad: only sketch mode is supported. More...
 
virtual void FlashRegularPolygon (const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 Flash a regular polygon. More...
 
virtual void Text (const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, KIFONT::FONT *aFont=nullptr, void *aData=nullptr) override
 Draw text with the plotter. More...
 
void SetUnits (DXF_UNITS aUnit)
 Set the units to use for plotting the DXF file. More...
 
DXF_UNITS GetUnits () const
 The units currently enabled for plotting. More...
 
double GetUnitScaling () const
 Get the scale factor to apply to convert the device units to be in the currently set units. More...
 
unsigned int GetMeasurementDirective () const
 Get the correct value for the $MEASUREMENT field given the current units. More...
 
virtual void SetNegative (bool aNegative)
 
virtual void SetColorMode (bool aColorMode)
 Plot in B/W or color. More...
 
bool GetColorMode () const
 
void SetRenderSettings (RENDER_SETTINGS *aSettings)
 
RENDER_SETTINGSRenderSettings ()
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)
 
PAGE_INFOPageSettings ()
 
virtual int GetCurrentLineWidth () const
 
virtual void SetCreator (const wxString &aCreator)
 
virtual void SetTitle (const wxString &aTitle)
 
void AddLineToHeader (const wxString &aExtraString)
 Add a line to the list of free lines to print at the beginning of the file. More...
 
void 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 Arc (const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError)
 Generic fallback: arc rendered as a polyline. More...
 
virtual void BezierCurve (const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &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 VECTOR2I &pos)
 
void LineTo (const VECTOR2I &pos)
 
void FinishTo (const VECTOR2I &pos)
 
void PenFinish ()
 
virtual void PlotPoly (const SHAPE_LINE_CHAIN &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)
 Draw a polygon ( filled or not ). More...
 
virtual void PlotImage (const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor)
 Only PostScript plotters can plot bitmaps. More...
 
virtual void ThickArc (const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData)
 
virtual void ThickArc (const EDA_SHAPE &aArcShape, OUTLINE_MODE aTraceMode, void *aData)
 
virtual void ThickRect (const VECTOR2I &p1, const VECTOR2I &p2, int width, OUTLINE_MODE tracemode, void *aData)
 
virtual void ThickCircle (const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
 
virtual void FilledCircle (const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
 
virtual void HyperlinkBox (const BOX2I &aBox, const wxString &aDestinationURL)
 Create a clickable hyperlink with a rectangular click area. More...
 
virtual void HyperlinkMenu (const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
 Create a clickable hyperlink menu with a rectangular click area. More...
 
virtual void Bookmark (const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
 Create a bookmark to a symbol. More...
 
void Marker (const VECTOR2I &position, int diametre, unsigned aShapeId)
 Draw a pattern shape number aShapeId, to coord position. More...
 
virtual void SetLayerPolarity (bool aPositive)
 Set the current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerber file, respectively. More...
 
virtual void SetGerberCoordinatesFormat (int aResolution, bool aUseInches=false)
 
virtual void SetSvgCoordinatesFormat (unsigned aPrecision)
 Set the number of digits for mantissa in coordinates in mm for SVG plotter. More...
 
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

virtual void Arc (const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
 Generic fallback: arc rendered as a polyline. More...
 
virtual void ThickArc (const VECTOR2I &aCentre, const EDA_ANGLE &StAngle, const EDA_ANGLE &EndAngle, int aRadius, int aWidth, OUTLINE_MODE aTraceMode, void *aData)
 
void markerCircle (const VECTOR2I &pos, int radius)
 Plot a circle centered on the position. More...
 
void markerHBar (const VECTOR2I &pos, int radius)
 Plot a - bar centered on the position. More...
 
void markerSlash (const VECTOR2I &pos, int radius)
 Plot a / bar centered on the position. More...
 
void markerBackSlash (const VECTOR2I &pos, int radius)
 Plot a \ bar centered on the position. More...
 
void markerVBar (const VECTOR2I &pos, int radius)
 Plot a | bar centered on the position. More...
 
void markerSquare (const VECTOR2I &position, int radius)
 Plot a square centered on the position. More...
 
void markerLozenge (const VECTOR2I &position, int radius)
 Plot a lozenge centered on the position. More...
 
void segmentAsOval (const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode)
 Convert a thick segment and plot it as an oval. More...
 
void sketchOval (const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
 
virtual VECTOR2D userToDeviceCoordinates (const VECTOR2I &aCoordinate)
 Modify coordinates according to the orientation, scale factor, and offsets trace. More...
 
virtual VECTOR2D userToDeviceSize (const VECTOR2I &size)
 Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D). More...
 
virtual double userToDeviceSize (double size) const
 Modify size according to the plotter scale factors (simple double version). More...
 
double GetDotMarkLenIU (int aLineWidth) const
 
double GetDashMarkLenIU (int aLineWidth) const
 
double GetDashGapLenIU (int aLineWidth) const
 

Protected Attributes

bool m_textAsLines
 
COLOR4D m_currentColor
 
PLOT_DASH_TYPE m_currentLineType
 
DXF_UNITS m_plotUnits
 
double m_unitScalingFactor
 
unsigned int m_measurementDirective
 
double m_plotScale
 Plot scale - chosen by the user (even implicitly with 'fit in a4') More...
 
double m_IUsPerDecimil
 
double m_iuPerDeviceUnit
 
VECTOR2I m_plotOffset
 
bool m_plotMirror
 
bool m_mirrorIsHorizontal
 
bool m_yaxisReversed
 
FILE * m_outputFile
 Output file. More...
 
bool m_colorMode
 
bool m_negativeMode
 
int m_currentPenWidth
 
char m_penState
 
VECTOR2I m_penLastpos
 
wxString m_creator
 
wxString m_filename
 
wxString m_title
 
PAGE_INFO m_pageInfo
 
VECTOR2I m_paperSize
 
wxArrayString m_headerExtraLines
 
RENDER_SETTINGSm_renderSettings
 

Detailed Description

Definition at line 31 of file plotter_dxf.h.

Constructor & Destructor Documentation

◆ DXF_PLOTTER()

DXF_PLOTTER::DXF_PLOTTER ( )
inline

Definition at line 34 of file plotter_dxf.h.

34 : m_textAsLines( false )
35 {
36 m_textAsLines = true;
40 }
bool m_textAsLines
Definition: plotter_dxf.h:213
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
PLOT_DASH_TYPE m_currentLineType
Definition: plotter_dxf.h:215
COLOR4D m_currentColor
Definition: plotter_dxf.h:214
@ BLACK
Definition: color4d.h:44

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

Member Function Documentation

◆ AddLineToHeader()

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

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

169 {
170 m_headerExtraLines.Add( aExtraString );
171 }
wxArrayString m_headerExtraLines
Definition: plotter.h:648

References PLOTTER::m_headerExtraLines.

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

◆ Arc() [1/2]

void DXF_PLOTTER::Arc ( const VECTOR2I aCentre,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aEndAngle,
int  aRadius,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH 
)
overrideprotectedvirtual

Generic fallback: arc rendered as a polyline.

Reimplemented from PLOTTER.

Definition at line 629 of file DXF_plotter.cpp.

631{
632 wxASSERT( m_outputFile );
633
634 if( aRadius <= 0 )
635 return;
636
637 EDA_ANGLE startAngle( aStartAngle );
638 EDA_ANGLE endAngle( aEndAngle );
639
640 // In DXF, arcs are drawn CCW.
641 // If startAngle > endAngle, it is CW. So transform it to CCW
642 if( startAngle > endAngle )
643 std::swap( startAngle, endAngle );
644
645 VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
646 double radius_device = userToDeviceSize( aRadius );
647
648 // Emit a DXF ARC entity
649 wxString cname = getDXFColorName( m_currentColor );
650 fprintf( m_outputFile,
651 "0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
652 TO_UTF8( cname ),
653 centre_device.x, centre_device.y, radius_device,
654 startAngle.AsDegrees(), endAngle.AsDegrees() );
655}
static wxString getDXFColorName(const COLOR4D &aColor)
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:90
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
Definition: plotter.cpp:115
FILE * m_outputFile
Output file.
Definition: plotter.h:633
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

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

◆ Arc() [2/2]

void PLOTTER::Arc ( const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aEnd,
FILL_T  aFill,
int  aWidth,
int  aMaxError 
)
virtualinherited

Generic fallback: arc rendered as a polyline.

Reimplemented in HPGL_PLOTTER, PS_PLOTTER, and PDF_PLOTTER.

Definition at line 149 of file plotter.cpp.

151{
152 EDA_ANGLE startAngle( aStart - aCenter );
153 EDA_ANGLE endAngle( aEnd - aCenter );
154 int radius = ( aStart - aCenter ).EuclideanNorm();
155
156 if( startAngle > endAngle )
157 {
158 if( endAngle < ANGLE_0 )
159 endAngle.Normalize();
160 else
161 startAngle = startAngle.Normalize() - ANGLE_360;
162 }
163
164 // In old Kicad code, calls to Arc() using angles calls this function after
165 // swapping angles and negate them (to compensate the inverted Y axis).
166 // So to be compatible with Arc() calls with angles, do the same thing
167 std::swap( startAngle, endAngle );
168 startAngle = -startAngle;
169 endAngle = -endAngle;
170
171 Arc( aCenter, startAngle, endAngle, radius, aFill, aWidth );
172}
virtual void Arc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:149
static constexpr EDA_ANGLE & ANGLE_360
Definition: eda_angle.h:418
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129

References ANGLE_0, ANGLE_360, PLOTTER::Arc(), EuclideanNorm(), and EDA_ANGLE::Normalize().

Referenced by PLOTTER::Arc(), SCH_SHAPE::Plot(), LIB_SHAPE::Plot(), PLOTTER::sketchOval(), and PLOTTER::ThickArc().

◆ BezierCurve()

void PLOTTER::BezierCurve ( const VECTOR2I aStart,
const VECTOR2I aControl1,
const VECTOR2I aControl2,
const VECTOR2I 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 224 of file plotter.cpp.

227{
228 // Generic fallback: Quadratic Bezier curve plotted as a polyline
229 int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
230
231 std::vector<VECTOR2I> ctrlPoints;
232 ctrlPoints.reserve( 4 );
233
234 ctrlPoints.push_back( aStart );
235 ctrlPoints.push_back( aControl1 );
236 ctrlPoints.push_back( aControl2 );
237 ctrlPoints.push_back( aEnd );
238
239 BEZIER_POLY bezier_converter( ctrlPoints );
240
241 std::vector<VECTOR2I> approxPoints;
242 bezier_converter.GetPoly( approxPoints, minSegLen );
243
244 SetCurrentLineWidth( aLineThickness );
245 MoveTo( aStart );
246
247 for( unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
248 LineTo( approxPoints[ii] );
249
250 FinishTo( aEnd );
251}
Bezier curves to polygon converter.
Definition: bezier_curves.h:36
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
Definition: plotter.h:252

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

Referenced by SVG_PLOTTER::BezierCurve(), BRDITEMS_PLOTTER::PlotFootprintShape(), and BRDITEMS_PLOTTER::PlotPcbShape().

◆ Bookmark()

virtual void PLOTTER::Bookmark ( const BOX2I aBox,
const wxString &  aName,
const wxString &  aGroupName = wxEmptyString 
)
inlinevirtualinherited

Create a bookmark to a symbol.

@aBox is the bounding box of the symbol @aSymbolReference is the symbol schematic ref

Reimplemented in PDF_PLOTTER.

Definition at line 457 of file plotter.h.

459 {
460 // NOP for most plotters.
461 }

Referenced by SCH_LABEL_BASE::Plot(), SCH_SYMBOL::Plot(), and PlotStandardLayer().

◆ Circle()

void DXF_PLOTTER::Circle ( const VECTOR2I pos,
int  diametre,
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 428 of file DXF_plotter.cpp.

429{
430 wxASSERT( m_outputFile );
431 double radius = userToDeviceSize( diameter / 2 );
432 VECTOR2D centre_dev = userToDeviceCoordinates( centre );
433
434 if( radius > 0 )
435 {
436 wxString cname = getDXFColorName( m_currentColor );
437
438 if( fill == FILL_T::NO_FILL )
439 {
440 fprintf( m_outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
441 TO_UTF8( cname ),
442 centre_dev.x, centre_dev.y, radius );
443 }
444 else if( fill == FILL_T::FILLED_SHAPE )
445 {
446 double r = radius*0.5;
447 fprintf( m_outputFile, "0\nPOLYLINE\n" );
448 fprintf( m_outputFile, "8\n%s\n66\n1\n70\n1\n", TO_UTF8( cname ) );
449 fprintf( m_outputFile, "40\n%g\n41\n%g\n", radius, radius);
450 fprintf( m_outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ) );
451 fprintf( m_outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
452 centre_dev.x-r, centre_dev.y );
453 fprintf( m_outputFile, "0\nVERTEX\n8\n%s\n", TO_UTF8( cname ) );
454 fprintf( m_outputFile, "10\n%g\n 20\n%g\n42\n1.0\n",
455 centre_dev.x+r, centre_dev.y );
456 fprintf( m_outputFile, "0\nSEQEND\n");
457 }
458 }
459}
@ FILLED_SHAPE
E_SERIE r
Definition: eserie.cpp:41

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

Referenced by FlashPadCircle().

◆ ClearHeaderLinesList()

void PLOTTER::ClearHeaderLinesList ( )
inlineinherited

Remove all lines from the list of free lines to print at the beginning of the file.

Definition at line 176 of file plotter.h.

177 {
178 m_headerExtraLines.Clear();
179 }

References PLOTTER::m_headerExtraLines.

Referenced by GENDRILL_WRITER_BASE::genDrillMapFile(), and 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 527 of file plotter.h.

527{}

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

◆ EndPlot()

bool DXF_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 386 of file DXF_plotter.cpp.

387{
388 wxASSERT( m_outputFile );
389
390 // DXF FOOTER
391 fputs( " 0\n"
392 "ENDSEC\n"
393 " 0\n"
394 "EOF\n", m_outputFile );
395 fclose( m_outputFile );
396 m_outputFile = nullptr;
397
398 return true;
399}

References PLOTTER::m_outputFile.

Referenced by PCBNEW_JOBS_HANDLER::JobExportDxf(), and SCH_PLOTTER::plotOneSheetDXF().

◆ FilledCircle()

void PLOTTER::FilledCircle ( const VECTOR2I pos,
int  diametre,
OUTLINE_MODE  tracemode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 668 of file plotter.cpp.

669{
670 if( tracemode == FILLED )
671 {
672 Circle( pos, diametre, FILL_T::FILLED_SHAPE, 0 );
673 }
674 else
675 {
677 Circle( pos, diametre, FILL_T::NO_FILL, -1 );
678 }
679}
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
@ FILLED
Definition: outline_mode.h:27

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

Referenced by BRDITEMS_PLOTTER::PlotFootprintShape(), and BRDITEMS_PLOTTER::PlotPcbShape().

◆ FinishTo()

◆ FlashPadCircle()

void DXF_PLOTTER::FlashPadCircle ( const VECTOR2I pos,
int  diametre,
OUTLINE_MODE  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 678 of file DXF_plotter.cpp.

680{
681 wxASSERT( m_outputFile );
682 Circle( pos, diametre, FILL_T::NO_FILL );
683}
virtual void Circle(const VECTOR2I &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...

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

◆ FlashPadCustom()

void DXF_PLOTTER::FlashPadCustom ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
SHAPE_POLY_SET aPolygons,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape.
aSizeis the size of round reference pad.
aPadOrientis the pad rotation, used only with aperture macros (Gerber plotter).
aPolygonsthe shape as polygon set.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 764 of file DXF_plotter.cpp.

767{
768 for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
769 {
770 SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
771
772 MoveTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
773
774 for( int ii = 1; ii < poly.PointCount(); ++ii )
775 LineTo( VECTOR2I( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
776
777 FinishTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
778 }
779}
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
SHAPE_LINE_CHAIN & Outline(int aIndex)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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 VECTOR2I aPos,
const VECTOR2I aSize,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

DXF oval pad: always done in sketch mode.

Implements PLOTTER.

Definition at line 658 of file DXF_plotter.cpp.

660{
661 wxASSERT( m_outputFile );
662
663 VECTOR2I size( aSize );
664 EDA_ANGLE orient( aOrient );
665
666 /* The chip is reduced to an oval tablet with size.y > size.x
667 * (Oval vertical orientation 0) */
668 if( size.x > size.y )
669 {
670 std::swap( size.x, size.y );
671 orient += ANGLE_90;
672 }
673
674 sketchOval( aPos, size, orient, -1 );
675}
void sketchOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
Definition: plotter.cpp:496
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414

References ANGLE_90, PLOTTER::m_outputFile, PLOTTER::sketchOval(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadRect()

void DXF_PLOTTER::FlashPadRect ( const VECTOR2I aPos,
const VECTOR2I aSize,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

DXF rectangular pad: always done in sketch mode.

Implements PLOTTER.

Definition at line 686 of file DXF_plotter.cpp.

688{
689 wxASSERT( m_outputFile );
690
691 VECTOR2I size, start, end;
692
693 size.x = aPadSize.x / 2;
694 size.y = aPadSize.y / 2;
695
696 if( size.x < 0 )
697 size.x = 0;
698
699 if( size.y < 0 )
700 size.y = 0;
701
702 // If a dimension is zero, the trace is reduced to 1 line
703 if( size.x == 0 )
704 {
705 start = VECTOR2I( aPos.x, aPos.y - size.y );
706 end = VECTOR2I( aPos.x, aPos.y + size.y );
707 RotatePoint( start, aPos, aOrient );
708 RotatePoint( end, aPos, aOrient );
709 MoveTo( start );
710 FinishTo( end );
711 return;
712 }
713
714 if( size.y == 0 )
715 {
716 start = VECTOR2I( aPos.x - size.x, aPos.y );
717 end = VECTOR2I( aPos.x + size.x, aPos.y );
718 RotatePoint( start, aPos, aOrient );
719 RotatePoint( end, aPos, aOrient );
720 MoveTo( start );
721 FinishTo( end );
722 return;
723 }
724
725 start = VECTOR2I( aPos.x - size.x, aPos.y - size.y );
726 RotatePoint( start, aPos, aOrient );
727 MoveTo( start );
728
729 end = VECTOR2I( aPos.x - size.x, aPos.y + size.y );
730 RotatePoint( end, aPos, aOrient );
731 LineTo( end );
732
733 end = VECTOR2I( aPos.x + size.x, aPos.y + size.y );
734 RotatePoint( end, aPos, aOrient );
735 LineTo( end );
736
737 end = VECTOR2I( aPos.x + size.x, aPos.y - size.y );
738 RotatePoint( end, aPos, aOrient );
739 LineTo( end );
740
741 FinishTo( start );
742}
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References PLOTTER::FinishTo(), PLOTTER::LineTo(), PLOTTER::m_outputFile, PLOTTER::MoveTo(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadRoundRect()

void DXF_PLOTTER::FlashPadRoundRect ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
int  aCornerRadius,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape (center of the rectangle.
aSizeis the size of rounded rect.
aCornerRadiusRadius of the rounded corners.
aOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 745 of file DXF_plotter.cpp.

748{
749 SHAPE_POLY_SET outline;
750 TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0, 0,
752
753 // TransformRoundRectToPolygon creates only one convex polygon
754 SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
755
756 MoveTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
757
758 for( int ii = 1; ii < poly.PointCount(); ++ii )
759 LineTo( VECTOR2I( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
760
761 FinishTo( VECTOR2I( poly.CPoint( 0 ).x, poly.CPoint( 0 ).y ) );
762}
int GetPlotterArcHighDef() const
Definition: plotter.h:213
Represent a set of closed polygons.
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
@ ERROR_INSIDE

References SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, 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 VECTOR2I aPadPos,
const VECTOR2I aCorners,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

DXF trapezoidal pad: only sketch mode is supported.

Implements PLOTTER.

Definition at line 782 of file DXF_plotter.cpp.

785{
786 wxASSERT( m_outputFile );
787 VECTOR2I coord[4]; /* coord actual corners of a trapezoidal trace */
788
789 for( int ii = 0; ii < 4; ii++ )
790 {
791 coord[ii] = aCorners[ii];
792 RotatePoint( coord[ii], aPadOrient );
793 coord[ii] += aPadPos;
794 }
795
796 // Plot edge:
797 MoveTo( coord[0] );
798 LineTo( coord[1] );
799 LineTo( coord[2] );
800 LineTo( coord[3] );
801 FinishTo( coord[0] );
802}

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

◆ FlashRegularPolygon()

void DXF_PLOTTER::FlashRegularPolygon ( const VECTOR2I aShapePos,
int  aDiameter,
int  aCornerCount,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

Flash a regular polygon.

Useful 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.
aDatais a auxiliary parameter used (if needed) to handle extra info specific to the plotter.

Implements PLOTTER.

Definition at line 805 of file DXF_plotter.cpp.

808{
809 // Do nothing
810 wxASSERT( 0 );
811}

◆ GetColorMode()

◆ GetCurrentLineWidth()

◆ GetDashGapLenIU()

double PLOTTER::GetDashGapLenIU ( int  aLineWidth) const
protectedinherited

Definition at line 143 of file plotter.cpp.

144{
145 return userToDeviceSize( m_renderSettings->GetGapLength( aLineWidth ) );
146}
double GetGapLength(int aLineWidth) const
RENDER_SETTINGS * m_renderSettings
Definition: plotter.h:650

References KIGFX::RENDER_SETTINGS::GetGapLength(), PLOTTER::m_renderSettings, and PLOTTER::userToDeviceSize().

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

◆ GetDashMarkLenIU()

double PLOTTER::GetDashMarkLenIU ( int  aLineWidth) const
protectedinherited

◆ GetDefaultFileExtension()

static wxString DXF_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 47 of file plotter_dxf.h.

48 {
49 return wxString( wxT( "dxf" ) );
50 }

Referenced by SCH_PLOTTER::createDXFFiles(), and GetDefaultPlotExtension().

◆ GetDotMarkLenIU()

double PLOTTER::GetDotMarkLenIU ( int  aLineWidth) const
protectedinherited

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

210{ return m_IUsPerDecimil; }
double m_IUsPerDecimil
Definition: plotter.h:622

References PLOTTER::m_IUsPerDecimil.

Referenced by PlotDrawingSheet().

◆ 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 203 of file plotter_dxf.h.

204 {
206 }
unsigned int m_measurementDirective
Definition: plotter_dxf.h:219

References m_measurementDirective.

Referenced by StartPlot().

◆ GetPlotterArcHighDef()

◆ GetPlotterArcLowDef()

int PLOTTER::GetPlotterArcLowDef ( ) const
inlineinherited

Definition at line 212 of file plotter.h.

212{ return m_IUsPerDecimil * 8; }

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 42 of file plotter_dxf.h.

43 {
44 return PLOT_FORMAT::DXF;
45 }

References DXF.

◆ GetUnits()

DXF_UNITS DXF_PLOTTER::GetUnits ( ) const
inline

The units currently enabled for plotting.

Returns
The currently configured units

Definition at line 182 of file plotter_dxf.h.

183 {
184 return m_plotUnits;
185 }
DXF_UNITS m_plotUnits
Definition: plotter_dxf.h:217

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 193 of file plotter_dxf.h.

194 {
195 return m_unitScalingFactor;
196 }
double m_unitScalingFactor
Definition: plotter_dxf.h:218

References m_unitScalingFactor.

Referenced by SetViewport().

◆ HyperlinkBox()

virtual void PLOTTER::HyperlinkBox ( const BOX2I aBox,
const wxString &  aDestinationURL 
)
inlinevirtualinherited

Create a clickable hyperlink with a rectangular click area.

@aBox is the rectangular click target @aDestinationURL is the target URL

Reimplemented in PDF_PLOTTER.

Definition at line 435 of file plotter.h.

436 {
437 // NOP for most plotters.
438 }

Referenced by SCH_TEXT::Plot(), and SCH_TEXTBOX::Plot().

◆ HyperlinkMenu()

virtual void PLOTTER::HyperlinkMenu ( const BOX2I aBox,
const std::vector< wxString > &  aDestURLs 
)
inlinevirtualinherited

Create a clickable hyperlink menu with a rectangular click area.

@aBox is the rectangular click target @aDestURLs is the list of target URLs for the menu

Reimplemented in PDF_PLOTTER.

Definition at line 446 of file plotter.h.

447 {
448 // NOP for most plotters.
449 }

Referenced by SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_SHEET::Plot(), SCH_SYMBOL::Plot(), and PlotInteractiveLayer().

◆ LineTo()

◆ Marker()

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

Draw a pattern shape number aShapeId, to coord position.

Parameters
aPositionis the position of the marker.
aDiameteris the diameter of the marker.
aShapeIdis the index (used to generate forms characters).

Definition at line 359 of file plotter.cpp.

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

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 VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a \ bar centered on the position.

Building block for markers

Definition at line 345 of file plotter.cpp.

346{
347 MoveTo( VECTOR2I( pos.x + radius, pos.y - radius ) );
348 FinishTo( VECTOR2I( pos.x - radius, pos.y + radius ) );
349}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerCircle()

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

Plot a circle centered on the position.

Building block for markers

Definition at line 298 of file plotter.cpp.

299{
300 Circle( position, radius * 2, FILL_T::NO_FILL, GetCurrentLineWidth() );
301}
virtual int GetCurrentLineWidth() const
Definition: plotter.h:153

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

Referenced by PLOTTER::Marker().

◆ markerHBar()

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

Plot a - bar centered on the position.

Building block for markers

Definition at line 331 of file plotter.cpp.

332{
333 MoveTo( VECTOR2I( pos.x - radius, pos.y ) );
334 FinishTo( VECTOR2I( pos.x + radius, pos.y ) );
335}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerLozenge()

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

Plot a lozenge centered on the position.

Building block for markers

Definition at line 304 of file plotter.cpp.

305{
306 std::vector<VECTOR2I> corner_list;
307 VECTOR2I corner;
308
309 corner_list.reserve( 4 );
310
311 corner.x = position.x;
312 corner.y = position.y + radius;
313 corner_list.push_back( corner );
314 corner.x = position.x + radius;
315 corner.y = position.y,
316 corner_list.push_back( corner );
317 corner.x = position.x;
318 corner.y = position.y - radius;
319 corner_list.push_back( corner );
320 corner.x = position.x - radius;
321 corner.y = position.y;
322 corner_list.push_back( corner );
323 corner.x = position.x;
324 corner.y = position.y + radius;
325 corner_list.push_back( corner );
326
328}
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).

References PLOTTER::GetCurrentLineWidth(), NO_FILL, PLOTTER::PlotPoly(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerSlash()

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

Plot a / bar centered on the position.

Building block for markers

Definition at line 338 of file plotter.cpp.

339{
340 MoveTo( VECTOR2I( pos.x - radius, pos.y - radius ) );
341 FinishTo( VECTOR2I( pos.x + radius, pos.y + radius ) );
342}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerSquare()

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

Plot a square centered on the position.

Building block for markers

Definition at line 270 of file plotter.cpp.

271{
272 double r = KiROUND( radius / 1.4142 );
273 std::vector<VECTOR2I> corner_list;
274 VECTOR2I corner;
275
276 corner_list.reserve( 4 );
277
278 corner.x = position.x + r;
279 corner.y = position.y + r;
280 corner_list.push_back( corner );
281 corner.x = position.x + r;
282 corner.y = position.y - r;
283 corner_list.push_back( corner );
284 corner.x = position.x - r;
285 corner.y = position.y - r;
286 corner_list.push_back( corner );
287 corner.x = position.x - r;
288 corner.y = position.y + r;
289 corner_list.push_back( corner );
290 corner.x = position.x + r;
291 corner.y = position.y + r;
292 corner_list.push_back( corner );
293
295}
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:85

References PLOTTER::GetCurrentLineWidth(), KiROUND(), NO_FILL, PLOTTER::PlotPoly(), r, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerVBar()

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

Plot a | bar centered on the position.

Building block for markers

Definition at line 352 of file plotter.cpp.

353{
354 MoveTo( VECTOR2I( pos.x, pos.y - radius ) );
355 FinishTo( VECTOR2I( pos.x, pos.y + radius ) );
356}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ MoveTo()

◆ OpenFile()

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

Open or create the plot file aFullFilename.

Parameters
aFullFilenameis 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 74 of file plotter.cpp.

75{
76 m_filename = aFullFilename;
77
78 wxASSERT( !m_outputFile );
79
80 // Open the file in text mode (not suitable for all plotters but only for most of them.
81 m_outputFile = wxFopen( m_filename, wxT( "wt" ) );
82
83 if( m_outputFile == nullptr )
84 return false ;
85
86 return true;
87}
wxString m_filename
Definition: plotter.h:643

References PLOTTER::m_filename, and PLOTTER::m_outputFile.

Referenced by GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), GENDRILL_WRITER_BASE::genDrillMapFile(), SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetHpgl(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), StartPlotBoard(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ PageSettings()

PAGE_INFO & PLOTTER::PageSettings ( )
inlineinherited

Definition at line 144 of file plotter.h.

144{ return m_pageInfo; }
PAGE_INFO m_pageInfo
Definition: plotter.h:645

References PLOTTER::m_pageInfo.

Referenced by SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), and SCH_PLOTTER::plotOneSheetSVG().

◆ PenFinish()

void PLOTTER::PenFinish ( )
inlineinherited

Definition at line 263 of file plotter.h.

264 {
265 // The point is not important with Z motion
266 PenTo( VECTOR2I( 0, 0 ), 'Z' );
267 }

References PLOTTER::PenTo().

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

◆ PenTo()

void DXF_PLOTTER::PenTo ( const VECTOR2I 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 562 of file DXF_plotter.cpp.

563{
564 wxASSERT( m_outputFile );
565
566 if( plume == 'Z' )
567 {
568 return;
569 }
570
571 VECTOR2D pos_dev = userToDeviceCoordinates( pos );
572 VECTOR2D pen_lastpos_dev = userToDeviceCoordinates( m_penLastpos );
573
574 if( m_penLastpos != pos && plume == 'D' )
575 {
578 // DXF LINE
579 wxString cname = getDXFColorName( m_currentColor );
580 const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
581 fprintf( m_outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
582 TO_UTF8( cname ), lname,
583 pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
584 }
585
586 m_penLastpos = pos;
587}
static const char * getDXFLineType(PLOT_DASH_TYPE aType)
Definition: DXF_plotter.cpp:98
VECTOR2I m_penLastpos
Definition: plotter.h:640
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48

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

◆ PlotImage()

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

Only PostScript plotters can plot bitmaps.

A rectangle is plotted for plotters that cannot plot a bitmap.

Parameters
aImageis the bitmap.
aPosis position of the center of the bitmap.
aScaleFactoris the scale factor to apply to the bitmap size (this is not the plot scale factor).

Reimplemented in PS_PLOTTER, PDF_PLOTTER, and SVG_PLOTTER.

Definition at line 254 of file plotter.cpp.

255{
256 VECTOR2I size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
257
258 VECTOR2I start = aPos;
259 start.x -= size.x / 2;
260 start.y -= size.y / 2;
261
262 VECTOR2I end = start;
263 end.x += size.x;
264 end.y += size.y;
265
266 Rect( start, end, FILL_T::NO_FILL );
267}
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

References NO_FILL, PLOTTER::Rect(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ PlotPoly() [1/2]

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

Draw a polygon ( filled or not ).

Parameters
aCornerListis the corners list (a SHAPE_LINE_CHAIN). must be closed (IsClosed() == true) for a polygon. Otherwise this is a polyline.
aFillis the type of fill.
aWidthis the line width.
aDatais an auxiliary info (mainly for gerber format).

Reimplemented in GERBER_PLOTTER.

Definition at line 682 of file plotter.cpp.

683{
684 std::vector<VECTOR2I> cornerList;
685 cornerList.reserve( aCornerList.PointCount() );
686
687 for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
688 cornerList.emplace_back( aCornerList.CPoint( ii ) );
689
690 if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
691 cornerList.emplace_back( aCornerList.CPoint( 0 ) );
692
693 PlotPoly( cornerList, aFill, aWidth, aData );
694}
bool IsClosed() const override

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< VECTOR2I > &  aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = nullptr 
)
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 thick segments, therefore filled polygons with thick outline are converted to inflated polygon by aWidth/2.

Implements PLOTTER.

Definition at line 462 of file DXF_plotter.cpp.

464{
465 if( aCornerList.size() <= 1 )
466 return;
467
468 unsigned last = aCornerList.size() - 1;
469
470 // Plot outlines with lines (thickness = 0) to define the polygon
471 if( aWidth <= 0 )
472 {
473 MoveTo( aCornerList[0] );
474
475 for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
476 LineTo( aCornerList[ii] );
477
478 // Close polygon if 'fill' requested
479 if( aFill != FILL_T::NO_FILL )
480 {
481 if( aCornerList[last] != aCornerList[0] )
482 LineTo( aCornerList[0] );
483 }
484
485 PenFinish();
486
487 return;
488 }
489
490 // if the polygon outline has thickness, and is not filled
491 // (i.e. is a polyline) plot outlines with thick segments
492 if( aWidth > 0 && aFill == FILL_T::NO_FILL )
493 {
494 MoveTo( aCornerList[0] );
495
496 for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
497 ThickSegment( aCornerList[ii-1], aCornerList[ii], aWidth, FILLED, nullptr );
498
499 return;
500 }
501
502 // The polygon outline has thickness, and is filled
503 // Build and plot the polygon which contains the initial
504 // polygon and its thick outline
505 SHAPE_POLY_SET bufferOutline;
506 SHAPE_POLY_SET bufferPolybase;
507
508 bufferPolybase.NewOutline();
509
510 // enter outline as polygon:
511 for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
512 {
513 TransformOvalToPolygon( bufferOutline, aCornerList[ ii - 1 ], aCornerList[ ii ],
515 }
516
517 // enter the initial polygon:
518 for( unsigned ii = 0; ii < aCornerList.size(); ii++ )
519 {
520 bufferPolybase.Append( aCornerList[ii] );
521 }
522
523 // Merge polygons to build the polygon which contains the initial
524 // polygon and its thick outline
525
526 // create the outline which contains thick outline:
527 bufferPolybase.BooleanAdd( bufferOutline, SHAPE_POLY_SET::PM_FAST );
528 bufferPolybase.Fracture( SHAPE_POLY_SET::PM_FAST );
529
530 if( bufferPolybase.OutlineCount() < 1 ) // should not happen
531 return;
532
533 const SHAPE_LINE_CHAIN& path = bufferPolybase.COutline( 0 );
534
535 if( path.PointCount() < 2 ) // should not happen
536 return;
537
538 // Now, output the final polygon to DXF file:
539 last = path.PointCount() - 1;
540 VECTOR2I point = path.CPoint( 0 );
541
542 VECTOR2I startPoint( point.x, point.y );
543 MoveTo( startPoint );
544
545 for( int ii = 1; ii < path.PointCount(); ii++ )
546 {
547 point = path.CPoint( ii );
548 LineTo( VECTOR2I( point.x, point.y ) );
549 }
550
551 // Close polygon, if needed
552 point = path.CPoint( last );
553 VECTOR2I endPoint( point.x, point.y );
554
555 if( endPoint != startPoint )
556 LineTo( startPoint );
557
558 PenFinish();
559}
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData) override
void PenFinish()
Definition: plotter.h:263
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::COutline(), ERROR_INSIDE, FILLED, SHAPE_POLY_SET::Fracture(), PLOTTER::GetPlotterArcHighDef(), PLOTTER::LineTo(), PLOTTER::MoveTo(), SHAPE_POLY_SET::NewOutline(), NO_FILL, SHAPE_POLY_SET::OutlineCount(), path, PLOTTER::PenFinish(), SHAPE_POLY_SET::PM_FAST, ThickSegment(), TransformOvalToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ThickSegment().

◆ Rect()

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

DXF rectangle: fill not supported.

Implements PLOTTER.

Definition at line 417 of file DXF_plotter.cpp.

418{
419 wxASSERT( m_outputFile );
420 MoveTo( p1 );
421 LineTo( VECTOR2I( p1.x, p2.y ) );
422 LineTo( VECTOR2I( p2.x, p2.y ) );
423 LineTo( VECTOR2I( p2.x, p1.y ) );
424 FinishTo( VECTOR2I( p1.x, p1.y ) );
425}

References PLOTTER::FinishTo(), PLOTTER::LineTo(), PLOTTER::m_outputFile, PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ RenderSettings()

◆ segmentAsOval()

void PLOTTER::segmentAsOval ( const VECTOR2I start,
const VECTOR2I end,
int  width,
OUTLINE_MODE  tracemode 
)
protectedinherited

Convert a thick segment and plot it as an oval.

Definition at line 481 of file plotter.cpp.

483{
484 VECTOR2I center( ( start.x + end.x ) / 2, ( start.y + end.y ) / 2 );
485 VECTOR2I size( end.x - start.x, end.y - start.y );
486 EDA_ANGLE orient( size );
487 orient = -orient; // this is due to our Y axis orientation
488
489 size.x = KiROUND( EuclideanNorm( size ) ) + aWidth;
490 size.y = aWidth;
491
492 FlashPadOval( center, size, orient, aTraceMode, nullptr );
493}
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0

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

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

◆ SetColor()

void DXF_PLOTTER::SetColor ( const COLOR4D color)
overridevirtual

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

Implements PLOTTER.

Definition at line 402 of file DXF_plotter.cpp.

403{
404 if( ( m_colorMode )
405 || ( color == COLOR4D::BLACK )
406 || ( color == COLOR4D::WHITE ) )
407 {
409 }
410 else
411 {
413 }
414}
int color
Definition: DXF_plotter.cpp:57
@ WHITE
Definition: color4d.h:48

References BLACK, color, PLOTTER::m_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 = nullptr 
)
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 68 of file plotter_dxf.h.

69 {
71 }

References PLOTTER::m_currentPenWidth.

◆ SetDash()

void DXF_PLOTTER::SetDash ( int  aLineWidth,
PLOT_DASH_TYPE  aLineStyle 
)
overridevirtual

Implements PLOTTER.

Definition at line 590 of file DXF_plotter.cpp.

591{
592 wxASSERT( aLineStyle >= PLOT_DASH_TYPE::FIRST_TYPE
593 && aLineStyle <= PLOT_DASH_TYPE::LAST_TYPE );
594
595 m_currentLineType = aLineStyle;
596}

References FIRST_TYPE, LAST_TYPE, and m_currentLineType.

◆ SetGerberCoordinatesFormat()

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

Reimplemented in GERBER_PLOTTER.

Definition at line 500 of file plotter.h.

501 {
502 // NOP for most plotters. Only for Gerber plotter
503 }

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

◆ SetLayerPolarity()

virtual void PLOTTER::SetLayerPolarity ( bool  aPositive)
inlinevirtualinherited

Set the 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 486 of file plotter.h.

487 {
488 // NOP for most plotters
489 }

Referenced by PlotOneBoardLayer().

◆ SetNegative()

virtual void PLOTTER::SetNegative ( bool  aNegative)
inlinevirtualinherited

Definition at line 130 of file plotter.h.

130{ m_negativeMode = aNegative; }
bool m_negativeMode
Definition: plotter.h:637

References PLOTTER::m_negativeMode.

Referenced by FillNegativeKnockout().

◆ SetPageSettings()

◆ SetRenderSettings()

◆ SetSvgCoordinatesFormat()

virtual void PLOTTER::SetSvgCoordinatesFormat ( unsigned  aPrecision)
inlinevirtualinherited

Set the number of digits for mantissa in coordinates in mm for SVG plotter.

Reimplemented in SVG_PLOTTER.

Definition at line 506 of file plotter.h.

507 {
508 // NOP for most plotters. Only for SVG plotter
509 }

Referenced by initializePlotter().

◆ SetTextMode()

virtual void DXF_PLOTTER::SetTextMode ( PLOT_TEXT_MODE  mode)
inlineoverridevirtual

DXF handles NATIVE text emitting TEXT entities.

Reimplemented from PLOTTER.

Definition at line 55 of file plotter_dxf.h.

References DEFAULT, m_textAsLines, and NATIVE.

◆ SetTitle()

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

Definition at line 161 of file plotter.h.

161{ m_title = aTitle; }
wxString m_title
Definition: plotter.h:644

References PLOTTER::m_title.

Referenced by SCH_PLOTTER::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 130 of file DXF_plotter.cpp.

131{
132 m_plotUnits = aUnit;
133
134 switch( aUnit )
135 {
137 m_unitScalingFactor = 0.00254;
139 break;
140
142 default:
143 m_unitScalingFactor = 0.0001;
145 }
146}

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

151{
152 m_plotOffset = aOffset;
153 m_plotScale = aScale;
154
155 /* DXF paper is 'virtual' so there is no need of a paper size.
156 Also this way we can handle the aux origin which can be useful
157 (for example when aligning to a mechanical drawing) */
158 m_paperSize.x = 0;
159 m_paperSize.y = 0;
160
161 /* Like paper size DXF units are abstract too. Anyway there is a
162 * system variable (MEASUREMENT) which will be set to 0 to indicate
163 * english units */
164 m_IUsPerDecimil = aIusPerDecimil;
165 m_iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
166 m_iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
167
168 m_plotMirror = false; // No mirroring on DXF
170}
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
Definition: plotter_dxf.h:193
bool m_plotMirror
Definition: plotter.h:627
double m_iuPerDeviceUnit
Definition: plotter.h:624
VECTOR2I m_plotOffset
Definition: plotter.h:626
VECTOR2I m_paperSize
Definition: plotter.h:646
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:616

References BLACK, GetUnitScaling(), m_currentColor, PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_IUsPerDecimil, PLOTTER::m_paperSize, PLOTTER::m_plotMirror, PLOTTER::m_plotOffset, PLOTTER::m_plotScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::plotOneSheetDXF().

◆ sketchOval()

void PLOTTER::sketchOval ( const VECTOR2I aPos,
const VECTOR2I aSize,
const EDA_ANGLE aOrient,
int  aWidth 
)
protectedinherited

Definition at line 496 of file plotter.cpp.

498{
499 SetCurrentLineWidth( aWidth );
500
501 EDA_ANGLE orient( aOrient );
502 VECTOR2I size( aSize );
503
504 if( size.x > size.y )
505 {
506 std::swap( size.x, size.y );
507 orient += ANGLE_90;
508 }
509
510 int deltaxy = size.y - size.x; /* distance between centers of the oval */
511 int radius = size.x / 2;
512
513 // Build a vertical oval shape giving the start and end points of arcs and edges,
514 // and the middle point of arcs
515 std::vector<VECTOR2I> corners;
516 corners.reserve( 6 );
517 // Shape is (x = corner and arc ends, c = arc centre)
518 // xcx
519 //
520 // xcx
521 int half_height = deltaxy / 2;
522 corners.emplace_back( -radius, -half_height );
523 corners.emplace_back( -radius, half_height );
524 corners.emplace_back( 0, half_height );
525 corners.emplace_back( radius, half_height );
526 corners.emplace_back( radius, -half_height );
527 corners.emplace_back( 0, -half_height );
528
529 // Rotate and move to the actual position
530 for( size_t ii = 0; ii < corners.size(); ii++ )
531 {
532 RotatePoint( corners[ii], orient );
533 corners[ii] += aPos;
534 }
535
536 // Gen shape:
537 MoveTo( corners[0] );
538 FinishTo( corners[1] );
539
540 Arc( corners[2], orient + ANGLE_180, orient + ANGLE_360, radius, FILL_T::NO_FILL );
541
542 MoveTo( corners[3] );
543 FinishTo( corners[4] );
544
545 Arc( corners[5], orient, orient + ANGLE_180, radius, FILL_T::NO_FILL );
546}
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:416

References ANGLE_180, ANGLE_360, ANGLE_90, PLOTTER::Arc(), PLOTTER::FinishTo(), PLOTTER::MoveTo(), NO_FILL, RotatePoint(), PLOTTER::SetCurrentLineWidth(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GERBER_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_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 518 of file plotter.h.

518{}

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

◆ StartPlot()

bool DXF_PLOTTER::StartPlot ( const wxString &  aPageNumber)
overridevirtual

Open the DXF plot with a skeleton header.

Implements PLOTTER.

Definition at line 173 of file DXF_plotter.cpp.

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

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

Referenced by SCH_PLOTTER::plotOneSheetDXF().

◆ Text()

void DXF_PLOTTER::Text ( const VECTOR2I aPos,
const COLOR4D aColor,
const wxString &  aText,
const EDA_ANGLE aOrient,
const VECTOR2I aSize,
enum GR_TEXT_H_ALIGN_T  aH_justify,
enum GR_TEXT_V_ALIGN_T  aV_justify,
int  aPenWidth,
bool  aItalic,
bool  aBold,
bool  aMultilineAllowed = false,
KIFONT::FONT aFont = nullptr,
void *  aData = nullptr 
)
overridevirtual

Draw text with the plotter.

Same as GRText, but plot graphic text instead of draw it.

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

Parameters
aPosis the text position (according to aH_justify, aV_justify).
aColoris the text color.
aTextis the text to draw.
aOrientis the angle.
aSizeis the text size (size.x or size.y can be < 0 for mirrored texts).
aH_justifyis the horizontal justification (Left, center, right).
aV_justifyis the vertical justification (bottom, center, top).
aPenWidthis the line width (if = 0, use plot default line width).
aItalicis the true to simulate an italic font.
aBolduse true to use a bold font Useful only with default width value (aPenWidth = 0).
aMultilineAlloweduse true to plot text as multiline, otherwise single line.
aDatais a parameter used by some plotters in SetCurrentLineWidth(), not directly used here.

Reimplemented from PLOTTER.

Definition at line 834 of file DXF_plotter.cpp.

847{
848 // Fix me: see how to use DXF text mode for multiline texts
849 if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
850 aMultilineAllowed = false; // the text has only one line.
851
852 bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) );
853
854 if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
855 {
856 // output text as graphics.
857 // Perhaps multiline texts could be handled as DXF text entity
858 // but I do not want spend time about this (JPC)
859 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
860 aBold, aMultilineAllowed, aFont, aData );
861 }
862 else
863 {
864 /* Emit text as a text entity. This loses formatting and shape but it's
865 more useful as a CAD object */
866 VECTOR2D origin_dev = userToDeviceCoordinates( aPos );
867 SetColor( aColor );
868 wxString cname = getDXFColorName( m_currentColor );
869 VECTOR2D size_dev = userToDeviceSize( aSize );
870 int h_code = 0, v_code = 0;
871
872 switch( aH_justify )
873 {
874 case GR_TEXT_H_ALIGN_LEFT: h_code = 0; break;
875 case GR_TEXT_H_ALIGN_CENTER: h_code = 1; break;
876 case GR_TEXT_H_ALIGN_RIGHT: h_code = 2; break;
877 }
878
879 switch( aV_justify )
880 {
881 case GR_TEXT_V_ALIGN_TOP: v_code = 3; break;
882 case GR_TEXT_V_ALIGN_CENTER: v_code = 2; break;
883 case GR_TEXT_V_ALIGN_BOTTOM: v_code = 1; break;
884 }
885
886 // Position, size, rotation and alignment
887 // The two alignment point usages is somewhat idiot (see the DXF ref)
888 // Anyway since we don't use the fit/aligned options, they're the same
889 fprintf( m_outputFile,
890 " 0\n"
891 "TEXT\n"
892 " 7\n"
893 "%s\n" // Text style
894 " 8\n"
895 "%s\n" // Layer name
896 " 10\n"
897 "%g\n" // First point X
898 " 11\n"
899 "%g\n" // Second point X
900 " 20\n"
901 "%g\n" // First point Y
902 " 21\n"
903 "%g\n" // Second point Y
904 " 40\n"
905 "%g\n" // Text height
906 " 41\n"
907 "%g\n" // Width factor
908 " 50\n"
909 "%g\n" // Rotation
910 " 51\n"
911 "%g\n" // Oblique angle
912 " 71\n"
913 "%d\n" // Mirror flags
914 " 72\n"
915 "%d\n" // H alignment
916 " 73\n"
917 "%d\n", // V alignment
918 aBold ? (aItalic ? "KICADBI" : "KICADB") : (aItalic ? "KICADI" : "KICAD"),
919 TO_UTF8( cname ),
920 origin_dev.x, origin_dev.x,
921 origin_dev.y, origin_dev.y,
922 size_dev.y, fabs( size_dev.x / size_dev.y ),
923 aOrient.AsDegrees(),
924 aItalic ? DXF_OBLIQUE_ANGLE : 0,
925 size_dev.x < 0 ? 2 : 0, // X mirror flag
926 h_code, v_code );
927
928 /* There are two issue in emitting the text:
929 - Our overline character (~) must be converted to the appropriate
930 control sequence %%O or %%o
931 - Text encoding in DXF is more or less unspecified since depends on
932 the DXF declared version, the acad version reading it *and* some
933 system variables to be put in the header handled only by newer acads
934 Also before R15 unicode simply is not supported (you need to use
935 bigfonts which are a massive PITA). Common denominator solution:
936 use Latin1 (and however someone could choke on it, anyway). Sorry
937 for the extended latin people. If somewant want to try fixing this
938 recent version seems to use UTF-8 (and not UCS2 like the rest of
939 Windows)
940
941 XXX Actually there is a *third* issue: older DXF formats are limited
942 to 255 bytes records (it was later raised to 2048); since I'm lazy
943 and text so long is not probable I just don't implement this rule.
944 If someone is interested in fixing this, you have to emit the first
945 partial lines with group code 3 (max 250 bytes each) and then finish
946 with a group code 1 (less than 250 bytes). The DXF refs explains it
947 in no more details...
948 */
949
950 int braceNesting = 0;
951 int overbarDepth = -1;
952
953 fputs( " 1\n", m_outputFile );
954
955 for( unsigned int i = 0; i < aText.length(); i++ )
956 {
957 /* Here I do a bad thing: writing the output one byte at a time!
958 but today I'm lazy and I have no idea on how to coerce a Unicode
959 wxString to spit out latin1 encoded text ...
960
961 At least stdio is *supposed* to do output buffering, so there is
962 hope is not too slow */
963 wchar_t ch = aText[i];
964
965 if( ch > 255 )
966 {
967 // I can't encode this...
968 putc( '?', m_outputFile );
969 }
970 else
971 {
972 if( aText[i] == '~' && i+1 < aText.length() && aText[i+1] == '{' )
973 {
974 fputs( "%%o", m_outputFile );
975 overbarDepth = braceNesting;
976
977 // Skip the '{'
978 i++;
979 continue;
980 }
981 else if( aText[i] == '{' )
982 {
983 braceNesting++;
984 }
985 else if( aText[i] == '}' )
986 {
987 if( braceNesting > 0 )
988 braceNesting--;
989
990 if( braceNesting == overbarDepth )
991 {
992 fputs( "%%O", m_outputFile );
993 overbarDepth = -1;
994 continue;
995 }
996 }
997
998 putc( ch, m_outputFile );
999 }
1000 }
1001
1002 putc( '\n', m_outputFile );
1003 }
1004}
bool containsNonAsciiChars(const wxString &string)
Check if a given string contains non-ASCII characters.
virtual void SetColor(const COLOR4D &color) override
The DXF exporter handles 'colors' as layers...
double AsDegrees() const
Definition: eda_angle.h:149
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP

References EDA_ANGLE::AsDegrees(), containsNonAsciiChars(), DXF_OBLIQUE_ANGLE, getDXFColorName(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, m_currentColor, PLOTTER::m_outputFile, m_textAsLines, SetColor(), PLOTTER::Text(), TO_UTF8, PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ThickArc() [1/3]

void PLOTTER::ThickArc ( const EDA_SHAPE aArcShape,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 620 of file plotter.cpp.

622{
623 ThickArc( aArcShape.getCenter(),aArcShape.GetStart(), aArcShape.GetEnd(),
624 aArcShape.GetWidth(), aTraceMode, aData );
625}
VECTOR2I getCenter() const
Definition: eda_shape.cpp:432
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
int GetWidth() const
Definition: eda_shape.h:109
virtual void ThickArc(const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData)
Definition: plotter.cpp:592

References EDA_SHAPE::getCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), EDA_SHAPE::GetWidth(), and PLOTTER::ThickArc().

◆ ThickArc() [2/3]

void PLOTTER::ThickArc ( const VECTOR2I aCentre,
const EDA_ANGLE StAngle,
const EDA_ANGLE EndAngle,
int  aRadius,
int  aWidth,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
protectedvirtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 573 of file plotter.cpp.

576{
577 if( aTraceMode == FILLED )
578 {
579 Arc( centre, aStartAngle, aEndAngle, aRadius, FILL_T::NO_FILL, aWidth );
580 }
581 else
582 {
584 Arc( centre, aStartAngle, aEndAngle, aRadius - ( aWidth - m_currentPenWidth ) / 2,
585 FILL_T::NO_FILL, -1 );
586 Arc( centre, aStartAngle, aEndAngle, aRadius + ( aWidth - m_currentPenWidth ) / 2,
587 FILL_T::NO_FILL, -1 );
588 }
589}

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

◆ ThickArc() [3/3]

void PLOTTER::ThickArc ( const VECTOR2I aCentre,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
virtualinherited

Reimplemented in GERBER_PLOTTER.

Definition at line 592 of file plotter.cpp.

595{
596 if( aTraceMode == FILLED )
597 {
598 Arc( aCentre, aStart, aEnd, FILL_T::NO_FILL, aWidth, GetPlotterArcHighDef() );
599 }
600 else
601 {
603 int radius = ( aStart - aCentre ).EuclideanNorm();
604
605 int new_radius = radius - ( aWidth - m_currentPenWidth ) / 2;
606 VECTOR2I start = ( aStart - aCentre ).Resize( new_radius ) + aCentre;
607 VECTOR2I end = ( aEnd - aCentre ).Resize( new_radius ) + aCentre;
608
609 Arc( aCentre, start, end, FILL_T::NO_FILL, -1, GetPlotterArcHighDef() );
610
611 new_radius = radius + ( aWidth - m_currentPenWidth ) / 2;
612 start = ( aStart - aCentre ).Resize( new_radius ) + aCentre;
613 end = ( aEnd - aCentre ).Resize( new_radius ) + aCentre;
614
615 Arc( aCentre, start, end, FILL_T::NO_FILL, -1, GetPlotterArcHighDef() );
616 }
617}

References PLOTTER::Arc(), EuclideanNorm(), FILLED, PLOTTER::GetPlotterArcHighDef(), PLOTTER::m_currentPenWidth, NO_FILL, and PLOTTER::SetCurrentLineWidth().

Referenced by BRDITEMS_PLOTTER::PlotFootprintShape(), BRDITEMS_PLOTTER::PlotPcbShape(), PlotStandardLayer(), and PLOTTER::ThickArc().

◆ ThickCircle()

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

Reimplemented in GERBER_PLOTTER.

Definition at line 652 of file plotter.cpp.

654{
655 if( tracemode == FILLED )
656 {
657 Circle( pos, diametre, FILL_T::NO_FILL, width );
658 }
659 else
660 {
662 Circle( pos, diametre - width + m_currentPenWidth, FILL_T::NO_FILL, -1 );
663 Circle( pos, diametre + width - m_currentPenWidth, FILL_T::NO_FILL, -1 );
664 }
665}

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

Referenced by BRDITEMS_PLOTTER::PlotFootprintShape(), and BRDITEMS_PLOTTER::PlotPcbShape().

◆ ThickRect()

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

Reimplemented in GERBER_PLOTTER.

Definition at line 628 of file plotter.cpp.

630{
631 if( tracemode == FILLED )
632 {
633 Rect( p1, p2, FILL_T::NO_FILL, width );
634 }
635 else
636 {
638 VECTOR2I offsetp1( p1.x - ( width - m_currentPenWidth ) / 2,
639 p1.y - (width - m_currentPenWidth) / 2 );
640 VECTOR2I offsetp2( p2.x + ( width - m_currentPenWidth ) / 2,
641 p2.y + (width - m_currentPenWidth) / 2 );
642 Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
643 offsetp1.x += ( width - m_currentPenWidth );
644 offsetp1.y += ( width - m_currentPenWidth );
645 offsetp2.x -= ( width - m_currentPenWidth );
646 offsetp2.y -= ( width - m_currentPenWidth );
647 Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
648 }
649}

References FILLED, PLOTTER::m_currentPenWidth, NO_FILL, PLOTTER::Rect(), PLOTTER::SetCurrentLineWidth(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ThickSegment()

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

Reimplemented from PLOTTER.

Definition at line 599 of file DXF_plotter.cpp.

601{
602 if( aPlotMode == SKETCH )
603 {
604 std::vector<VECTOR2I> cornerList;
605 SHAPE_POLY_SET outlineBuffer;
606 TransformOvalToPolygon( outlineBuffer, aStart, aEnd, aWidth, GetPlotterArcHighDef(),
607 ERROR_INSIDE );
608 const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline( 0 );
609
610 cornerList.reserve( path.PointCount() );
611
612 for( int jj = 0; jj < path.PointCount(); jj++ )
613 cornerList.emplace_back( path.CPoint( jj ).x, path.CPoint( jj ).y );
614
615 // Ensure the polygon is closed
616 if( cornerList[0] != cornerList[cornerList.size() - 1] )
617 cornerList.push_back( cornerList[0] );
618
619 PlotPoly( cornerList, FILL_T::NO_FILL );
620 }
621 else
622 {
623 MoveTo( aStart );
624 FinishTo( aEnd );
625 }
626}
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
@ SKETCH
Definition: outline_mode.h:26

References SHAPE_POLY_SET::COutline(), ERROR_INSIDE, PLOTTER::FinishTo(), PLOTTER::GetPlotterArcHighDef(), PLOTTER::MoveTo(), NO_FILL, path, PlotPoly(), SKETCH, and TransformOvalToPolygon().

Referenced by PlotPoly().

◆ userToDeviceCoordinates()

VECTOR2D PLOTTER::userToDeviceCoordinates ( const VECTOR2I aCoordinate)
protectedvirtualinherited

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

Also convert from a VECTOR2I to VECTOR2D, since some output engines needs floating point coordinates.

Definition at line 90 of file plotter.cpp.

91{
92 VECTOR2I pos = aCoordinate - m_plotOffset;
93
94 double x = pos.x * m_plotScale;
95 double y = ( m_paperSize.y - pos.y * m_plotScale );
96
97 if( m_plotMirror )
98 {
100 x = ( m_paperSize.x - pos.x * m_plotScale );
101 else
102 y = pos.y * m_plotScale;
103 }
104
105 if( m_yaxisReversed )
106 y = m_paperSize.y - y;
107
110
111 return VECTOR2D( x, y );
112}
bool m_mirrorIsHorizontal
Definition: plotter.h:629
bool m_yaxisReversed
Definition: plotter.h:630
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617

References PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_mirrorIsHorizontal, PLOTTER::m_paperSize, PLOTTER::m_plotMirror, PLOTTER::m_plotOffset, PLOTTER::m_plotScale, PLOTTER::m_yaxisReversed, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Arc(), HPGL_PLOTTER::Arc(), SVG_PLOTTER::Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), SVG_PLOTTER::BezierCurve(), HPGL_PLOTTER::Circle(), Circle(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), SVG_PLOTTER::Circle(), PSLIKE_PLOTTER::computeTextParameters(), GERBER_PLOTTER::FlashPadChamferRoundRect(), HPGL_PLOTTER::FlashPadCircle(), GERBER_PLOTTER::FlashPadCircle(), GERBER_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadOval(), GERBER_PLOTTER::FlashPadRect(), GERBER_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashRegularPolygon(), PenTo(), GERBER_PLOTTER::PenTo(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), GERBER_PLOTTER::plotArc(), PS_PLOTTER::PlotImage(), PDF_PLOTTER::PlotImage(), HPGL_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), PDF_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), HPGL_PLOTTER::Rect(), PS_PLOTTER::Rect(), PDF_PLOTTER::Rect(), SVG_PLOTTER::Rect(), Text(), PS_PLOTTER::Text(), and SVG_PLOTTER::Text().

◆ userToDeviceSize() [1/2]

◆ userToDeviceSize() [2/2]

double PLOTTER::userToDeviceSize ( double  size) const
protectedvirtualinherited

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

Definition at line 122 of file plotter.cpp.

123{
124 return size * m_plotScale * m_iuPerDeviceUnit;
125}

References PLOTTER::m_iuPerDeviceUnit, and PLOTTER::m_plotScale.

Member Data Documentation

◆ DO_NOT_SET_LINE_WIDTH

◆ m_colorMode

bool PLOTTER::m_colorMode
protectedinherited

◆ m_creator

wxString PLOTTER::m_creator
protectedinherited

◆ m_currentColor

COLOR4D DXF_PLOTTER::m_currentColor
protected

Definition at line 214 of file plotter_dxf.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 215 of file plotter_dxf.h.

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

◆ m_currentPenWidth

◆ m_filename

wxString PLOTTER::m_filename
protectedinherited

◆ m_headerExtraLines

wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

◆ m_iuPerDeviceUnit

◆ m_IUsPerDecimil

◆ m_measurementDirective

unsigned int DXF_PLOTTER::m_measurementDirective
protected

Definition at line 219 of file plotter_dxf.h.

Referenced by GetMeasurementDirective(), and SetUnits().

◆ m_mirrorIsHorizontal

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited

Definition at line 629 of file plotter.h.

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

◆ m_negativeMode

bool PLOTTER::m_negativeMode
protectedinherited

Definition at line 637 of file plotter.h.

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

◆ m_outputFile

FILE* PLOTTER::m_outputFile
protectedinherited

Output file.

Definition at line 633 of file plotter.h.

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

◆ m_pageInfo

◆ m_paperSize

◆ m_penLastpos

VECTOR2I PLOTTER::m_penLastpos
protectedinherited

◆ m_penState

char PLOTTER::m_penState
protectedinherited

◆ m_plotMirror

◆ m_plotOffset

◆ m_plotScale

◆ m_plotUnits

DXF_UNITS DXF_PLOTTER::m_plotUnits
protected

Definition at line 217 of file plotter_dxf.h.

Referenced by GetUnits(), and SetUnits().

◆ m_renderSettings

◆ m_textAsLines

bool DXF_PLOTTER::m_textAsLines
protected

Definition at line 213 of file plotter_dxf.h.

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

◆ m_title

wxString PLOTTER::m_title
protectedinherited

Definition at line 644 of file plotter.h.

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

◆ m_unitScalingFactor

double DXF_PLOTTER::m_unitScalingFactor
protected

Definition at line 218 of file plotter_dxf.h.

Referenced by GetUnitScaling(), and SetUnits().

◆ m_yaxisReversed

bool PLOTTER::m_yaxisReversed
protectedinherited

◆ MARKER_COUNT

const unsigned PLOTTER::MARKER_COUNT = 58
staticinherited

Draw a marker (used for the drill map).

Definition at line 466 of file plotter.h.

Referenced by PLOTTER::Marker().

◆ USE_DEFAULT_LINE_WIDTH


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