45#define DXF_LINE_WIDTH DO_NOT_SET_LINE_WIDTH
80 {
"LIGHTYELLOW", 51 },
84 {
"LIGHTMAGENTA", 212 },
85 {
"LIGHTORANGE", 30 },
92 {
"DARKMAGENTA", 216 },
101 {
"PUREMAGENTA", 6 },
102 {
"PUREORANGE", 40 },
112 {
"ORANGETHREE", 22 },
113 {
"ORANGEFOUR", 23 },
114 {
"ORANGEFIVE", 24 },
119 {
"ORANGESEVEN", 29 },
120 {
"ORANGEEIGHT", 31 },
121 {
"ORANGENINE", 33 },
123 {
"ORANGEELEVEN", 36 },
124 {
"ORANGETWELVE", 37 },
125 {
"ORANGETHIRTEEN", 38 },
126 {
"ORANGEFOURTEEN", 39 },
129 {
"YELLOWTHREE", 44 },
130 {
"YELLOWFOUR", 45 },
131 {
"YELLOWFIVE", 46 },
133 {
"YELLOWSEVEN", 48 },
134 {
"YELLOWEIGHT", 49 },
135 {
"YELLOWNINE", 53 },
137 {
"YELLOWELEVEN", 58 },
138 {
"YELLOWTWELVE", 59 },
139 {
"YELLOWTHIRTEEN", 60 },
140 {
"YELLOWFOURTEEN", 61 },
143 {
"GREENTHREE", 64 },
147 {
"GREENSEVEN", 68 },
148 {
"GREENEIGHT", 69 },
151 {
"GREENELEVEN", 72 },
152 {
"GREENTWELVE", 73 },
153 {
"GREENTHIRTEEN", 74 },
154 {
"GREENFOURTEEN", 75 },
155 {
"GREENFIFTEEN", 76 },
156 {
"GREENSIXTEEN", 77 },
157 {
"GREENSEVENTEEN", 78 },
158 {
"GREENEIGHTEEN", 79 },
159 {
"GREENNINETEEN", 80 },
160 {
"GREENTWENTY", 81 },
161 {
"GREENTWENTYONE", 82 },
162 {
"GREENTWENTYTWO", 83 },
163 {
"GREENTWENTYTHREE", 84 },
164 {
"GREENTWENTYFOUR", 85 },
165 {
"GREENTWENTYFIVE", 86 },
166 {
"GREENTWENTYSIX", 87 },
167 {
"GREENTWENTYSEVEN", 88 },
168 {
"GREENTWENTYEIGHT", 89 },
169 {
"GREENTWENTYNINE", 90 },
170 {
"GREENTHIRTY", 91 },
171 {
"GREENTHIRTYONE", 93 },
172 {
"GREENTHIRTYTWO", 95 },
173 {
"GREENTHIRTYTHREE", 97 },
174 {
"GREENTHIRTYFOUR", 98 },
175 {
"GREENTHIRTYFIVE", 99 },
176 {
"GREENTHIRTYSIX", 100 },
177 {
"GREENTHIRTYSEVEN", 101 },
178 {
"GREENTHIRTYEIGHT", 102 },
179 {
"GREENTHIRTYNINE", 103 },
180 {
"GREENFORTY", 104 },
181 {
"GREENFORTYONE", 105 },
182 {
"GREENFORTYTWO", 106 },
183 {
"GREENFORTYTHREE", 107 },
184 {
"GREENFORTYFOUR", 108 },
185 {
"GREENFORTYFIVE", 109 },
186 {
"GREENFORTYSIX", 110 },
187 {
"GREENFORTYSEVEN", 111 },
188 {
"GREENFORTYEIGHT", 112 },
189 {
"GREENFORTYNINE", 113 },
190 {
"GREENFIFTY", 114 },
191 {
"GREENFIFTYONE", 115 },
192 {
"GREENFIFTYTWO", 116 },
193 {
"GREENFIFTYTHREE", 117 },
194 {
"GREENFIFTYFOUR", 118 },
195 {
"GREENFIFTYFIVE", 119 },
196 {
"GREENFIFTYSIX", 120 },
197 {
"GREENFIFTYSEVEN", 121 },
198 {
"GREENFIFTYEIGHT", 122 },
199 {
"GREENFIFTYNINE", 123 },
200 {
"GREENSIXTY", 124 },
201 {
"GREENSIXTYONE", 125 },
202 {
"GREENSIXTYTWO", 126 },
203 {
"GREENSIXTYTHREE", 127 },
204 {
"GREENSIXTYFOUR", 128 },
205 {
"GREENSIXTYFIVE", 129 },
208 {
"CYANTHREE", 135 },
212 {
"CYANSEVEN", 140 },
215 {
"BLUETHREE", 143 },
219 {
"BLUESEVEN", 147 },
220 {
"BLUEEIGHT", 148 },
223 {
"BLUEELEVEN", 151 },
224 {
"BLUETWELVE", 152 },
225 {
"BLUETHIRTEEN", 153 },
226 {
"BLUEFOURTEEN", 154 },
227 {
"BLUEFIFTEEN", 155 },
228 {
"BLUESIXTEEN", 156 },
229 {
"BLUESEVENTEEN", 157 },
230 {
"BLUEEIGHTEEN", 158 },
231 {
"BLUENINETEEN", 159 },
232 {
"BLUETWENTY", 160 },
233 {
"BLUETWENTYONE", 161 },
234 {
"BLUETWENTYTWO", 162 },
235 {
"BLUETWENTYTHREE", 163 },
236 {
"BLUETWENTYFOUR", 164 },
237 {
"BLUETWENTYFIVE", 165 },
238 {
"BLUETWENTYSIX", 166 },
239 {
"BLUETWENTYSEVEN", 167 },
240 {
"BLUETWENTYEIGHT", 168 },
241 {
"BLUETWENTYNINE", 169 },
242 {
"BLUETHIRTY", 170 },
243 {
"BLUETHIRTYONE", 171 },
244 {
"BLUETHIRTYTWO", 177 },
245 {
"BLUETHIRTYETHREE", 178 },
246 {
"BLUETHIRTYFOUR", 179 },
247 {
"VIOLETONE", 180 },
248 {
"VIOLETTWO", 181 },
249 {
"VIOLETTHREE", 182 },
250 {
"VIOLETFOUR", 183 },
251 {
"VIOLETFIVE", 184 },
252 {
"VIOLETSIX", 185 },
253 {
"VIOLETSEVEN", 186 },
254 {
"VIOLETEIGHT", 187 },
255 {
"VIOLETNINE", 188 },
256 {
"VIOLETTEN", 189 },
257 {
"VIOLETELEVEN", 190 },
258 {
"VIOLETTWELVE", 191 },
259 {
"VIOLETTHIRTEEN", 192 },
260 {
"VIOLETFOURTEEN", 193 },
261 {
"VIOLETFIFTEEN", 194 },
262 {
"VIOLETSIXTEEN", 195 },
263 {
"VIOLETSEVENTEEN", 196 },
264 {
"VIOLETEIGHTEEN", 197 },
265 {
"VIOLETNINETEEN", 198 },
266 {
"VIOLETTWENTY", 199 },
267 {
"VIOLETTWENTYONE", 200 },
268 {
"VIOLETTWENTYTWO", 201 },
269 {
"VIOLETTWENTYTHREE", 202 },
270 {
"VIOLETTWENTYFOUR", 203 },
271 {
"VIOLETTWENTYFIVE", 204 },
272 {
"VIOLETTWENTYSIX", 205 },
273 {
"VIOLETTWENTYSEVEN", 206 },
274 {
"VIOLETTWENTYEIGHT", 207 },
275 {
"VIOLETTWENTYNINE", 208 },
276 {
"VIOLETTHIRTY", 209 },
277 {
"MAGENTAONE", 210 },
278 {
"MAGENTATWO", 211 },
279 {
"MAGENTATHREE", 213 },
280 {
"MAGENTAFOUR", 215 },
281 {
"MAGENTAFIVE", 217 },
282 {
"MAGENTASIX", 218 },
283 {
"MAGENTASEVEN", 219 },
284 {
"MAGENTAEIGHT", 220 },
285 {
"MAGENTANINE", 221 },
286 {
"MAGENTATEN", 222 },
287 {
"MAGENTAELEVEN", 223 },
288 {
"MAGENTATWELVE", 224 },
289 {
"MAGENTATHIRTEEN", 225 },
290 {
"MAGENTAFOURTEEN", 226 },
292 {
"REDELEVEN", 228 },
293 {
"VIOLETFIFTEEN", 229 },
294 {
"REDTWELVE", 230 },
295 {
"REDTHIRTEEN", 231 },
296 {
"REDFOURTEEN", 232 },
297 {
"REDFIFTEEN", 233 },
298 {
"REDSIXTEEN", 234 },
299 {
"REDSEVENTEEN", 235 },
300 {
"REDEIGHTEEN", 236 },
301 {
"REDNINETEEN", 237 },
302 {
"REDTWENTY", 238 },
303 {
"REDTWENTYONE", 239 },
304 {
"REDTWENTYTWO", 240 },
305 {
"REDTWENTYTHREE", 241 },
306 {
"REDTWENTYFOUR", 242 },
307 {
"REDTWENTYFIVE", 243 },
308 {
"REDTWENTYSIX", 244 },
309 {
"REDTWENTYSEVEN", 245 },
310 {
"REDTWENTYEIGHT", 246 },
311 {
"REDTWENTYNINE", 247 },
312 {
"REDTHIRTY", 248 },
313 {
"REDTHIRTYONE", 249 },
316 {
"GRAYTHREE", 253 },
596 wxFAIL_MSG(
"Unhandled LINE_STYLE" );
605 int nearestDistance = std::numeric_limits<int>::max();
610 int distance = ( aR - c.red ) * ( aR - c.red ) + ( aG - c.green ) * ( aG - c.green )
611 + ( aB - c.blue ) * ( aB - c.blue );
616 nearestColorValueIndex = trying;
620 return nearestColorValueIndex;
664 int( layerColor.
r * 255 ),
int( layerColor.
g * 255 ),
int( layerColor.
b * 255 ) );
669 [actualLayerId](
const std::pair<int, wxString>& element )
671 return element.first == actualLayerId;
685 int( layerColor.
r * 255 ),
int( layerColor.
g * 255 ),
int( layerColor.
b * 255 ) );
690 default:
return wxString(
"Unknown Mode" );
722 buf = fmt::format(
"{:.16f}", aValue );
725 while( !buf.empty() && buf[buf.size() - 1] ==
'0' )
735 double aScale,
bool aMirror )
819 "Dash Dot ____ _ ____ _\n"
843 "Dashed __ __ __ __ __\n"
888 static const char *style_name[4] = {
"KICAD",
"KICADB",
"KICADI",
"KICADBI"};
890 for(
int i = 0; i < 4; i++ )
933 "{}\n", (
int)numLayers );
945 bool hasActualColor =
false;
948 for(
int i = 0; i < numLayers; i++ )
956 [colorName](
const auto& layer)
958 return std::strcmp( layer.name, colorName.ToStdString().c_str() ) == 0;
967 hasActualColor =
true;
990 int r =
static_cast<int>( actualColor.
r * 255 );
991 int g =
static_cast<int>( actualColor.
g * 255 );
992 int b =
static_cast<int>( actualColor.
b * 255 );
994 int trueColorValue = ( r << 16 ) | ( g << 8 ) | b;
1059 if( aCornerRadius > 0 )
1084 fmt::print(
m_outputFile,
"0\nPOINT\n8\n{}\n10\n{}\n20\n",
1104 fmt::print(
m_outputFile,
"0\nCIRCLE\n8\n{}\n10\n{}\n20\n{}\n40\n{}\n",
1119 fmt::print(
m_outputFile,
"10\n{}\n 20\n{}\n42\n1.0\n",
1123 fmt::print(
m_outputFile,
"10\n{}\n 20\n{}\n42\n1.0\n",
1142 if( aCornerList.size() <= 1 )
1145 unsigned last = aCornerList.size() - 1;
1150 MoveTo( aCornerList[0] );
1152 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1153 LineTo( aCornerList[ii] );
1158 if( aCornerList[last] != aCornerList[0] )
1159 LineTo( aCornerList[0] );
1175 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1182 for(
const VECTOR2I& corner : aCornerList )
1183 bufferPolybase.
Append( corner );
1197 if(
path.PointCount() < 2 )
1201 last =
path.PointCount() - 1;
1207 for(
int ii = 1; ii <
path.PointCount(); ii++ )
1209 point =
path.CPoint( ii );
1214 point =
path.CPoint( last );
1217 if( endPoint != startPoint )
1225 const EDA_ANGLE& aAngle,
double aRadius )
1227 std::vector<VECTOR2I> pts;
1234 EDA_ANGLE endAngle = startAngle - aAngle;
1239 if( startAngle > endAngle )
1240 std::swap( startAngle, endAngle );
1243 start.
x =
KiROUND( aCenter.
x + aRadius * ( -startAngle ).Cos() );
1244 start.
y =
KiROUND( aCenter.
y + aRadius * ( -startAngle ).Sin() );
1245 pts.emplace_back( start );
1249 end.x =
KiROUND( aCenter.
x + aRadius * ( -ii ).Cos() );
1250 end.y =
KiROUND( aCenter.
y + aRadius * ( -ii ).Sin() );
1251 pts.emplace_back(
end );
1254 end.x =
KiROUND( aCenter.
x + aRadius * ( -endAngle ).Cos() );
1255 end.y =
KiROUND( aCenter.
y + aRadius * ( -endAngle ).Sin() );
1256 pts.emplace_back(
end );
1264 std::set<size_t> handledArcs;
1265 std::vector<VECTOR2I> cornerList;
1267 for(
int ii = 0; ii < aLineChain.
SegmentCount(); ++ii )
1271 size_t arcIndex = aLineChain.
ArcIndex( ii );
1273 if( !handledArcs.contains( arcIndex ) )
1275 handledArcs.insert( arcIndex );
1280 for(
const VECTOR2I& pt : std::ranges::reverse_view( pts ) )
1281 cornerList.emplace_back( pt );
1287 cornerList.emplace_back( seg.
A );
1288 cornerList.emplace_back( seg.
B );
1292 if( aLineChain.
IsClosed() && cornerList.front() != cornerList.back() )
1293 cornerList.emplace_back( aLineChain.
CPoint( 0 ) );
1295 PlotPoly( cornerList, aFill, aWidth, aData );
1320 fmt::print(
m_outputFile,
"0\nLINE\n8\n{}\n6\n{}\n10\n{}\n20\n{}\n11\n{}\n21\n{}\n",
1350 EDA_ANGLE endAngle = startAngle - aAngle;
1354 if( endAngle < startAngle )
1355 std::swap( startAngle, endAngle );
1363 "0\nARC\n8\n{}\n10\n{}\n20\n{}\n40\n{}\n50\n{:.8f}\n51\n{:.8f}\n",
1379 std::vector<VECTOR2I> cornerList;
1385 cornerList.reserve(
path.PointCount() );
1387 for(
int jj = 0; jj <
path.PointCount(); jj++ )
1388 cornerList.emplace_back(
path.CPoint( jj ).x,
path.CPoint( jj ).y );
1391 if( cornerList[0] != cornerList[cornerList.size() - 1] )
1392 cornerList.push_back( cornerList[0] );
1405 const EDA_ANGLE& aAngle,
double aRadius,
int aWidth,
void* aData )
1427 VECTOR2I offsetp1( p1.
x - width/2, p1.
y - width/2 );
1428 VECTOR2I offsetp2( p2.
x + width/2, p2.
y + width/2 );
1431 offsetp1.
x += width;
1432 offsetp1.
y += width;
1433 offsetp2.
x -= width;
1434 offsetp2.
y -= width;
1502 if( size.
x > size.
y )
1504 std::swap( size.
x, size.
y );
1526 size.
x = aPadSize.
x / 2;
1527 size.
y = aPadSize.
y / 2;
1579 int aCornerRadius,
const EDA_ANGLE& aOrient,
void* aData )
1590 for(
int ii = 1; ii < poly.
PointCount(); ++ii )
1601 for(
int cnt = 0; cnt < aPolygons->
OutlineCount(); ++cnt )
1607 for(
int ii = 1; ii < poly.
PointCount(); ++ii )
1616 const EDA_ANGLE& aPadOrient,
void* aData )
1621 for(
int ii = 0; ii < 4; ii++ )
1623 coord[ii] = aCorners[ii];
1625 coord[ii] += aPadPos;
1654 for(
unsigned i = 0; i <
string.length(); i++ )
1656 wchar_t ch =
string[i];
1667 const wxString& aText,
1675 bool aMultilineAllowed,
1681 if( aMultilineAllowed && !aText.Contains( wxT(
"\n" ) ) )
1682 aMultilineAllowed =
false;
1684 bool processSuperSub = aText.Contains( wxT(
"^{" ) ) || aText.Contains( wxT(
"_{" ) );
1691 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
1692 aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
1712 const wxString& aText,
1721 if( attrs.
m_Multiline && !aText.Contains( wxT(
"\n" ) ) )
1724 bool processSuperSub = aText.Contains( wxT(
"^{" ) ) || aText.Contains( wxT(
"_{" ) );
1731 PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aFontMetrics, aData );
1750 int h_code = 0, v_code = 0;
1768 std::string textStyle =
"KICAD";
1772 textStyle =
"KICADBI";
1774 textStyle =
"KICADB";
1777 textStyle =
"KICADI";
1811 aAttributes.
m_Bold ? ( aAttributes.
m_Italic ?
"KICADBI" :
"KICADB" )
1812 : ( aAttributes.
m_Italic ?
"KICADI" :
"KICAD" ),
1847 int braceNesting = 0;
1848 int overbarDepth = -1;
1852 for(
unsigned int i = 0; i < aText.length(); i++ )
1860 wchar_t ch = aText[i];
1869 if( aText[i] ==
'~' && i+1 < aText.length() && aText[i+1] ==
'{' )
1872 overbarDepth = braceNesting;
1878 else if( aText[i] ==
'{' )
1882 else if( aText[i] ==
'}' )
1884 if( braceNesting > 0 )
1887 if( braceNesting == overbarDepth )
static const double DXF_OBLIQUE_ANGLE
Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value....
static std::string formatCoord(double aValue)
bool containsNonAsciiChars(const wxString &string)
Check if a given string contains non-ASCII characters.
std::vector< VECTOR2I > arcPts(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius)
static const struct @110355335012326036072316124131344246226335322120 acad_dxf_color_names[]
The layer/colors palette.
static const char * getDXFLineType(LINE_STYLE aType)
static const struct @021340374267035355154031176330133165301272264217 acad_dxf_color_values[]
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
static const COLOR4D WHITE
static const COLOR4D BLACK
void plotOneLineOfText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttrs)
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, void *aData) override
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, void *aData) override
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot.
virtual void ThickArc(const VECTOR2D &aCentre, const EDA_ANGLE &aStAngle, const EDA_ANGLE &aAngle, double aRadius, int aWidth, void *aData) override
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth) override
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
virtual void FlashPadOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
DXF oval pad: always done in sketch mode.
virtual void FlashPadRect(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
DXF rectangular pad: always done in sketch mode.
virtual void ThickRect(const VECTOR2I &p1, const VECTOR2I &p2, int width, void *aData) override
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, void *aData) override
virtual void ThickPoly(const SHAPE_POLY_SET &aPoly, int aWidth, void *aData) override
virtual bool StartPlot(const wxString &aPageNumber) override
Open the DXF plot with a skeleton header.
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, void *aData) override
DXF trapezoidal pad: only sketch mode is supported.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width) override
DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide a...
virtual void FlashPadCircle(const VECTOR2I &pos, int diametre, void *aData) override
DXF round pad: always done in sketch mode; it could be filled but it isn't pretty if other kinds of p...
virtual void FilledCircle(const VECTOR2I &pos, int diametre, void *aData) override
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData=nullptr) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
wxString GetCurrentLayerName(DXF_LAYER_OUTPUT_MODE aMode, std::optional< PCB_LAYER_ID > aLayerId=std::nullopt)
Retrieves the current layer name or layer color name for DXF plotting.
unsigned int m_measurementDirective
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0) override
DXF rectangle: fill not supported.
virtual bool EndPlot() override
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, void *aData) override
Flash a regular polygon.
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
virtual void SetColor(const COLOR4D &color) override
The DXF exporter handles 'colors' as layers...
int FindNearestLegacyColor(int aR, int aG, int aB)
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, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData) override
double m_unitScalingFactor
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
LINE_STYLE m_currentLineType
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
PCB_LAYER_ID GetLayer() const
Gets the ID of the current layer.
std::vector< std::pair< PCB_LAYER_ID, wxString > > m_layersToExport
void MoveTo(const VECTOR2I &pos)
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
void FinishTo(const VECTOR2I &pos)
RENDER_SETTINGS * RenderSettings()
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).
int GetPlotterArcHighDef() const
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
bool GetColorMode() const
FILE * m_outputFile
Output file.
void LineTo(const VECTOR2I &pos)
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)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
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.
virtual DXF_OUTLINE_MODE GetDXFPlotMode() const
EDA_ANGLE GetCentralAngle() const
Get the "central angle" of the arc - this is the angle at the point of the "pie slice".
EDA_ANGLE GetStartAngle() const
const VECTOR2I & GetCenter() 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.
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
bool IsArcSegment(size_t aSegment) const
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
void Fracture()
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
int OutlineCount() const
Return the number of outlines in the set.
SHAPE_POLY_SET CloneDropTriangulation() const
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const SHAPE_LINE_CHAIN Outline() const
void SetRadius(int aRadius)
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
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.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
@ ROUND_ALL_CORNERS
All angles are rounded.
static constexpr EDA_ANGLE ANGLE_90
@ FILLED_SHAPE
Fill with object color.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
DXF_LAYER_OUTPUT_MODE
Specifies the output mode for the DXF layer.
@ Current_Layer_Color_Name
DXF_COLOR_T
Legacy colors for DXF file.
@ NBCOLORS
Number of colors.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
LINE_STYLE
Dashed line types.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_INDETERMINATE
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.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D