225 double aScale,
bool aMirror )
250 fprintf(
outputFile,
"PT %.1f;\n", penThicknessMM );
282 fprintf(
outputFile,
"EA %.0f,%.0f;\n", p2dev.
x, p2dev.
y );
299 fprintf(
outputFile,
"PM 0; CI %g;\n", radius );
318 FILL_T aFill,
int aWidth,
void * aData )
320 if( aCornerList.size() <= 1 )
332 for(
unsigned ii = 1; ii < aCornerList.size(); ++ii )
333 LineTo( aCornerList[ii] );
335 int ii = aCornerList.size() - 1;
337 if( aCornerList[ii] != aCornerList[0] )
345 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
346 LineTo( aCornerList[ii] );
351 int ii = aCornerList.size() - 1;
353 if( aCornerList[ii] != aCornerList[0] )
415 fprintf(
outputFile,
"PA %.0f,%.0f;\n", pos_dev.
x, pos_dev.
y );
483 angle = StAngle - EndAngle;
485 angle = EndAngle - StAngle;
497 "PU;PA %.0f,%.0f;PD;AA %.0f,%.0f,",
498 cmap_dev.
x, cmap_dev.
y,
499 centre_dev.
x, centre_dev.
y );
513 wxSize size( aSize );
518 if( size.x > size.y )
520 std::swap( size.x, size.y );
524 deltaxy = size.y - size.x;
526 if( trace_mode ==
FILLED )
529 orient, trace_mode, aData );
530 cx = 0; cy = deltaxy / 2;
532 FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
533 cx = 0; cy = -deltaxy / 2;
535 FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode, aData );
552 int radius = diametre / 2;
554 if( trace_mode ==
FILLED )
566 if( trace_mode ==
FILLED )
570 MoveTo( wxPoint( pos.x+radius, pos.y ) );
572 fprintf(
outputFile,
"PM 0; PA %.0f,%.0f;CI %.0f;%s",
578 fprintf(
outputFile,
"PA %.0f,%.0f;CI %.0f;\n",
579 pos_dev.
x, pos_dev.
y, rsize );
590 std::vector<wxPoint> corners;
592 int dx = padsize.x / 2;
593 int dy = padsize.y / 2;
595 if( trace_mode ==
FILLED )
606 corners.push_back( wxPoint( - dx, - dy ) );
607 corners.push_back( wxPoint( - dx, + dy ) );
608 corners.push_back( wxPoint( + dx, + dy ) );
609 corners.push_back( wxPoint( + dx, - dy ) );
611 corners.push_back( wxPoint( - dx, - dy ) );
613 for(
unsigned ii = 0; ii < corners.size(); ii++ )
624 int aCornerRadius,
double aOrient,
631 if( aTraceMode ==
FILLED )
648 std::vector< wxPoint > cornerList;
651 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
652 cornerList.push_back( wxPoint( poly.
Point( ii ).
x, poly.
Point( ii ).
y ) );
654 if( cornerList.back() != cornerList.front() )
655 cornerList.push_back( cornerList.front() );
664 std::vector< wxPoint > cornerList;
666 for(
int cnt = 0; cnt < aPolygons->
OutlineCount(); ++cnt )
673 for(
int ii = 1; ii < poly.
PointCount(); ++ii )
674 cornerList.push_back( wxPoint( poly.
Point( ii ).
x, poly.
Point( ii ).
y ) );
676 if( cornerList.back() != cornerList.front() )
677 cornerList.push_back( cornerList.front() );
687 std::vector< wxPoint > cornerList;
688 cornerList.reserve( 5 );
690 for(
int ii = 0; ii < 4; ii++ )
692 wxPoint coord( aCorners[ii] );
695 cornerList.push_back( coord );
699 cornerList.push_back( cornerList.front() );
706 int aRadius,
int aCornerCount,
void FinishTo(const wxPoint &pos)
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
int OutlineCount() const
Returns the number of outlines in the set
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
HPGL polygon:
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aApproxErrorMax, int aMinSegPerCircleCount)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
virtual void SetPenDiameter(double diameter)
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
void RotatePoint(int *pX, int *pY, double angle)
char penState
Current pen state: 'U', 'D' or 'Z' (see PenTo)
void NORMALIZE_ANGLE_180(T &Angle)
int PointCount() const
Function PointCount()
virtual bool StartPlot() override
At the start of the HPGL plot pen speed and number are requested.
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
wxPoint plotOffset
Plot offset (in IUs)
wxPoint penLastpos
Last pen positions; set to -1,-1 when the pen is at rest.
This file contains miscellaneous commonly used macros and functions.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
HPGL rectangle: fill not supported.
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
void LineTo(const wxPoint &pos)
static const int USE_DEFAULT_LINE_WIDTH
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
HPGL doesn't handle line thickness or color.
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
virtual void SetPenSpeed(int speed)
static const char hpgl_end_polygon_cmd[]
Base window classes and related definitions.
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
virtual void SetDash(int dashed) override
HPGL supports dashed lines.
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadOval
const wxSize & GetSizeMils() const
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
void MoveTo(const wxPoint &pos)
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
double cosdecideg(double r, double a)
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
double sindecideg(double r, double a)
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians.
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual void SetPenNumber(int number)
FILE * outputFile
true if the Y axis is top to bottom (SVG)
int GetPlotterArcHighDef() const
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
VECTOR2I & Point(int aIndex)
Function Point()
static const double PLUsPERDECIMIL
void penControl(char plume)
Pen control logic (remove redundant pen activations)
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode)
Cdonvert a thick segment and plot it as an oval.
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadTrapez flash a trapezoidal pad
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
wxSize paperSize
Paper size in IU - not in mils.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
virtual void Arc(const wxPoint ¢re, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.