KiCad PCB EDA Suite
SVG_PLOTTER Class Reference

#include <plotters_pslike.h>

Inheritance diagram for SVG_PLOTTER:
PSLIKE_PLOTTER PLOTTER

Public Member Functions

 SVG_PLOTTER ()
 
virtual PLOT_FORMAT GetPlotterType () const override
 Returns the effective plot engine in use. More...
 
virtual void SetColor (const COLOR4D &color) override
 The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values, the subclass emits the operator to actually do it. More...
 
virtual bool StartPlot (const wxString &aPageNumber) override
 Create SVG file header. More...
 
virtual bool EndPlot () override
 
virtual void SetCurrentLineWidth (int width, void *aData=nullptr) override
 Set the current line width (in IUs) for the next plot. More...
 
virtual void SetDash (int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
 SVG supports dashed lines. More...
 
virtual void SetViewport (const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
 Set the plot offset and scaling for the current plot. More...
 
virtual void Rect (const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void Circle (const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void BezierCurve (const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH) override
 Generic fallback: Cubic Bezier curve rendered as a polyline In KiCad the bezier curves have 4 control points: start ctrl1 ctrl2 end. More...
 
virtual void PlotPoly (const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
 Draw a polygon ( filled or not ). More...
 
virtual void PlotImage (const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
 PostScript-likes at the moment are the only plot engines supporting bitmaps. More...
 
virtual void PenTo (const VECTOR2I &pos, char plume) override
 Moveto/lineto primitive, moves the 'pen' to the specified direction. More...
 
virtual void SetSvgCoordinatesFormat (unsigned aPrecision) override
 Select SVG coordinate precision (number of digits needed for 1 mm ) (SVG plotter uses always metric unit) Should be called only after SetViewport() is called. More...
 
virtual void StartBlock (void *aData) override
 Calling this function allows one to define the beginning of a group of drawing items (used in SVG format to separate components) More...
 
virtual void EndBlock (void *aData) override
 Calling this function allows one to define the end of a group of drawing items the group is started by StartBlock() 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...
 
virtual void SetTextMode (PLOT_TEXT_MODE mode) override
 PS and PDF fully implement native text (for the Latin-1 subset) More...
 
void SetScaleAdjust (double scaleX, double scaleY)
 Set the 'fine' scaling for the postscript engine. More...
 
virtual void FlashPadCircle (const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadOval (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadRect (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
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
 Flash a trapezoidal pad. 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 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...
 
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 ThickSegment (const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
 
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)
 

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 emitSetRGBColor (double r, double g, double b, double a) override
 Initialize m_pen_rgb_color from reduced values r, g ,b ( reduced values are 0.0 to 1.0 ) More...
 
void setSVGPlotStyle (int aLineWidth, bool aIsGroup=true, const std::string &aExtraStyle={})
 Output the string which define pen and brush color, shape, transparency. More...
 
void setFillMode (FILL_T fill)
 Prepare parameters for setSVGPlotStyle() More...
 
void computeTextParameters (const VECTOR2I &aPos, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, bool aMirror, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, double *wideningFactor, double *ctm_a, double *ctm_b, double *ctm_c, double *ctm_d, double *ctm_e, double *ctm_f, double *heightFactor)
 This is the core for postscript/PDF text alignment. More...
 
void postscriptOverlinePositions (const wxString &aText, int aXSize, bool aItalic, bool aBold, std::vector< int > *pos_pairs)
 Computes the x coordinates for the overlining in a string of text. More...
 
virtual std::string encodeStringForPlotter (const wxString &aUnicode)
 convert a wxString unicode string to a char string compatible with the accepted string plotter format (convert special chars and non ascii7 chars) More...
 
int returnPostscriptTextWidth (const wxString &aText, int aXSize, bool aItalic, bool aBold)
 Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i.e. 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

FILL_T m_fillMode
 
long m_pen_rgb_color
 
long m_brush_rgb_color
 
double m_brush_alpha
 
bool m_graphics_changed
 
PLOT_DASH_TYPE m_dashed
 
bool m_useInch
 
unsigned m_precision
 
double plotScaleAdjX
 Fine user scale adjust ( = 1.0 if no correction) More...
 
double plotScaleAdjY
 
PLOT_TEXT_MODE m_textMode
 How to draw text. More...
 
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
 

Static Protected Attributes

static const double postscriptTextAscent = 0.718
 Height of the postscript font (from the AFM) More...
 

Detailed Description

Definition at line 506 of file plotters_pslike.h.

Constructor & Destructor Documentation

◆ SVG_PLOTTER()

SVG_PLOTTER::SVG_PLOTTER ( )

Definition at line 163 of file SVG_plotter.cpp.

164{
165 m_graphics_changed = true;
167 m_fillMode = FILL_T::NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
168 m_pen_rgb_color = 0; // current color value (black)
169 m_brush_rgb_color = 0; // current color value (black)
170 m_brush_alpha = 1.0;
172 m_useInch = false; // millimeters are always the svg unit
173 m_precision = 4; // default: 4 digits in mantissa.
174}
virtual void SetTextMode(PLOT_TEXT_MODE mode) override
PS and PDF fully implement native text (for the Latin-1 subset)
unsigned m_precision
double m_brush_alpha
long m_brush_rgb_color
bool m_graphics_changed
PLOT_DASH_TYPE m_dashed

References m_brush_alpha, m_brush_rgb_color, m_dashed, m_fillMode, m_graphics_changed, m_pen_rgb_color, m_precision, m_useInch, NO_FILL, PSLIKE_PLOTTER::SetTextMode(), SOLID, and STROKE.

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 SVG_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 446 of file SVG_plotter.cpp.

448{
449 /* Draws an arc of a circle, centered on (xc,yc), with starting point (x1, y1) and ending
450 * at (x2, y2). The current pen is used for the outline and the current brush for filling
451 * the shape.
452 *
453 * The arc is drawn in an anticlockwise direction from the start point to the end point.
454 */
455
456 if( aRadius <= 0 )
457 {
458 Circle( aCenter, aWidth, FILL_T::FILLED_SHAPE, 0 );
459 return;
460 }
461
462 EDA_ANGLE startAngle( aStartAngle );
463 EDA_ANGLE endAngle( aEndAngle );
464
465 if( startAngle > endAngle )
466 std::swap( startAngle, endAngle );
467
468 // Calculate start point.
469 VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
470 double radius_device = userToDeviceSize( aRadius );
471
472 if( m_plotMirror )
473 {
475 {
476 std::swap( startAngle, endAngle );
477 startAngle = ANGLE_180 - startAngle;
478 endAngle = ANGLE_180 - endAngle;
479 }
480 else
481 {
482 startAngle = -startAngle;
483 endAngle = -endAngle;
484 }
485 }
486
487 VECTOR2D start;
488 start.x = radius_device;
489 RotatePoint( start, startAngle );
490 VECTOR2D end;
491 end.x = radius_device;
492 RotatePoint( end, endAngle );
493 start += centre_device;
494 end += centre_device;
495
496 double theta1 = startAngle.AsRadians();
497
498 if( theta1 < 0 )
499 theta1 = theta1 + M_PI * 2;
500
501 double theta2 = endAngle.AsRadians();
502
503 if( theta2 < 0 )
504 theta2 = theta2 + M_PI * 2;
505
506 if( theta2 < theta1 )
507 theta2 = theta2 + M_PI * 2;
508
509 int flg_arc = 0; // flag for large or small arc. 0 means less than 180 degrees
510
511 if( fabs( theta2 - theta1 ) > M_PI )
512 flg_arc = 1;
513
514 int flg_sweep = 0; // flag for sweep always 0
515
516 // Draw a single arc: an arc is one of 3 curve commands (2 other are 2 bezier curves)
517 // params are start point, radius1, radius2, X axe rotation,
518 // flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
519 // sweep arc ( 0 = CCW, 1 = CW),
520 // end point
521 if( aFill != FILL_T::NO_FILL )
522 {
523 // Filled arcs (in Eeschema) consist of the pie wedge and a stroke only on the arc
524 // This needs to be drawn in two steps.
525 setFillMode( aFill );
527
528 fprintf( m_outputFile, "<path d=\"M%.*f %.*f A%.*f %.*f 0.0 %d %d %.*f %.*f L %.*f %.*f Z\" />\n",
529 m_precision, start.x, m_precision, start.y,
530 m_precision, radius_device, m_precision, radius_device,
531 flg_arc, flg_sweep,
532 m_precision, end.x, m_precision, end.y,
533 m_precision, centre_device.x, m_precision, centre_device.y );
534 }
535
537 SetCurrentLineWidth( aWidth );
538 fprintf( m_outputFile, "<path d=\"M%.*f %.*f A%.*f %.*f 0.0 %d %d %.*f %.*f\" />\n",
539 m_precision, start.x, m_precision, start.y,
540 m_precision, radius_device, m_precision, radius_device,
541 flg_arc, flg_sweep,
542 m_precision, end.x, m_precision, end.y );
543}
bool m_mirrorIsHorizontal
Definition: plotter.h:629
bool m_plotMirror
Definition: plotter.h:627
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
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
void setFillMode(FILL_T fill)
Prepare parameters for setSVGPlotStyle()
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:416
@ FILLED_SHAPE
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References ANGLE_180, EDA_ANGLE::AsRadians(), Circle(), FILLED_SHAPE, PLOTTER::m_mirrorIsHorizontal, PLOTTER::m_outputFile, PLOTTER::m_plotMirror, m_precision, NO_FILL, RotatePoint(), SetCurrentLineWidth(), setFillMode(), 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 SVG_PLOTTER::BezierCurve ( const VECTOR2I aStart,
const VECTOR2I aControl1,
const VECTOR2I aControl2,
const VECTOR2I aEnd,
int  aTolerance,
int  aLineThickness = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

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

Reimplemented from PLOTTER.

Definition at line 546 of file SVG_plotter.cpp.

549{
550#if 1
552 SetCurrentLineWidth( aLineThickness );
553
554 VECTOR2D start = userToDeviceCoordinates( aStart );
555 VECTOR2D ctrl1 = userToDeviceCoordinates( aControl1 );
556 VECTOR2D ctrl2 = userToDeviceCoordinates( aControl2 );
557 VECTOR2D end = userToDeviceCoordinates( aEnd );
558
559 // Generate a cubic curve: start point and 3 other control points.
560 fprintf( m_outputFile, "<path d=\"M%.*f,%.*f C%.*f,%.*f %.*f,%.*f %.*f,%.*f\" />\n",
561 m_precision, start.x, m_precision, start.y,
562 m_precision, ctrl1.x, m_precision, ctrl1.y,
563 m_precision, ctrl2.x, m_precision, ctrl2.y,
564 m_precision, end.x, m_precision, end.y );
565#else
566 PLOTTER::BezierCurve( aStart, aControl1, aControl2, aEnd, aTolerance, aLineThickness );
567#endif
568}
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...
Definition: plotter.cpp:224

References PLOTTER::BezierCurve(), PLOTTER::m_outputFile, m_precision, NO_FILL, SetCurrentLineWidth(), setFillMode(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ 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 SVG_PLOTTER::Circle ( const VECTOR2I pos,
int  diametre,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 423 of file SVG_plotter.cpp.

424{
425 VECTOR2D pos_dev = userToDeviceCoordinates( pos );
426 double radius = userToDeviceSize( diametre / 2.0 );
427
428 setFillMode( fill );
429 SetCurrentLineWidth( width );
430
431 // If diameter is less than width, switch to filled mode
432 if( fill == FILL_T::NO_FILL && diametre < width )
433 {
436
437 radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
438 }
439
440 fprintf( m_outputFile,
441 "<circle cx=\"%.*f\" cy=\"%.*f\" r=\"%.*f\" /> \n",
442 m_precision, pos_dev.x, m_precision, pos_dev.y, m_precision, radius );
443}

References FILLED_SHAPE, PLOTTER::m_outputFile, m_precision, NO_FILL, SetCurrentLineWidth(), setFillMode(), PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Arc().

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

◆ computeTextParameters()

void PSLIKE_PLOTTER::computeTextParameters ( const VECTOR2I aPos,
const wxString &  aText,
const EDA_ANGLE aOrient,
const VECTOR2I aSize,
bool  aMirror,
enum GR_TEXT_H_ALIGN_T  aH_justify,
enum GR_TEXT_V_ALIGN_T  aV_justify,
int  aWidth,
bool  aItalic,
bool  aBold,
double *  wideningFactor,
double *  ctm_a,
double *  ctm_b,
double *  ctm_c,
double *  ctm_d,
double *  ctm_e,
double *  ctm_f,
double *  heightFactor 
)
protectedinherited

This is the core for postscript/PDF text alignment.

It computes the transformation matrix to generate a user space system aligned with the text. Even the PS uses the concat operator to simplify PDF generation (concat is everything PDF has to modify the CTM. Lots of parameters, both in and out.

Definition at line 401 of file PS_plotter.cpp.

419{
420 // Compute the starting position (compensated for alignment)
421 VECTOR2I start_pos = aPos;
422
423 // This is an approximation of the text bounds (in IUs)
424 int tw = returnPostscriptTextWidth( aText, aSize.x, aItalic, aWidth );
425 int th = aSize.y;
426 int dx, dy;
427
428 switch( aH_justify )
429 {
430 case GR_TEXT_H_ALIGN_CENTER: dx = -tw / 2; break;
431 case GR_TEXT_H_ALIGN_RIGHT: dx = -tw; break;
432 case GR_TEXT_H_ALIGN_LEFT: dx = 0; break;
433 }
434
435 switch( aV_justify )
436 {
437 case GR_TEXT_V_ALIGN_CENTER: dy = th / 2; break;
438 case GR_TEXT_V_ALIGN_TOP: dy = th; break;
439 case GR_TEXT_V_ALIGN_BOTTOM: dy = 0; break;
440 }
441
442 RotatePoint( &dx, &dy, aOrient );
443 RotatePoint( &tw, &th, aOrient );
444 start_pos.x += dx;
445 start_pos.y += dy;
446 VECTOR2D pos_dev = userToDeviceCoordinates( start_pos );
447 VECTOR2D sz_dev = userToDeviceSize( aSize );
448
449 // Now returns the final values... the widening factor
450 *wideningFactor = sz_dev.x / sz_dev.y;
451
452 // Mirrored texts must be plotted as mirrored!
453 if( m_plotMirror )
454 *wideningFactor = -*wideningFactor;
455
456 // The CTM transformation matrix
457 double alpha = m_plotMirror ? aOrient.Invert().AsRadians() : aOrient.AsRadians();
458 double sinalpha = sin( alpha );
459 double cosalpha = cos( alpha );
460
461 *ctm_a = cosalpha;
462 *ctm_b = sinalpha;
463 *ctm_c = -sinalpha;
464 *ctm_d = cosalpha;
465 *ctm_e = pos_dev.x;
466 *ctm_f = pos_dev.y;
467
468 // This is because the letters are less than 1 unit high
469 *heightFactor = sz_dev.y / postscriptTextAscent;
470}
EDA_ANGLE Invert() const
Definition: eda_angle.h:201
double AsRadians() const
Definition: eda_angle.h:153
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i....
Definition: PS_plotter.cpp:329
@ 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::AsRadians(), 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, EDA_ANGLE::Invert(), PLOTTER::m_plotMirror, PSLIKE_PLOTTER::postscriptTextAscent, PSLIKE_PLOTTER::returnPostscriptTextWidth(), RotatePoint(), PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PDF_PLOTTER::Text().

◆ emitSetRGBColor()

void SVG_PLOTTER::emitSetRGBColor ( double  r,
double  g,
double  b,
double  a 
)
overrideprotectedvirtual

Initialize m_pen_rgb_color from reduced values r, g ,b ( reduced values are 0.0 to 1.0 )

Implements PSLIKE_PLOTTER.

Definition at line 353 of file SVG_plotter.cpp.

354{
355 int red = (int) ( 255.0 * r );
356 int green = (int) ( 255.0 * g );
357 int blue = (int) ( 255.0 * b );
358 long rgb_color = (red << 16) | (green << 8) | blue;
359
360 if( m_pen_rgb_color != rgb_color )
361 {
362 m_graphics_changed = true;
363 m_pen_rgb_color = rgb_color;
364
365 // Currently, use the same color for brush and pen (i.e. to draw and fill a contour).
366 m_brush_rgb_color = rgb_color;
367 m_brush_alpha = a;
368 }
369}
E_SERIE r
Definition: eserie.cpp:41

References m_brush_alpha, m_brush_rgb_color, m_graphics_changed, m_pen_rgb_color, r, and red.

◆ encodeStringForPlotter()

std::string PSLIKE_PLOTTER::encodeStringForPlotter ( const wxString &  aUnicode)
protectedvirtualinherited

convert a wxString unicode string to a char string compatible with the accepted string plotter format (convert special chars and non ascii7 chars)

Reimplemented in PDF_PLOTTER.

Definition at line 289 of file PS_plotter.cpp.

290{
291 // Write on a std::string a string escaped for postscript/PDF
292 std::string converted;
293
294 converted += '(';
295
296 for( unsigned i = 0; i < aUnicode.Len(); i++ )
297 {
298 // Laziness made me use stdio buffering yet another time...
299 wchar_t ch = aUnicode[i];
300
301 if( ch < 256 )
302 {
303 switch (ch)
304 {
305 // The ~ shouldn't reach the outside
306 case '~':
307 break;
308
309 // These characters must be escaped
310 case '(':
311 case ')':
312 case '\\':
313 converted += '\\';
315
316 default:
317 converted += ch;
318 break;
319 }
320 }
321 }
322
323 converted += ')';
324
325 return converted;
326}
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83

References KI_FALLTHROUGH.

Referenced by PS_PLOTTER::StartPlot(), and PS_PLOTTER::Text().

◆ EndBlock()

void SVG_PLOTTER::EndBlock ( void *  aData)
overridevirtual

Calling this function allows one to define the end of a group of drawing items the group is started by StartBlock()

Parameters
aDatashould be null

Reimplemented from PLOTTER.

Definition at line 345 of file SVG_plotter.cpp.

346{
347 fprintf( m_outputFile, "</g>\n" );
348
349 m_graphics_changed = true;
350}

References m_graphics_changed, and PLOTTER::m_outputFile.

◆ EndPlot()

bool SVG_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 765 of file SVG_plotter.cpp.

766{
767 fputs( "</g> \n</svg>\n", m_outputFile );
768 fclose( m_outputFile );
769 m_outputFile = nullptr;
770
771 return true;
772}

References PLOTTER::m_outputFile.

Referenced by PCB_PLOT_SVG::Plot(), SCH_PLOTTER::plotOneSheetSVG(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ 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
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
@ 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 PSLIKE_PLOTTER::FlashPadCircle ( const VECTOR2I aPadPos,
int  aDiameter,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited
Parameters
aPadPosPosition of the shape (center of the rectangle.
aDiameteris the diameter of round pad.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDatais an auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 120 of file PS_plotter.cpp.

122{
123 if( aTraceMode == FILLED )
124 {
125 Circle( aPadPos, aDiameter, FILL_T::FILLED_SHAPE, 0 );
126 }
127 else // Plot a ring:
128 {
130 Circle( aPadPos, aDiameter, FILL_T::NO_FILL, GetCurrentLineWidth() );
131 }
132
134}
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:114
virtual int GetCurrentLineWidth() const
Definition: plotter.h:153

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

◆ FlashPadCustom()

void PSLIKE_PLOTTER::FlashPadCustom ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
SHAPE_POLY_SET aPolygons,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited
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 214 of file PS_plotter.cpp.

217{
218 VECTOR2I size( aSize );
219
220 if( aTraceMode == FILLED )
221 {
223 }
224 else
225 {
227 }
228
229
230 std::vector<VECTOR2I> cornerList;
231
232 for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
233 {
234 SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
235 cornerList.clear();
236
237 for( int ii = 0; ii < poly.PointCount(); ++ii )
238 cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
239
240 // Close polygon
241 cornerList.push_back( cornerList[0] );
242
243 PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
245 }
246}
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 ).
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.

References SHAPE_LINE_CHAIN::CPoint(), FILLED, FILLED_SHAPE, PLOTTER::GetCurrentLineWidth(), NO_FILL, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), PLOTTER::PlotPoly(), SHAPE_LINE_CHAIN::PointCount(), PLOTTER::SetCurrentLineWidth(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadOval()

void PSLIKE_PLOTTER::FlashPadOval ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited
Parameters
aPadPosPosition of the shape (center of the rectangle.
aSizeis the size of oblong shape.
aPadOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 90 of file PS_plotter.cpp.

93{
94 wxASSERT( m_outputFile );
95
96 VECTOR2I size( aSize );
97 EDA_ANGLE orient( aPadOrient );
98
99 // The pad is reduced to an oval by dy > dx
100 if( size.x > size.y )
101 {
102 std::swap( size.x, size.y );
103 orient += ANGLE_90;
104 }
105
106 int delta = size.y - size.x;
107 VECTOR2I a( 0, -delta / 2 );
108 VECTOR2I b( 0, delta / 2 );
109
110 RotatePoint( a, orient );
111 RotatePoint( b, orient );
112
113 if( aTraceMode == FILLED )
114 ThickSegment( a + aPadPos, b + aPadPos, size.x, aTraceMode, nullptr );
115 else
116 sketchOval( aPadPos, size, orient, -1 );
117}
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:549
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
constexpr int delta

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

◆ FlashPadRect()

void PSLIKE_PLOTTER::FlashPadRect ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited
Parameters
aPadPosPosition of the shape (center of the rectangle).
aSizeis the size of rounded rect.
aPadOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 137 of file PS_plotter.cpp.

140{
141 std::vector<VECTOR2I> cornerList;
142 VECTOR2I size( aSize );
143 cornerList.reserve( 4 );
144
145 if( aTraceMode == FILLED )
147 else
149
150 int dx = size.x / 2;
151 int dy = size.y / 2;
152
153 VECTOR2I corner;
154 corner.x = aPadPos.x - dx;
155 corner.y = aPadPos.y + dy;
156 cornerList.push_back( corner );
157 corner.x = aPadPos.x - dx;
158 corner.y = aPadPos.y - dy;
159 cornerList.push_back( corner );
160 corner.x = aPadPos.x + dx;
161 corner.y = aPadPos.y - dy;
162 cornerList.push_back( corner );
163 corner.x = aPadPos.x + dx;
164 corner.y = aPadPos.y + dy,
165 cornerList.push_back( corner );
166
167 for( unsigned ii = 0; ii < cornerList.size(); ii++ )
168 RotatePoint( cornerList[ii], aPadPos, aPadOrient );
169
170 cornerList.push_back( cornerList[0] );
171
172 PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
174}

References FILLED, FILLED_SHAPE, PLOTTER::GetCurrentLineWidth(), NO_FILL, PLOTTER::PlotPoly(), RotatePoint(), PLOTTER::SetCurrentLineWidth(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadRoundRect()

void PSLIKE_PLOTTER::FlashPadRoundRect ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
int  aCornerRadius,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited
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 177 of file PS_plotter.cpp.

180{
181 VECTOR2I size( aSize );
182
183 if( aTraceMode == FILLED )
184 {
186 }
187 else
188 {
190 }
191
192
193 SHAPE_POLY_SET outline;
194 TransformRoundChamferedRectToPolygon( outline, aPadPos, size, aOrient, aCornerRadius, 0.0, 0,
196
197 std::vector<VECTOR2I> cornerList;
198
199 // TransformRoundRectToPolygon creates only one convex polygon
200 SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
201 cornerList.reserve( poly.PointCount() );
202
203 for( int ii = 0; ii < poly.PointCount(); ++ii )
204 cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
205
206 // Close polygon
207 cornerList.push_back( cornerList[0] );
208
209 PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
211}
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, FILLED, FILLED_SHAPE, PLOTTER::GetCurrentLineWidth(), PLOTTER::GetPlotterArcHighDef(), NO_FILL, SHAPE_POLY_SET::Outline(), PLOTTER::PlotPoly(), SHAPE_LINE_CHAIN::PointCount(), PLOTTER::SetCurrentLineWidth(), TransformRoundChamferedRectToPolygon(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadTrapez()

void PSLIKE_PLOTTER::FlashPadTrapez ( const VECTOR2I aPadPos,
const VECTOR2I aCorners,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtualinherited

Flash a trapezoidal pad.

Parameters
aPadPosis the the position of the shape.
aCornersis the list of 4 corners positions, relative to the shape position, pad orientation 0.
aPadOrientis the rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 249 of file PS_plotter.cpp.

252{
253 static std::vector<VECTOR2I> cornerList;
254 cornerList.clear();
255
256 for( int ii = 0; ii < 4; ii++ )
257 cornerList.push_back( aCorners[ii] );
258
259 if( aTraceMode == FILLED )
260 {
262 }
263 else
264 {
266 }
267
268 for( int ii = 0; ii < 4; ii++ )
269 {
270 RotatePoint( cornerList[ii], aPadOrient );
271 cornerList[ii] += aPadPos;
272 }
273
274 cornerList.push_back( cornerList[0] );
275 PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
277}

References FILLED, FILLED_SHAPE, PLOTTER::GetCurrentLineWidth(), NO_FILL, PLOTTER::PlotPoly(), RotatePoint(), PLOTTER::SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

◆ FlashRegularPolygon()

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

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 280 of file PS_plotter.cpp.

283{
284 // Do nothing
285 wxASSERT( 0 );
286}

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

◆ GetDashMarkLenIU()

double PLOTTER::GetDashMarkLenIU ( int  aLineWidth) const
protectedinherited

◆ GetDefaultFileExtension()

static wxString SVG_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 511 of file plotters_pslike.h.

512 {
513 return wxString( wxT( "svg" ) );
514 }

Referenced by SCH_PLOTTER::createSVGFiles(), 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().

◆ 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 SVG_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 516 of file plotters_pslike.h.

517 {
518 return PLOT_FORMAT::SVG;
519 }

References SVG.

◆ 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}
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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}

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}

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(), DXF_PLOTTER::PlotPoly(), HPGL_PLOTTER::PlotPoly(), HPGL_PLOTTER::Rect(), and PLOTTER::Text().

◆ PenTo()

void SVG_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 662 of file SVG_plotter.cpp.

663{
664 if( plume == 'Z' )
665 {
666 if( m_penState != 'Z' )
667 {
668 fputs( "\" />\n", m_outputFile );
669 m_penState = 'Z';
670 m_penLastpos.x = -1;
671 m_penLastpos.y = -1;
672 }
673
674 return;
675 }
676
677 if( m_penState == 'Z' ) // here plume = 'D' or 'U'
678 {
679 VECTOR2D pos_dev = userToDeviceCoordinates( pos );
680
681 // Ensure we do not use a fill mode when moving the pen,
682 // in SVG mode (i;e. we are plotting only basic lines, not a filled area
684 {
687 }
688
689 fprintf( m_outputFile, "<path d=\"M%.*f %.*f\n",
690 m_precision, pos_dev.x,
691 m_precision, pos_dev.y );
692 }
693 else if( m_penState != plume || pos != m_penLastpos )
694 {
695 VECTOR2D pos_dev = userToDeviceCoordinates( pos );
696
697 fprintf( m_outputFile, "L%.*f %.*f\n",
698 m_precision, pos_dev.x,
699 m_precision, pos_dev.y );
700 }
701
702 m_penState = plume;
703 m_penLastpos = pos;
704}
VECTOR2I m_penLastpos
Definition: plotter.h:640
char m_penState
Definition: plotter.h:639
void setSVGPlotStyle(int aLineWidth, bool aIsGroup=true, const std::string &aExtraStyle={})
Output the string which define pen and brush color, shape, transparency.

References PLOTTER::GetCurrentLineWidth(), m_fillMode, PLOTTER::m_outputFile, PLOTTER::m_penLastpos, PLOTTER::m_penState, m_precision, NO_FILL, setFillMode(), setSVGPlotStyle(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ PlotImage()

void SVG_PLOTTER::PlotImage ( const wxImage &  aImage,
const VECTOR2I aPos,
double  aScaleFactor 
)
overridevirtual

PostScript-likes at the moment are the only plot engines supporting bitmaps.

Reimplemented from PLOTTER.

Definition at line 616 of file SVG_plotter.cpp.

617{
618 VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
619
620 // Requested size (in IUs)
621 VECTOR2D drawsize( aScaleFactor * pix_size.x, aScaleFactor * pix_size.y );
622
623 // calculate the bitmap start position
624 VECTOR2I start( aPos.x - drawsize.x / 2, aPos.y - drawsize.y / 2 );
625
626 // Rectangles having a 0 size value for height or width are just not drawn on Inkscape,
627 // so use a line when happens.
628 if( drawsize.x == 0.0 || drawsize.y == 0.0 ) // Draw a line
629 {
630 PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
631 }
632 else
633 {
634 wxMemoryOutputStream img_stream;
635
636 aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
637 size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize();
638 std::vector<uint8_t> buffer( input_len );
639 std::vector<uint8_t> encoded;
640
641 img_stream.CopyTo( buffer.data(), buffer.size() );
642 base64::encode( buffer, encoded );
643
644 fprintf( m_outputFile,
645 "<image x=\"%f\" y=\"%f\" xlink:href=\"data:image/png;base64,",
646 userToDeviceSize( start.x ), userToDeviceSize( start.y ) );
647
648 for( size_t i = 0; i < encoded.size(); i++ )
649 {
650 fprintf( m_outputFile, "%c", static_cast<char>( encoded[i] ) );
651
652 if( ( i % 64 ) == 63 )
653 fprintf( m_outputFile, "\n" );
654 }
655
656 fprintf( m_outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%.*f\" height=\"%.*f\" />",
657 m_precision, userToDeviceSize( drawsize.x ), m_precision, userToDeviceSize( drawsize.y ) );
658 }
659}
virtual void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor)
Only PostScript plotters can plot bitmaps.
Definition: plotter.cpp:254
void encode(const std::vector< uint8_t > &aInput, std::vector< uint8_t > &aOutput)
Definition: base64.cpp:76

References base64::encode(), PLOTTER::m_outputFile, m_precision, PLOTTER::PlotImage(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ 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 SVG_PLOTTER::PlotPoly ( const std::vector< VECTOR2I > &  aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = nullptr 
)
overridevirtual

Draw a polygon ( filled or not ).

Parameters
aCornerListis the corners list (a std::vector< VECTOR2I >).
aFillis the type of fill.
aWidthis the line width.
aDatais an auxiliary info (mainly for gerber format).

Implements PLOTTER.

Definition at line 571 of file SVG_plotter.cpp.

573{
574 if( aCornerList.size() <= 1 )
575 return;
576
577 setFillMode( aFill );
578 SetCurrentLineWidth( aWidth );
579 fprintf( m_outputFile, "<path ");
580
581 switch( aFill )
582 {
583 case FILL_T::NO_FILL:
584 setSVGPlotStyle( aWidth, false, "fill:none" );
585 break;
586
590 setSVGPlotStyle( aWidth, false, "fill-rule:evenodd;" );
591 break;
592 }
593
594 VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
595 fprintf( m_outputFile, "d=\"M %.*f,%.*f\n", m_precision, pos.x, m_precision, pos.y );
596
597 for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
598 {
599 pos = userToDeviceCoordinates( aCornerList[ii] );
600 fprintf( m_outputFile, "%.*f,%.*f\n", m_precision, pos.x, m_precision, pos.y );
601 }
602
603 // If the corner list ends where it begins, then close the poly
604 if( aCornerList.front() == aCornerList.back() )
605 {
606 fprintf( m_outputFile, "Z\" /> \n" );
607 }
608 else
609 {
610 pos = userToDeviceCoordinates( aCornerList.back() );
611 fprintf( m_outputFile, "%.*f,%.*f\n\" /> \n", m_precision, pos.x, m_precision, pos.y );
612 }
613}
@ FILLED_WITH_COLOR
@ FILLED_WITH_BG_BODYCOLOR

References FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR, FILLED_WITH_COLOR, PLOTTER::m_outputFile, m_precision, NO_FILL, SetCurrentLineWidth(), setFillMode(), setSVGPlotStyle(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ postscriptOverlinePositions()

void PSLIKE_PLOTTER::postscriptOverlinePositions ( const wxString &  aText,
int  aXSize,
bool  aItalic,
bool  aBold,
std::vector< int > *  pos_pairs 
)
protectedinherited

Computes the x coordinates for the overlining in a string of text.

Fills the passed vector with couples of (start, stop) values to be used in the text coordinate system (use computeTextParameters to obtain the parameters to establish such a system)

Definition at line 352 of file PS_plotter.cpp.

355{
356 /* XXX This function is *too* similar to returnPostscriptTextWidth.
357 Consider merging them... */
358 const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
359 : ( aItalic ? hvo_widths : hv_widths );
360 double tally = 0;
361
362 for( unsigned i = 0; i < aText.length(); i++ )
363 {
364 wchar_t AsciiCode = aText[i];
365
366 // Skip the negation marks and untabled points
367 if( AsciiCode != '~' && AsciiCode < 256 )
368 {
369 tally += width_table[AsciiCode];
370 }
371 else
372 {
373 if( AsciiCode == '~' )
374 pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
375 }
376 }
377
378 // Special rule: we have to complete the last bar if the ~ aren't matched
379 if( pos_pairs->size() % 2 == 1 )
380 pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
381}
const double hvbo_widths[256]
Character widths for Helvetica-BoldOblique.
const double hvb_widths[256]
Character widths for Helvetica-Bold.
const double hv_widths[256]
Character widths for Helvetica.
Definition: PS_plotter.cpp:973
const double hvo_widths[256]
Character widths for Helvetica-Oblique.

References hv_widths, hvb_widths, hvbo_widths, hvo_widths, KiROUND(), and PSLIKE_PLOTTER::postscriptTextAscent.

◆ Rect()

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

Implements PLOTTER.

Definition at line 385 of file SVG_plotter.cpp.

386{
387 BOX2I rect( p1, VECTOR2I( p2.x - p1.x, p2.y - p1.y ) );
388 rect.Normalize();
389
390 VECTOR2D org_dev = userToDeviceCoordinates( rect.GetOrigin() );
391 VECTOR2D end_dev = userToDeviceCoordinates( rect.GetEnd() );
392 VECTOR2D size_dev = end_dev - org_dev;
393
394 // Ensure size of rect in device coordinates is > 0
395 // I don't know if this is a SVG issue or a Inkscape issue, but
396 // Inkscape has problems with negative or null values for width and/or height, so avoid them
397 BOX2D rect_dev( org_dev, size_dev );
398 rect_dev.Normalize();
399
400 setFillMode( fill );
401 SetCurrentLineWidth( width );
402
403 // Rectangles having a 0 size value for height or width are just not drawn on Inkscape,
404 // so use a line when happens.
405 if( rect_dev.GetSize().x == 0.0 || rect_dev.GetSize().y == 0.0 ) // Draw a line
406 {
407 fprintf( m_outputFile,
408 "<line x1=\"%.*f\" y1=\"%.*f\" x2=\"%.*f\" y2=\"%.*f\" />\n",
409 m_precision, rect_dev.GetPosition().x, m_precision, rect_dev.GetPosition().y,
410 m_precision, rect_dev.GetEnd().x, m_precision, rect_dev.GetEnd().y );
411 }
412 else
413 {
414 fprintf( m_outputFile,
415 "<rect x=\"%f\" y=\"%f\" width=\"%f\" height=\"%f\" rx=\"%f\" />\n",
416 rect_dev.GetPosition().x, rect_dev.GetPosition().y,
417 rect_dev.GetSize().x, rect_dev.GetSize().y,
418 0.0 /* radius of rounded corners */ );
419 }
420}

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::GetPosition(), BOX2< Vec >::GetSize(), PLOTTER::m_outputFile, m_precision, BOX2< Vec >::Normalize(), SetCurrentLineWidth(), setFillMode(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::plotOneSheetSVG().

◆ RenderSettings()

◆ returnPostscriptTextWidth()

int PSLIKE_PLOTTER::returnPostscriptTextWidth ( const wxString &  aText,
int  aXSize,
bool  aItalic,
bool  aBold 
)
protectedinherited

Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i.e.

calculates a text string width) but using postscript metrics for the Helvetica font (optionally used for PS and PDF plotting

Definition at line 329 of file PS_plotter.cpp.

331{
332 const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
333 : ( aItalic ? hvo_widths : hv_widths );
334 double tally = 0;
335
336 for( unsigned i = 0; i < aText.length(); i++ )
337 {
338 wchar_t AsciiCode = aText[i];
339
340 // Skip the negation marks and untabled points.
341 if( AsciiCode != '~' && AsciiCode < 256 )
342 {
343 tally += width_table[AsciiCode];
344 }
345 }
346
347 // Widths are proportional to height, but height is enlarged by a scaling factor.
348 return KiROUND( aXSize * tally / postscriptTextAscent );
349}

References hv_widths, hvb_widths, hvbo_widths, hvo_widths, KiROUND(), and PSLIKE_PLOTTER::postscriptTextAscent.

Referenced by PSLIKE_PLOTTER::computeTextParameters().

◆ 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 SVG_PLOTTER::SetColor ( const COLOR4D color)
overridevirtual

The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values, the subclass emits the operator to actually do it.

Reimplemented from PSLIKE_PLOTTER.

Definition at line 207 of file SVG_plotter.cpp.

208{
210
213}
int color
Definition: DXF_plotter.cpp:57
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:62

References color, PLOTTER::GetCurrentLineWidth(), m_graphics_changed, PSLIKE_PLOTTER::SetColor(), and setSVGPlotStyle().

Referenced by SCH_PLOTTER::plotOneSheetSVG(), and Text().

◆ SetColorMode()

virtual void PLOTTER::SetColorMode ( bool  aColorMode)
inlinevirtualinherited

◆ SetCreator()

◆ SetCurrentLineWidth()

void SVG_PLOTTER::SetCurrentLineWidth ( int  width,
void *  aData = nullptr 
)
overridevirtual

Set the current line width (in IUs) for the next plot.

Implements PLOTTER.

Definition at line 310 of file SVG_plotter.cpp.

311{
312 if( aWidth == DO_NOT_SET_LINE_WIDTH )
313 return;
314 else if( aWidth == USE_DEFAULT_LINE_WIDTH )
316
317 // Note: aWidth == 0 is fine: used for filled shapes with no outline thickness
318
319 wxASSERT_MSG( aWidth >= 0, "Plotter called to set negative pen width" );
320
321 if( aWidth != m_currentPenWidth )
322 {
323 m_graphics_changed = true;
324 m_currentPenWidth = aWidth;
325 }
326
328 setSVGPlotStyle( aWidth );
329}
int GetDefaultPenWidth() const
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:113

References PLOTTER::DO_NOT_SET_LINE_WIDTH, KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), PLOTTER::m_currentPenWidth, m_graphics_changed, PLOTTER::m_renderSettings, setSVGPlotStyle(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

Referenced by Arc(), BezierCurve(), Circle(), PlotPoly(), Rect(), and Text().

◆ SetDash()

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

SVG supports dashed lines.

Implements PLOTTER.

Definition at line 372 of file SVG_plotter.cpp.

373{
374 if( m_dashed != aLineStyle )
375 {
376 m_graphics_changed = true;
377 m_dashed = aLineStyle;
378 }
379
381 setSVGPlotStyle( aLineWidth );
382}

References m_dashed, m_graphics_changed, and setSVGPlotStyle().

◆ setFillMode()

void SVG_PLOTTER::setFillMode ( FILL_T  fill)
protected

Prepare parameters for setSVGPlotStyle()

Definition at line 216 of file SVG_plotter.cpp.

217{
218 if( m_fillMode != fill )
219 {
220 m_graphics_changed = true;
221 m_fillMode = fill;
222 }
223}

References m_fillMode, and m_graphics_changed.

Referenced by Arc(), BezierCurve(), Circle(), PenTo(), PlotPoly(), Rect(), and Text().

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

◆ SetScaleAdjust()

void PSLIKE_PLOTTER::SetScaleAdjust ( double  scaleX,
double  scaleY 
)
inlineinherited

Set the 'fine' scaling for the postscript engine.

Definition at line 57 of file plotters_pslike.h.

58 {
59 plotScaleAdjX = scaleX;
60 plotScaleAdjY = scaleY;
61 }
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)

References PSLIKE_PLOTTER::plotScaleAdjX, and PSLIKE_PLOTTER::plotScaleAdjY.

Referenced by StartPlotBoard().

◆ SetSvgCoordinatesFormat()

void SVG_PLOTTER::SetSvgCoordinatesFormat ( unsigned  aPrecision)
overridevirtual

Select SVG coordinate precision (number of digits needed for 1 mm ) (SVG plotter uses always metric unit) Should be called only after SetViewport() is called.

Parameters
aPrecision= number of digits in mantissa of coordinate use a value from 3-6 do not use value > 6 to avoid overflow in PCBNEW do not use value > 4 to avoid overflow for other parts

Reimplemented from PLOTTER.

Definition at line 199 of file SVG_plotter.cpp.

200{
201 // Only number of digits in mantissa are adjustable.
202 // SVG units are always mm
203 m_precision = aPrecision;
204}

References m_precision.

Referenced by SetViewport().

◆ setSVGPlotStyle()

void SVG_PLOTTER::setSVGPlotStyle ( int  aLineWidth,
bool  aIsGroup = true,
const std::string &  aExtraStyle = {} 
)
protected

Output the string which define pen and brush color, shape, transparency.

Parameters
aIsGroupIf false, do not form a new group for the style.
aExtraStyleIf given, the string will be added into the style string before closing

Definition at line 226 of file SVG_plotter.cpp.

227{
228 if( aIsGroup )
229 fputs( "</g>\n<g ", m_outputFile );
230
231 // output the background fill color
232 fprintf( m_outputFile, "style=\"fill:#%6.6lX; ", m_brush_rgb_color );
233
234 switch( m_fillMode )
235 {
236 case FILL_T::NO_FILL:
237 fputs( "fill-opacity:0.0; ", m_outputFile );
238 break;
239
243 fprintf( m_outputFile, "fill-opacity:%.*f; ", m_precision, m_brush_alpha );
244 break;
245 }
246
247 double pen_w = userToDeviceSize( aLineWidth );
248
249 if( pen_w < 0.0 ) // Ensure pen width validity
250 pen_w = 0.0;
251
252 // Fix a strange issue found in Inkscape: aWidth < 100 nm create issues on degrouping objects
253 // So we use only 4 digits in mantissa for stroke-width.
254 // TODO: perhaps used only 3 or 4 digits in mantissa for all values in mm, because some
255 // issues were previously reported reported when using nm as integer units
256
257 fprintf( m_outputFile, "\nstroke:#%6.6lX; stroke-width:%.*f; stroke-opacity:1; \n",
259 fputs( "stroke-linecap:round; stroke-linejoin:round;", m_outputFile );
260
261 //set any extra attributes for non-solid lines
262 switch( m_dashed )
263 {
265 fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;",
266 m_precision, GetDashMarkLenIU( aLineWidth ),
267 m_precision, GetDashGapLenIU( aLineWidth ) );
268 break;
269
271 fprintf( m_outputFile, "stroke-dasharray:%f,%f;",
272 GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
273 break;
274
276 fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;",
277 GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
278 GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
279 break;
280
282 fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f,%f,%f;",
283 GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
284 GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
285 GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
286 break;
287
290 default:
291 //do nothing
292 break;
293 }
294
295 if( aExtraStyle.length() )
296 fputs( aExtraStyle.c_str(), m_outputFile );
297
298 fputs( "\"", m_outputFile );
299
300 if( aIsGroup )
301 {
302 fputs( ">", m_outputFile );
303 m_graphics_changed = false;
304 }
305
306 fputs( "\n", m_outputFile );
307}
double GetDotMarkLenIU(int aLineWidth) const
Definition: plotter.cpp:131
double GetDashGapLenIU(int aLineWidth) const
Definition: plotter.cpp:143
double GetDashMarkLenIU(int aLineWidth) const
Definition: plotter.cpp:137

References DASH, DASHDOT, DASHDOTDOT, DEFAULT, DOT, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR, FILLED_WITH_COLOR, PLOTTER::GetDashGapLenIU(), PLOTTER::GetDashMarkLenIU(), PLOTTER::GetDotMarkLenIU(), m_brush_alpha, m_brush_rgb_color, m_dashed, m_fillMode, m_graphics_changed, PLOTTER::m_outputFile, m_pen_rgb_color, m_precision, NO_FILL, SOLID, and PLOTTER::userToDeviceSize().

Referenced by PenTo(), PlotPoly(), SetColor(), SetCurrentLineWidth(), and SetDash().

◆ SetTextMode()

virtual void PSLIKE_PLOTTER::SetTextMode ( PLOT_TEXT_MODE  mode)
inlineoverridevirtualinherited

PS and PDF fully implement native text (for the Latin-1 subset)

Reimplemented from PLOTTER.

Definition at line 48 of file plotters_pslike.h.

49 {
50 if( mode != PLOT_TEXT_MODE::DEFAULT )
51 m_textMode = mode;
52 }
PLOT_TEXT_MODE m_textMode
How to draw text.

References DEFAULT, and PSLIKE_PLOTTER::m_textMode.

Referenced by SVG_PLOTTER().

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

◆ SetViewport()

void SVG_PLOTTER::SetViewport ( const VECTOR2I aOffset,
double  aIusPerDecimil,
double  aScale,
bool  aMirror 
)
overridevirtual

Set the plot offset and scaling for the current plot.

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

Implements PLOTTER.

Definition at line 177 of file SVG_plotter.cpp.

179{
180 m_plotMirror = aMirror;
181 m_yaxisReversed = true; // unlike other plotters, SVG has Y axis reversed
182 m_plotOffset = aOffset;
183 m_plotScale = aScale;
184 m_IUsPerDecimil = aIusPerDecimil;
185
186 // Compute the paper size in IUs. for historical reasons the page size is in mils
188 m_paperSize.x *= 10.0 * aIusPerDecimil;
189 m_paperSize.y *= 10.0 * aIusPerDecimil;
190
191 // gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
192 double iusPerMM = m_IUsPerDecimil / 2.54 * 1000;
193 m_iuPerDeviceUnit = 1 / iusPerMM;
194
196}
const VECTOR2I & GetSizeMils() const
Definition: page_info.h:135
bool m_yaxisReversed
Definition: plotter.h:630
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
virtual void SetSvgCoordinatesFormat(unsigned aPrecision) override
Select SVG coordinate precision (number of digits needed for 1 mm ) (SVG plotter uses always metric u...

References PAGE_INFO::GetSizeMils(), PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_IUsPerDecimil, PLOTTER::m_pageInfo, PLOTTER::m_paperSize, PLOTTER::m_plotMirror, PLOTTER::m_plotOffset, PLOTTER::m_plotScale, PLOTTER::m_yaxisReversed, SetSvgCoordinatesFormat(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::plotOneSheetSVG(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

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

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 DXF_PLOTTER::FlashPadOval().

◆ StartBlock()

void SVG_PLOTTER::StartBlock ( void *  aData)
overridevirtual

Calling this function allows one to define the beginning of a group of drawing items (used in SVG format to separate components)

Parameters
aDatashould be a string for the SVG ID tag

Reimplemented from PLOTTER.

Definition at line 332 of file SVG_plotter.cpp.

333{
334 std::string* idstr = reinterpret_cast<std::string*>( aData );
335
336 fputs( "<g ", m_outputFile );
337
338 if( idstr )
339 fprintf( m_outputFile, "id=\"%s\"", idstr->c_str() );
340
341 fprintf( m_outputFile, ">\n" );
342}

References PLOTTER::m_outputFile.

◆ StartPlot()

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

Create SVG file header.

Implements PLOTTER.

Definition at line 707 of file SVG_plotter.cpp.

708{
709 wxASSERT( m_outputFile );
710
711 static const char* header[] =
712 {
713 "<?xml version=\"1.0\" standalone=\"no\"?>\n",
714 " <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n",
715 " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n",
716 "<svg\n"
717 " xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
718 " xmlns=\"http://www.w3.org/2000/svg\"\n",
719 " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
720 " version=\"1.1\"\n",
721 nullptr
722 };
723
724 // Write header.
725 for( int ii = 0; header[ii] != nullptr; ii++ )
726 {
727 fputs( header[ii], m_outputFile );
728 }
729
730 // Write viewport pos and size
731 VECTOR2D origin; // TODO set to actual value
732 fprintf( m_outputFile, " width=\"%.*fmm\" height=\"%.*fmm\" viewBox=\"%.*f %.*f %.*f %.*f\">\n",
733 m_precision, (double) m_paperSize.x / m_IUsPerDecimil * 2.54 / 1000,
734 m_precision, (double) m_paperSize.y / m_IUsPerDecimil * 2.54 / 1000,
735 m_precision, origin.x, m_precision, origin.y,
738
739 // Write title
740 char date_buf[250];
741 time_t ltime = time( nullptr );
742 strftime( date_buf, 250, "%Y/%m/%d %H:%M:%S", localtime( &ltime ) );
743
744 fprintf( m_outputFile,
745 "<title>SVG Picture created as %s date %s </title>\n",
746 TO_UTF8( XmlEsc( wxFileName( m_filename ).GetFullName() ) ), date_buf );
747
748 // End of header
749 fprintf( m_outputFile, " <desc>Picture generated by %s </desc>\n",
750 TO_UTF8( XmlEsc( m_creator ) ) );
751
752 // output the pen and brush color (RVB values in hex) and opacity
753 double opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
754 fprintf( m_outputFile,
755 "<g style=\"fill:#%6.6lX; fill-opacity:%.*f;stroke:#%6.6lX; stroke-opacity:%.*f;\n",
757
758 // output the pen cap and line joint
759 fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", m_outputFile );
760 fputs( " transform=\"translate(0 0) scale(1 1)\">\n", m_outputFile );
761 return true;
762}
static wxString XmlEsc(const wxString &aStr, bool isAttribute=false)
Translates '<' to "<", '>' to ">" and so on, according to the spec: http://www.w3....
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

References m_brush_alpha, m_brush_rgb_color, PLOTTER::m_creator, PLOTTER::m_filename, PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_IUsPerDecimil, PLOTTER::m_outputFile, PLOTTER::m_paperSize, m_pen_rgb_color, m_precision, TO_UTF8, VECTOR2< T >::x, XmlEsc(), and VECTOR2< T >::y.

Referenced by SCH_PLOTTER::plotOneSheetSVG(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ Text()

void SVG_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.

If the text is mirrored, we should also mirror the hidden text to match

Reimplemented from PLOTTER.

Definition at line 775 of file SVG_plotter.cpp.

788{
790 SetColor( aColor );
791 SetCurrentLineWidth( aWidth );
792
793 VECTOR2I text_pos = aPos;
794 const char* hjust = "start";
795
796 switch( aH_justify )
797 {
798 case GR_TEXT_H_ALIGN_CENTER: hjust = "middle"; break;
799 case GR_TEXT_H_ALIGN_RIGHT: hjust = "end"; break;
800 case GR_TEXT_H_ALIGN_LEFT: hjust = "start"; break;
801 }
802
803 switch( aV_justify )
804 {
805 case GR_TEXT_V_ALIGN_CENTER: text_pos.y += aSize.y / 2; break;
806 case GR_TEXT_V_ALIGN_TOP: text_pos.y += aSize.y; break;
807 case GR_TEXT_V_ALIGN_BOTTOM: break;
808 }
809
810 VECTOR2I text_size;
811
812 // aSize.x or aSize.y is < 0 for mirrored texts.
813 // The actual text size value is the absolute value
814 text_size.x = std::abs( GraphicTextWidth( aText, aFont, aSize, aWidth, aBold, aItalic ) );
815 text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
816 VECTOR2D anchor_pos_dev = userToDeviceCoordinates( aPos );
817 VECTOR2D text_pos_dev = userToDeviceCoordinates( text_pos );
818 VECTOR2D sz_dev = userToDeviceSize( text_size );
819
820 if( !aOrient.IsZero() )
821 {
822 fprintf( m_outputFile,
823 "<g transform=\"rotate(%f %.*f %.*f)\">\n",
824 - aOrient.AsDegrees(), m_precision, anchor_pos_dev.x, m_precision, anchor_pos_dev.y );
825 }
826
827 fprintf( m_outputFile, "<text x=\"%.*f\" y=\"%.*f\"\n",
828 m_precision, text_pos_dev.x, m_precision, text_pos_dev.y );
829
831 if( aSize.x < 0 )
832 fprintf( m_outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
833
834 fprintf( m_outputFile,
835 "textLength=\"%.*f\" font-size=\"%.*f\" lengthAdjust=\"spacingAndGlyphs\"\n"
836 "text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
837 m_precision, sz_dev.x, m_precision, sz_dev.y, hjust, TO_UTF8( XmlEsc( aText ) ) );
838
839 if( !aOrient.IsZero() )
840 fputs( "</g>\n", m_outputFile );
841
842 fprintf( m_outputFile, "<g class=\"stroked-text\"><desc>%s</desc>\n",
843 TO_UTF8( XmlEsc( aText ) ) );
844
845 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
846 aBold, aMultilineAllowed, aFont );
847
848 fputs( "</g>", m_outputFile );
849}
double AsDegrees() const
Definition: eda_angle.h:149
bool IsZero() const
Definition: eda_angle.h:169
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
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
int GraphicTextWidth(const wxString &aText, KIFONT::FONT *aFont, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic)
The full X size is GraphicTextWidth + the thickness of graphic lines.
Definition: gr_text.cpp:101
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401

References std::abs(), EDA_ANGLE::AsDegrees(), 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, GraphicTextWidth(), EDA_ANGLE::IsZero(), PLOTTER::m_outputFile, m_precision, NO_FILL, SetColor(), SetCurrentLineWidth(), setFillMode(), PLOTTER::Text(), TO_UTF8, PLOTTER::userToDeviceCoordinates(), PLOTTER::userToDeviceSize(), VECTOR2< T >::x, XmlEsc(), 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}
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

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

◆ ThickSegment()

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

Reimplemented in DXF_PLOTTER, GERBER_PLOTTER, and HPGL_PLOTTER.

Definition at line 549 of file plotter.cpp.

551{
552 if( tracemode == FILLED )
553 {
554 if( start == end )
555 {
556 Circle( start, width, FILL_T::FILLED_SHAPE, 0 );
557 }
558 else
559 {
560 SetCurrentLineWidth( width );
561 MoveTo( start );
562 FinishTo( end );
563 }
564 }
565 else
566 {
568 segmentAsOval( start, end, width, tracemode );
569 }
570}
void segmentAsOval(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode)
Convert a thick segment and plot it as an oval.
Definition: plotter.cpp:481

References PLOTTER::Circle(), FILLED, FILLED_SHAPE, PLOTTER::FinishTo(), PLOTTER::MoveTo(), PLOTTER::segmentAsOval(), and PLOTTER::SetCurrentLineWidth().

Referenced by PSLIKE_PLOTTER::FlashPadOval(), BRDITEMS_PLOTTER::PlotFootprintShape(), PlotLayerOutlines(), BRDITEMS_PLOTTER::PlotPcbShape(), and PlotStandardLayer().

◆ 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}
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 DXF_PLOTTER::Arc(), HPGL_PLOTTER::Arc(), Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), BezierCurve(), HPGL_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), 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(), DXF_PLOTTER::PenTo(), GERBER_PLOTTER::PenTo(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), PenTo(), GERBER_PLOTTER::plotArc(), PS_PLOTTER::PlotImage(), PDF_PLOTTER::PlotImage(), HPGL_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), PDF_PLOTTER::PlotPoly(), PlotPoly(), HPGL_PLOTTER::Rect(), PS_PLOTTER::Rect(), PDF_PLOTTER::Rect(), Rect(), DXF_PLOTTER::Text(), PS_PLOTTER::Text(), and 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_brush_alpha

double SVG_PLOTTER::m_brush_alpha
protected

Definition at line 635 of file plotters_pslike.h.

Referenced by emitSetRGBColor(), setSVGPlotStyle(), StartPlot(), and SVG_PLOTTER().

◆ m_brush_rgb_color

long SVG_PLOTTER::m_brush_rgb_color
protected

Definition at line 633 of file plotters_pslike.h.

Referenced by emitSetRGBColor(), setSVGPlotStyle(), StartPlot(), and SVG_PLOTTER().

◆ m_colorMode

◆ m_creator

wxString PLOTTER::m_creator
protectedinherited

◆ m_currentPenWidth

◆ m_dashed

PLOT_DASH_TYPE SVG_PLOTTER::m_dashed
protected

Definition at line 639 of file plotters_pslike.h.

Referenced by SetDash(), setSVGPlotStyle(), and SVG_PLOTTER().

◆ m_filename

wxString PLOTTER::m_filename
protectedinherited

◆ m_fillMode

FILL_T SVG_PLOTTER::m_fillMode
protected

Definition at line 627 of file plotters_pslike.h.

Referenced by PenTo(), setFillMode(), setSVGPlotStyle(), and SVG_PLOTTER().

◆ m_graphics_changed

bool SVG_PLOTTER::m_graphics_changed
protected

◆ m_headerExtraLines

wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

◆ m_iuPerDeviceUnit

◆ m_IUsPerDecimil

◆ m_mirrorIsHorizontal

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited

Definition at line 629 of file plotter.h.

Referenced by 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 DXF_PLOTTER::Arc(), Arc(), PS_PLOTTER::Arc(), BezierCurve(), HPGL_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PS_PLOTTER::Circle(), 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(), EndBlock(), DXF_PLOTTER::EndPlot(), GERBER_PLOTTER::EndPlot(), HPGL_PLOTTER::EndPlot(), PS_PLOTTER::EndPlot(), PDF_PLOTTER::EndPlot(), EndPlot(), HPGL_PLOTTER::FlashPadCircle(), DXF_PLOTTER::FlashPadCircle(), GERBER_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), DXF_PLOTTER::FlashPadOval(), GERBER_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadRect(), GERBER_PLOTTER::FlashPadRoundRect(), DXF_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::formatNetAttribute(), PLOTTER::OpenFile(), PDF_PLOTTER::OpenFile(), DXF_PLOTTER::PenTo(), GERBER_PLOTTER::PenTo(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PenTo(), GERBER_PLOTTER::plotArc(), GERBER_PLOTTER::PlotGerberRegion(), PS_PLOTTER::PlotImage(), PlotImage(), GERBER_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), PlotPoly(), GERBER_PLOTTER::plotRoundRectAsRegion(), PLOTTER::PLOTTER(), HPGL_PLOTTER::Rect(), DXF_PLOTTER::Rect(), PS_PLOTTER::Rect(), Rect(), GERBER_PLOTTER::selectAperture(), PS_PLOTTER::SetCurrentLineWidth(), PS_PLOTTER::SetDash(), GERBER_PLOTTER::SetLayerPolarity(), setSVGPlotStyle(), PS_PLOTTER::SetViewport(), StartBlock(), PDF_PLOTTER::StartPage(), PDF_PLOTTER::startPdfObject(), PDF_PLOTTER::startPdfStream(), DXF_PLOTTER::StartPlot(), HPGL_PLOTTER::StartPlot(), PS_PLOTTER::StartPlot(), StartPlot(), PDF_PLOTTER::StartPlot(), GERBER_PLOTTER::StartPlot(), DXF_PLOTTER::Text(), PS_PLOTTER::Text(), Text(), HPGL_PLOTTER::ThickSegment(), GERBER_PLOTTER::writeApertureList(), and PLOTTER::~PLOTTER().

◆ m_pageInfo

◆ m_paperSize

◆ m_pen_rgb_color

long SVG_PLOTTER::m_pen_rgb_color
protected

Definition at line 629 of file plotters_pslike.h.

Referenced by emitSetRGBColor(), setSVGPlotStyle(), StartPlot(), and SVG_PLOTTER().

◆ m_penLastpos

VECTOR2I PLOTTER::m_penLastpos
protectedinherited

◆ m_penState

char PLOTTER::m_penState
protectedinherited

◆ m_plotMirror

◆ m_plotOffset

◆ m_plotScale

◆ m_precision

unsigned SVG_PLOTTER::m_precision
protected

◆ m_renderSettings

◆ m_textMode

PLOT_TEXT_MODE PSLIKE_PLOTTER::m_textMode
protectedinherited

How to draw text.

Definition at line 151 of file plotters_pslike.h.

Referenced by PS_PLOTTER::PS_PLOTTER(), PSLIKE_PLOTTER::SetTextMode(), and PS_PLOTTER::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_useInch

bool SVG_PLOTTER::m_useInch
protected

Definition at line 640 of file plotters_pslike.h.

Referenced by SVG_PLOTTER().

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

◆ plotScaleAdjX

double PSLIKE_PLOTTER::plotScaleAdjX
protectedinherited

Fine user scale adjust ( = 1.0 if no correction)

Definition at line 148 of file plotters_pslike.h.

Referenced by PSLIKE_PLOTTER::SetScaleAdjust(), PDF_PLOTTER::StartPage(), and PS_PLOTTER::StartPlot().

◆ plotScaleAdjY

double PSLIKE_PLOTTER::plotScaleAdjY
protectedinherited

◆ postscriptTextAscent

const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718
staticprotectedinherited

Height of the postscript font (from the AFM)

Definition at line 137 of file plotters_pslike.h.

Referenced by PSLIKE_PLOTTER::computeTextParameters(), PSLIKE_PLOTTER::postscriptOverlinePositions(), and PSLIKE_PLOTTER::returnPostscriptTextWidth().

◆ USE_DEFAULT_LINE_WIDTH


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