48#define GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
49#define GBR_USE_MACROS_FOR_CHAMFERED_RECT
50#define GBR_USE_MACROS_FOR_ROUNDRECT
51#define GBR_USE_MACROS_FOR_TRAPEZOID
52#define GBR_USE_MACROS_FOR_ROTATED_OVAL
53#define GBR_USE_MACROS_FOR_ROTATED_RECT
54#define GBR_USE_MACROS_FOR_CUSTOM_PAD
63#define GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT 4990
64#define AM_FREEPOLY_BASENAME "FreePoly"
71static bool polyCompare(
const std::vector<VECTOR2I>& aPolygon,
72 const std::vector<VECTOR2I>& aTestPolygon )
75 if( aTestPolygon.size() != aPolygon.size() )
80 for(
size_t jj = 0; jj < aPolygon.size(); jj++ )
82 if(
std::abs( aPolygon[jj].x - aTestPolygon[jj].x ) > margin ||
83 std::abs( aPolygon[jj].y - aTestPolygon[jj].y ) > margin )
122 double aScale,
bool aMirror )
124 wxASSERT( aMirror ==
false );
127 wxASSERT( aScale == 1 );
208 if( aData ==
nullptr )
217 std::string short_attribute_string;
220 aData, clearDict, useX1StructuredComment ) )
226 if( !short_attribute_string.empty() )
277 "G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n",
286 wxDateTime date = wxDateTime::Now();
287 fprintf(
m_outputFile,
"G04 Created by KiCad (%s) date %s*\n",
333 while( fgets( line, 1024,
workFile ) )
337 char* substr = strtok( line,
"\n\r" );
339 if( substr && strcmp( substr,
"G04 APERTURE LIST*" ) == 0 )
380 fputs(
"G04 Aperture macros list end*\n",
m_outputFile );
404 wxASSERT_MSG( aWidth >= 0,
"Plotter called to set negative pen width" );
410 aperture_attribute );
417 int aApertureAttribute )
422 for(
int idx = 0; idx < (int)
m_apertures.size(); ++idx )
427 if( (tool->
m_Type == aType) && (tool->
m_Size == aSize) &&
439 new_tool.
m_DCode = last_D_code + 1;
450 int aApertureAttribute )
466 for(
int idx = 0; idx < (int)
m_apertures.size(); ++idx )
472 if( (tool->
m_Type == aType) &&
473 (tool->
m_Corners.size() == aCorners.size() ) &&
493 new_tool.
m_DCode = last_D_code + 1;
518 aApertureAttribute );
526 int aApertureAttribute )
535 for(
size_t ii = 0; ii < aCorners.size(); ii++ )
552 aApertureAttribute );
565 wxASSERT( aType>= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3 &&
566 aType <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
578 bool useX1StructuredComment =
false;
581 useX1StructuredComment =
true;
593 int attribute = tool.m_ApertureAttribute;
602 sprintf( cbuf,
"%%ADD%d", tool.m_DCode );
612 switch( tool.m_Type )
615 sprintf( cbuf,
"C,%#f*%%\n", tool.GetDiameter() * fscale );
619 sprintf( cbuf,
"R,%#fX%#f*%%\n", tool.m_Size.x * fscale,
620 tool.m_Size.y * fscale );
624 sprintf( cbuf,
"C,%#f*%%\n", tool.m_Size.x * fscale );
628 sprintf( cbuf,
"O,%#fX%#f*%%\n", tool.m_Size.x * fscale,
629 tool.m_Size.y * fscale );
643 sprintf( cbuf,
"P,%#fX%dX%#f*%%\n", tool.GetDiameter() * fscale,
644 tool.GetRegPolyVerticeCount(), tool.GetRotation().AsDegrees() );
650 std::vector<VECTOR2I> corners;
651 VECTOR2I half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
653 corners.emplace_back( -half_size.
x, -half_size.
y );
654 corners.emplace_back( half_size.
x, -half_size.
y );
655 corners.emplace_back( half_size.
x, half_size.
y );
656 corners.emplace_back( -half_size.
x, half_size.
y );
659 for(
int ii = 0; ii < 4; ii++ )
663 tool.m_Radius * fscale );
667 for(
int ii = 0; ii < 4; ii++ )
669 sprintf( cbuf,
"%#fX%#fX",
670 corners[ii].x * fscale, corners[ii].y * fscale );
674 sprintf( cbuf,
"0*%%\n" );
680 tool.m_Size.x * fscale, tool.m_Size.y * fscale,
681 tool.m_Rotation.AsDegrees() );
689 switch( tool.m_Type )
710 for(
size_t ii = 0; ii < tool.m_Corners.size(); ii++ )
712 sprintf( cbuf,
"%#fX%#fX",
713 tool.m_Corners[ii].x * fscale, -tool.m_Corners[ii].y * fscale );
718 sprintf( cbuf,
"%#f*%%\n", tool.m_Rotation.AsDegrees() );
727 int seg_len = tool.m_Size.x - tool.m_Size.y;
737 tool.m_Size.y * fscale,
738 start.
x * fscale, -start.
y * fscale,
739 end.
x * fscale, -end.
y * fscale );
751 sprintf( cbuf,
"%s%d,%#f*%%\n",
754 tool.m_Rotation.AsDegrees() );
804 std::vector<VECTOR2I> cornerList;
806 cornerList.reserve( 5 );
809 cornerList.push_back( p1 );
812 cornerList.push_back( corner );
813 cornerList.push_back( p2 );
816 cornerList.push_back( corner );
817 cornerList.push_back( p1 );
819 PlotPoly( cornerList, fill, width );
836 plotArc( aCenter, aStartAngle, aEndAngle, aRadius,
false );
874 const EDA_ANGLE& aEndAngle,
int aRadius,
bool aPlotInRegion )
877 start.
x = aCenter.
x +
KiROUND( aRadius * aStartAngle.
Cos() );
878 start.
y = aCenter.
y -
KiROUND( aRadius * aStartAngle.
Sin() );
885 end.
x = aCenter.
x +
KiROUND( aRadius * aEndAngle.
Cos() );
886 end.
y = aCenter.
y -
KiROUND( aRadius * aEndAngle.
Sin() );
892 if( aStartAngle < aEndAngle )
912 bool clearTA_AperFunction =
false;
918 if( !attrib.empty() )
921 clearTA_AperFunction =
true;
928 if( clearTA_AperFunction )
944 if( aCornerList.size() <= 2 )
949 bool clearTA_AperFunction =
false;
955 if( !attrib.empty() )
958 clearTA_AperFunction =
true;
965 if( clearTA_AperFunction )
982 if( aPoly.
CPoints().size() <= 1 )
1001 for(
int ii = 1; ii < aPoly.
PointCount(); ii++ )
1003 int arcindex = aPoly.
ArcIndex( ii );
1035 for(
int ii = 1; ii < aPoly.
PointCount(); ii++ )
1037 int arcindex = aPoly.
ArcIndex( ii );
1069 if( aCornerList.size() <= 1 )
1084 MoveTo( aCornerList[0] );
1087 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1088 LineTo( aCornerList[ii] );
1091 if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
1101 MoveTo( aCornerList[0] );
1103 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1104 LineTo( aCornerList[ii] );
1108 if( aFill !=
FILL_T::NO_FILL && ( aCornerList[aCornerList.size() - 1] != aCornerList[0] ) )
1109 LineTo( aCornerList[0] );
1119 if( tracemode ==
FILLED )
1138 const EDA_ANGLE& aEndAngle,
int aRadius,
int aWidth,
1147 if( aTraceMode ==
FILLED )
1166 EDA_ANGLE start_angle( aStart - aCentre );
1169 if( start_angle > end_angle )
1181 std::swap( end_angle, start_angle );
1182 end_angle = -end_angle;
1183 start_angle = -start_angle;
1186 ThickArc( aCentre, start_angle, end_angle, radius, aWidth, aTraceMode, aData );
1196 aArcShape.
GetWidth(), aTraceMode, aData );
1209 if( tracemode ==
FILLED )
1239 if( tracemode ==
FILLED )
1264 if( tracemode ==
FILLED )
1282 VECTOR2I size( diametre, diametre );
1285 if( trace_mode ==
SKETCH )
1323 std::swap( size.
x, size.
y );
1337 if( aTraceMode ==
FILLED )
1339 #ifdef GBR_USE_MACROS_FOR_ROTATED_OVAL
1347 if( size.
x < size.
y )
1349 std::swap( size.
x, size.
y );
1374 if( size.
x > size.
y )
1376 std::swap( size.
x, size.
y );
1405 std::swap( size.
x, size.
y );
1407 if( aTraceMode ==
SKETCH )
1414 VECTOR2I( pos.
x + ( size.
x / 2 ), pos.
y + (size.
y / 2 ) ),
1431 #ifdef GBR_USE_MACROS_FOR_ROTATED_RECT
1455 coord[0].
x = -size.
x/2;
1456 coord[0].
y = size.
y/2;
1457 coord[1].
x = -size.
x/2;
1458 coord[1].
y = -size.
y/2;
1459 coord[2].
x = size.
x/2;
1460 coord[2].
y = -size.
y/2;
1461 coord[3].
x = size.
x/2;
1462 coord[3].
y = size.
y/2;
1470 int aCornerRadius,
const EDA_ANGLE& aOrient,
1476 if( aTraceMode !=
FILLED )
1484 std::vector<VECTOR2I> cornerList;
1489 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
1490 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
1493 cornerList.push_back( cornerList[0] );
1500 #ifdef GBR_USE_MACROS_FOR_ROUNDRECT
1520 bool clearTA_AperFunction =
false;
1527 if( !attrib.empty() )
1530 clearTA_AperFunction =
true;
1538 if( clearTA_AperFunction )
1550 int aCornerRadius,
const EDA_ANGLE& aOrient )
1570 int hsizeX = aSize.
x/2;
1571 int hsizeY = aSize.
y/2;
1574 std::vector<RR_EDGE> rr_outline;
1576 rr_outline.reserve( 4 );
1581 curr_edge.m_start.x = -hsizeX;
1582 curr_edge.m_start.y = hsizeY - aCornerRadius;
1583 curr_edge.m_end.x = curr_edge.m_start.x;
1584 curr_edge.m_end.y = -hsizeY + aCornerRadius;
1585 curr_edge.m_center.x = -hsizeX + aCornerRadius;
1586 curr_edge.m_center.y = curr_edge.m_end.y;
1587 curr_edge.m_arc_angle_start = aOrient +
ANGLE_180;
1589 rr_outline.push_back( curr_edge );
1592 curr_edge.m_start.x = -hsizeX + aCornerRadius;
1593 curr_edge.m_start.y = -hsizeY;
1594 curr_edge.m_end.x = hsizeX - aCornerRadius;
1595 curr_edge.m_end.y = curr_edge.m_start.y;
1596 curr_edge.m_center.x = curr_edge.m_end.x;
1597 curr_edge.m_center.y = -hsizeY + aCornerRadius;
1598 curr_edge.m_arc_angle_start = aOrient +
ANGLE_90;
1600 rr_outline.push_back( curr_edge );
1603 curr_edge.m_start.x = hsizeX;
1604 curr_edge.m_start.y = -hsizeY + aCornerRadius;
1605 curr_edge.m_end.x = curr_edge.m_start.x;
1606 curr_edge.m_end.y = hsizeY - aCornerRadius;
1607 curr_edge.m_center.x = hsizeX - aCornerRadius;
1608 curr_edge.m_center.y = curr_edge.m_end.y;
1609 curr_edge.m_arc_angle_start = aOrient +
ANGLE_0;
1611 rr_outline.push_back( curr_edge );
1614 curr_edge.m_start.x = hsizeX - aCornerRadius;
1615 curr_edge.m_start.y = hsizeY;
1616 curr_edge.m_end.x = -hsizeX + aCornerRadius;
1617 curr_edge.m_end.y = curr_edge.m_start.y;
1618 curr_edge.m_center.x = curr_edge.m_end.x;
1619 curr_edge.m_center.y = hsizeY - aCornerRadius;
1620 curr_edge.m_arc_angle_start = aOrient -
ANGLE_90;
1622 rr_outline.push_back( curr_edge );
1628 for( RR_EDGE& rr_edge: rr_outline )
1633 rr_edge.m_start += aRectCenter;
1634 rr_edge.m_end += aRectCenter;
1635 rr_edge.m_center += aRectCenter;
1636 arc_last_center = rr_edge.m_center;
1644 last_pt.
x = arc_last_center.
x +
KiROUND( aCornerRadius * arc_last_angle.
Cos() );
1645 last_pt.
y = arc_last_center.
y -
KiROUND( aCornerRadius * arc_last_angle.
Sin() );
1647 VECTOR2I first_pt = rr_outline[0].m_start;
1650 if( last_pt != first_pt )
1651 wxLogMessage( wxS(
"first pt %d %d last pt %d %d" ),
1652 first_pt.
x, first_pt.
y, last_pt.
x, last_pt.
y );
1660 for( RR_EDGE& rr_edge: rr_outline )
1665 plotArc( rr_edge.m_center, rr_edge.m_arc_angle_start,
1666 rr_edge.m_arc_angle_start -
ANGLE_90, aCornerRadius,
true );
1691 if( aTraceMode !=
FILLED )
1696 std::vector<VECTOR2I> cornerList;
1698 for(
int cnt = 0; cnt < polyshape.
OutlineCount(); ++cnt )
1704 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
1705 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
1708 cornerList.push_back( cornerList[0] );
1710 if( aTraceMode ==
SKETCH )
1716#ifdef GBR_USE_MACROS_FOR_CUSTOM_PAD
1726 for(
size_t ii = 0; ii < cornerList.size(); ii++ )
1728 cornerList[ii] -= aPadPos;
1748 int aCornerRadius,
double aChamferRatio,
1749 int aChamferPositions,
const EDA_ANGLE& aPadOrient,
1760 std::vector<VECTOR2I> cornerList;
1762 bool hasRoundedCorner = aCornerRadius != 0 && aChamferPositions != 15;
1764#ifdef GBR_USE_MACROS_FOR_CHAMFERED_RECT
1770 aCornerRadius, aChamferRatio, aChamferPositions, 0,
1776 for(
int ii = 0; ii < corners.
PointCount(); ii++ )
1777 cornerList.emplace_back( corners.
CPoint( ii ).
x, corners.
CPoint( ii ).
y );
1780 cornerList.push_back( cornerList[0] );
1782 if( aPlotMode ==
SKETCH )
1786#ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
1795 for(
size_t ii = 0; ii < cornerList.size(); ii++ )
1797 cornerList[ii] -= aShapePos;
1817 aChamferRatio, aChamferPositions, 0,
1824 for(
int ii = 0; ii < corners.
PointCount(); ii++ )
1825 cornerList.emplace_back( corners.
CPoint( ii ).
x, corners.
CPoint( ii ).
y );
1827 switch( cornerList.size() )
1860 wxLogMessage( wxS(
"FlashPadChamferRoundRect(): Unexpected number of corners (%d)" ),
1861 (
int)cornerList.size() );
1877 std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1880 for(
unsigned ii = 0; ii < 4; ii++ )
1883 cornerList[ii] += aPadPos;
1887 cornerList.push_back( cornerList[0] );
1893 metadata = *gbr_metadata;
1895 if( aTraceMode ==
SKETCH )
1902 #ifdef GBR_USE_MACROS_FOR_TRAPEZOID
1909 std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1925 int aCornerCount,
const EDA_ANGLE& aOrient,
1933 metadata = *gbr_metadata;
1935 if( aTraceMode ==
SKETCH )
1938 std::vector<VECTOR2I> cornerList;
1942 for(
int ii = 0; ii < aCornerCount; ii++ )
1944 EDA_ANGLE rot = aOrient + ( angle_delta * ii );
1945 VECTOR2I vertice( aDiameter / 2, 0 );
1948 vertice += aShapePos;
1949 cornerList.push_back( vertice );
1952 cornerList.push_back( cornerList[0] );
1963 selectAperture( aDiameter, aOrient, apert_type, aperture_attrib );
1975 const wxString& aText,
1983 bool aMultilineAllowed,
1992 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
1993 aItalic, aBold, aMultilineAllowed, aFont, aData );
2016 fprintf( aOutput,
"4,1,%d,", (
int)
m_Corners.size() );
2019 int curr_line_corner_count = 0;
2020 const int curr_line_count_max = 20;
2022 for(
size_t ii = 0; ii <=
m_Corners.size(); ii++ )
2030 fprintf( aOutput,
"%#f,%#f,",
2033 if( curr_line_count_max >= 0 && ++curr_line_corner_count >= curr_line_count_max )
2035 fprintf( aOutput,
"\n" );
2036 curr_line_corner_count = 0;
2041 fputs(
"$1*%\n", aOutput );
2047 for(
int idx = 0; idx <
AmCount(); idx++ )
2060 for(
int idx = 0; idx <
AmCount(); idx++ )
2062 if(
m_AMList[idx].IsSamePoly( aPolygon ) )
#define GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT
static bool polyCompare(const std::vector< VECTOR2I > &aPolygon, const std::vector< VECTOR2I > &aTestPolygon)
#define AM_FREEPOLY_BASENAME
wxString GetBuildVersion()
Get the full KiCad version string.
std::vector< VECTOR2I > m_Corners
std::vector< APER_MACRO_FREEPOLY > m_AMList
void Append(const std::vector< VECTOR2I > &aPolygon)
append a new APER_MACRO_FREEPOLY containing the polygon aPolygon to the current list
int FindAm(const std::vector< VECTOR2I > &aPolygon) const
void Format(FILE *aOutput, double aIu2GbrMacroUnit)
print the aperture macro list to aOutput
void Format(FILE *aOutput, double aIu2GbrMacroUnit)
print the aperture macro definition to aOutput
bool IsSamePoly(const std::vector< VECTOR2I > &aPolygon) const
std::vector< VECTOR2I > m_Corners
bool IsCardinal90() const
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.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
bool m_hasApertureRotRect
std::string m_objectAttributesDictionary
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.
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Selection of Gerber units and resolution (number of digits in mantissa).
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData) override
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
void selectAperture(const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
bool m_hasApertureRotOval
void PlotGerberRegion(const std::vector< VECTOR2I > &aCornerList, void *aData=nullptr)
Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA....
int GetOrCreateAperture(const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
void emitDcode(const VECTOR2D &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate.
APER_MACRO_FREEPOLY_LIST m_am_freepoly_list
void plotArc(const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, bool aPlotInRegion)
Plot a Gerber arc.
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void FlashPadCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
std::vector< APERTURE > m_apertures
bool m_hasApertureChamferedRect
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a trapezoidal pad.
bool m_hasApertureOutline4P
virtual void SetCurrentLineWidth(int aLineWidth, void *aData=nullptr) override
Set the line width for the next drawing.
void writeApertureList()
Generate the table of D codes.
void plotRoundRectAsRegion(const VECTOR2I &aRectCenter, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient)
Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners.
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
void FlashPadChamferRoundRect(const VECTOR2I &aShapePos, const VECTOR2I &aPadSize, int aCornerRadius, double aChamferRatio, int aChamferPositions, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aPlotMode, void *aData)
Flash a chamfered round rect pad.
bool m_hasApertureRoundRect
bool m_gerberDisableApertMacros
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.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
Print a Gerber net attribute object record.
virtual void SetLayerPolarity(bool aPositive) override
Change the plot polarity and begin a new layer.
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
virtual void EndBlock(void *aData) override
Define the end of a group of drawing items the group is started by StartBlock().
virtual void ThickRect(const VECTOR2I &p1, const VECTOR2I &p2, int width, OUTLINE_MODE tracemode, void *aData) override
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData) override
void clearNetAttribute()
Clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object a...
virtual void StartBlock(void *aData) override
Calling this function allows one to define the beginning of a group of drawing items (used in X2 form...
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
virtual bool StartPlot(const wxString &pageNumber) override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
virtual void ThickArc(const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData) override
virtual void FilledCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData) override
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
int GetDefaultPenWidth() const
void SetDefaultPenWidth(int aWidth)
wxArrayString m_headerExtraLines
static const int USE_DEFAULT_LINE_WIDTH
void MoveTo(const VECTOR2I &pos)
void FinishTo(const VECTOR2I &pos)
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
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.
void sketchOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
int GetPlotterArcHighDef() const
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
FILE * m_outputFile
Output file.
void LineTo(const VECTOR2I &pos)
static const int DO_NOT_SET_LINE_WIDTH
RENDER_SETTINGS * m_renderSettings
void segmentAsOval(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode)
Convert a thick segment and plot it as an oval.
virtual int GetCurrentLineWidth() const
const VECTOR2I & GetArcMid() const
const VECTOR2I & GetP1() const
VECTOR2I GetCenter() const
const VECTOR2I & GetP0() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_ARC & Arc(size_t aArc) const
bool IsClosed() const override
int PointCount() const
Return the number of points (vertices) in this line chain.
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const std::vector< VECTOR2I > & CPoints() const
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
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.
static constexpr EDA_ANGLE & ANGLE_180
static constexpr EDA_ANGLE & ANGLE_360
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
static constexpr EDA_ANGLE & ANGLE_270
specialized plotter for GERBER files format
#define APER_MACRO_OUTLINE6P_NAME
#define APER_MACRO_OUTLINE4P_NAME
#define APER_MACRO_OUTLINE4P_HEADER
#define APER_MACRO_OUTLINE6P_HEADER
#define APER_MACRO_ROT_RECT_HEADER
#define APER_MACRO_OUTLINE8P_HEADER
#define APER_MACRO_SHAPE_OVAL_HEADER
#define APER_MACRO_ROT_RECT_NAME
#define APER_MACRO_SHAPE_OVAL_NAME
#define APER_MACRO_OUTLINE5P_HEADER
#define APER_MACRO_OUTLINE5P_NAME
#define APER_MACRO_ROUNDRECT_HEADER
#define APER_MACRO_OUTLINE8P_NAME
#define APER_MACRO_OUTLINE7P_HEADER
#define APER_MACRO_ROUNDRECT_NAME
#define APER_MACRO_OUTLINE7P_NAME
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double EuclideanNorm(const VECTOR2I &vector)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".