130#define IU_PER_MILS ( m_IUsPerDecimil * 10 ) 
  156    EDA_ANGLE startAngle( aStart - aCenter );
 
  160    double det = ( aEnd - aStart ).Cross( aMid - aStart );
 
  170    double radius = ( aStart - aCenter ).EuclideanNorm();
 
  171    Arc( aCenter, startAngle, angle, 
radius, aFill, aWidth );
 
 
  176                   double aRadius, 
FILL_T aFill, 
int aWidth )
 
  178    polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
 
 
  186    EDA_ANGLE       endAngle = startAngle + aAngle;
 
  192        std::swap( startAngle, endAngle );
 
  196    start.
x = 
KiROUND( aCenter.
x + aRadius * startAngle.
Cos() );
 
 
  233                           int aTolerance, 
int aLineThickness )
 
  236    std::vector<VECTOR2I> ctrlPoints;
 
  237    ctrlPoints.reserve( 4 );
 
  239    ctrlPoints.push_back( aStart );
 
  240    ctrlPoints.push_back( aControl1 );
 
  241    ctrlPoints.push_back( aControl2 );
 
  242    ctrlPoints.push_back( aEnd );
 
  246    std::vector<VECTOR2I> approxPoints;
 
  247    bezier_converter.
GetPoly( approxPoints, aTolerance );
 
  252    for( 
unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
 
  253        LineTo( approxPoints[ii] );
 
 
  261    VECTOR2I size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
 
  264    start.
x -= size.
x / 2;
 
  265    start.
y -= size.
y / 2;
 
 
  278    std::vector<VECTOR2I> corner_list;
 
  281    corner_list.reserve( 4 );
 
  283    corner.
x = position.
x + r;
 
  284    corner.
y = position.
y + r;
 
  285    corner_list.push_back( corner );
 
  286    corner.
x = position.
x + r;
 
  287    corner.
y = position.
y - r;
 
  288    corner_list.push_back( corner );
 
  289    corner.
x = position.
x - r;
 
  290    corner.
y = position.
y - r;
 
  291    corner_list.push_back( corner );
 
  292    corner.
x = position.
x - r;
 
  293    corner.
y = position.
y + r;
 
  294    corner_list.push_back( corner );
 
  295    corner.
x = position.
x + r;
 
  296    corner.
y = position.
y + r;
 
  297    corner_list.push_back( corner );
 
 
  311    std::vector<VECTOR2I> corner_list;
 
  314    corner_list.reserve( 4 );
 
  316    corner.
x = position.
x;
 
  318    corner_list.push_back( corner );
 
  320    corner.
y = position.
y,
 
  321    corner_list.push_back( corner );
 
  322    corner.
x = position.
x;
 
  324    corner_list.push_back( corner );
 
  326    corner.
y = position.
y;
 
  327    corner_list.push_back( corner );
 
  328    corner.
x = position.
x;
 
  330    corner_list.push_back( corner );
 
 
  366    int radius = diametre / 2;
 
  376    static const unsigned char marker_patterns[
MARKER_COUNT] = {
 
  460        unsigned char pat = marker_patterns[aShapeId];
 
 
  487                         int aWidth, 
void* aData )
 
  494    if( size.
x > size.
y )
 
  496        std::swap( size.
x, size.
y );
 
  500    int deltaxy = size.
y - size.
x;       
 
  505    std::vector<VECTOR2I> corners;
 
  506    corners.reserve( 6 );
 
  511    int half_height = deltaxy / 2;
 
  512    corners.emplace_back( -
radius, -half_height );
 
  513    corners.emplace_back( -
radius, half_height );
 
  514    corners.emplace_back( 0, half_height );
 
  515    corners.emplace_back( 
radius, half_height );
 
  516    corners.emplace_back( 
radius, -half_height );
 
  517    corners.emplace_back( 0, -half_height );
 
 
  555                        const EDA_ANGLE& aAngle, 
double aRadius, 
int aWidth, 
void* aData )
 
 
  573    double det = ( 
end - start ).Cross( mid - start );
 
 
  612    std::vector<VECTOR2I> cornerList;
 
  613    cornerList.reserve( aLineChain.
PointCount() );
 
  615    for( 
int ii = 0; ii < aLineChain.
PointCount(); ii++ )
 
  616        cornerList.emplace_back( aLineChain.
CPoint( ii ) );
 
  618    if( aLineChain.
IsClosed() && cornerList.front() != cornerList.back() )
 
  619        cornerList.emplace_back( aLineChain.
CPoint( 0 ) );
 
  621    PlotPoly( cornerList, aFill, aWidth, aData );
 
 
  627                    const wxString&        aText,
 
  635                    bool                   aMultilineAllowed,
 
  641    wxString                   
text( aText );
 
  643    if( 
text.Contains( wxS( 
"@{" ) ) )
 
  651    if( aPenWidth == 0 && aBold ) 
 
  655        aPenWidth = -aPenWidth;
 
  674    attributes.m_StrokeWidth = aPenWidth;
 
  675    attributes.m_Italic = aItalic;
 
  676    attributes.m_Bold = aBold;
 
  677    attributes.m_Halign = aH_justify;
 
  678    attributes.m_Valign = aV_justify;
 
  679    attributes.m_Size = aSize;
 
  682    if( attributes.m_Size.x < 0 )
 
  684        attributes.m_Size.x = -attributes.m_Size.x;
 
  685        attributes.m_Mirrored = 
true;
 
  691    aFont->
Draw( &callback_gal, 
text, aPos, attributes, aFontMetrics );
 
 
  697                        const wxString&        aText,
 
  704    wxString                   
text( aText );
 
  706    if( 
text.Contains( wxS( 
"@{" ) ) )
 
  718    if( penWidth == 0 && attributes.
m_Bold ) 
 
  722        penWidth = -penWidth;
 
  743    aFont->
Draw( &callback_gal, 
text, aPos, attributes, aFontMetrics );
 
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
Bezier curves to polygon converter.
 
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMaxError=10)
Convert a Bezier curve to a polygon.
 
EDA_ANGLE NormalizeNegative()
 
VECTOR2I getCenter() const
 
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
 
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
 
VECTOR2I GetArcMid() const
 
High-level wrapper for evaluating mathematical and string expressions in wxString format.
 
wxString Evaluate(const wxString &aInput)
Main evaluation function - processes input string and evaluates all} expressions.
 
FONT is an abstract base class for both outline and stroke fonts.
 
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
 
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
 
A color representation with 4 components: red, green, blue, alpha.
 
double GetDotMarkLenIU(int aLineWidth) const
 
virtual void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor)
Only PostScript plotters can plot bitmaps.
 
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map).
 
double GetDashGapLenIU(int aLineWidth) const
 
const PROJECT * m_project
 
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
 
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
 
bool m_mirrorIsHorizontal
 
virtual void ThickPoly(const SHAPE_POLY_SET &aPoly, int aWidth, void *aData)
 
static const int USE_DEFAULT_LINE_WIDTH
 
virtual void FilledCircle(const VECTOR2I &pos, int diametre, void *aData)
 
void MoveTo(const VECTOR2I &pos)
 
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
 
void markerSlash(const VECTOR2I &pos, int radius)
Plot a / bar centered on the position.
 
void FinishTo(const VECTOR2I &pos)
 
virtual void polyArc(const VECTOR2D &aCentre, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth)
Generic fallback: arc rendered as a polyline.
 
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
 
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
 
virtual void ThickArc(const EDA_SHAPE &aArcShape, void *aData, int aWidth)
 
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0)=0
 
void Marker(const VECTOR2I &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
 
virtual void BezierCurve(const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness)
Generic fallback: Cubic Bezier curve rendered as a polyline.
 
void markerHBar(const VECTOR2I &pos, int radius)
Plot a - bar centered on the position.
 
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
 
void markerCircle(const VECTOR2I &pos, int radius)
Plot a circle centered on the position.
 
PLOTTER(const PROJECT *aProject=nullptr)
 
FILE * m_outputFile
Output file.
 
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
 
void LineTo(const VECTOR2I &pos)
 
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
 
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
 
void markerLozenge(const VECTOR2I &position, int radius)
Plot a lozenge centered on the position.
 
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
 
virtual void ThickRect(const VECTOR2I &p1, const VECTOR2I &p2, int width, void *aData)
 
RENDER_SETTINGS * m_renderSettings
 
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, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Draw text with the plotter.
 
void markerBackSlash(const VECTOR2I &pos, int radius)
Plot a \ bar centered on the position.
 
void markerVBar(const VECTOR2I &pos, int radius)
Plot a | bar centered on the position.
 
void markerSquare(const VECTOR2I &position, int radius)
Plot a square centered on the position.
 
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, void *aData)
 
virtual int GetCurrentLineWidth() const
 
double GetDashMarkLenIU(int aLineWidth) const
 
virtual void SetColor(const COLOR4D &color)=0
 
virtual void Arc(const VECTOR2D &aStart, const VECTOR2D &aMid, const VECTOR2D &aEnd, FILL_T aFill, int aWidth)
 
Container for project specific data.
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
bool IsClosed() const override
 
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.
 
Represent a set of closed polygons.
 
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
 
static constexpr EDA_ANGLE ANGLE_0
 
static constexpr EDA_ANGLE ANGLE_90
 
static constexpr EDA_ANGLE ANGLE_180
 
@ FILLED_SHAPE
Fill with object color.
 
int GetPenSizeForBold(int aTextSize)
 
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
 
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
 
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
 
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
 
constexpr int sign(T val)
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D