KiCad PCB EDA Suite
plotter.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
40 #include <fill_type.h>
41 #include <vector>
42 #include <trigo.h>
43 #include <eda_item.h>
44 #include <plotter.h>
47 #include <bezier_curves.h>
48 #include <math/util.h> // for KiROUND
49 
51 {
52  plotScale = 1;
53  currentPenWidth = -1; // To-be-set marker
54  penState = 'Z'; // End-of-path idle
55  m_plotMirror = false; // Plot mirror option flag
56  m_mirrorIsHorizontal = true;
57  m_yaxisReversed = false;
58  outputFile = 0;
59  colorMode = false; // Starts as a BW plot
60  negativeMode = false;
61  // Temporary init to avoid not initialized vars, will be set later
62  m_IUsPerDecimil = 1; // will be set later to the actual value
63  iuPerDeviceUnit = 1; // will be set later to the actual value
64  m_renderSettings = nullptr;
65 }
66 
68 {
69  // Emergency cleanup, but closing the file is
70  // usually made in EndPlot().
71  if( outputFile )
72  fclose( outputFile );
73 }
74 
75 
76 bool PLOTTER::OpenFile( const wxString& aFullFilename )
77 {
78  filename = aFullFilename;
79 
80  wxASSERT( !outputFile );
81 
82  // Open the file in text mode (not suitable for all plotters
83  // but only for most of them
84  outputFile = wxFopen( filename, wxT( "wt" ) );
85 
86  if( outputFile == NULL )
87  return false ;
88 
89  return true;
90 }
91 
92 
94 {
95  wxPoint pos = aCoordinate - plotOffset;
96 
97  // Don't allow overflows; they can cause rendering failures in some file viewers
98  // (such as Acrobat)
99  int clampSize = MAX_PAGE_SIZE_MILS * m_IUsPerDecimil * 10 / 2;
100  pos.x = std::max( -clampSize, std::min( pos.x, clampSize ) );
101  pos.y = std::max( -clampSize, std::min( pos.y, clampSize ) );
102 
103  double x = pos.x * plotScale;
104  double y = ( paperSize.y - pos.y * plotScale );
105 
106  if( m_plotMirror )
107  {
109  x = ( paperSize.x - pos.x * plotScale );
110  else
111  y = pos.y * plotScale;
112  }
113 
114  if( m_yaxisReversed )
115  y = paperSize.y - y;
116 
117  x *= iuPerDeviceUnit;
118  y *= iuPerDeviceUnit;
119 
120  return DPOINT( x, y );
121 }
122 
123 
124 DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
125 {
126  return DPOINT( size.x * plotScale * iuPerDeviceUnit,
127  size.y * plotScale * iuPerDeviceUnit );
128 }
129 
130 
131 double PLOTTER::userToDeviceSize( double size ) const
132 {
133  return size * plotScale * iuPerDeviceUnit;
134 }
135 
136 
137 #define IU_PER_MILS ( m_IUsPerDecimil * 10 )
138 
140 {
142 }
143 
144 
146 {
148 }
149 
150 
152 {
154 }
155 
156 
157 void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
158  FILL_TYPE fill, int width )
159 {
160  wxPoint start, end;
161  const int delta = 50; // increment (in 0.1 degrees) to draw circles
162 
163  if( StAngle > EndAngle )
164  std::swap( StAngle, EndAngle );
165 
166  SetCurrentLineWidth( width );
167  /* Please NOTE the different sign due to Y-axis flip */
168  start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
169  start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
170 
171  if( fill != FILL_TYPE::NO_FILL )
172  {
173  MoveTo( centre );
174  LineTo( start );
175  }
176  else
177  {
178  MoveTo( start );
179  }
180 
181  for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
182  {
183  end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) );
184  end.y = centre.y + KiROUND( sindecideg( radius, -ii ) );
185  LineTo( end );
186  }
187 
188  end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
189  end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
190 
191  if( fill != FILL_TYPE::NO_FILL )
192  {
193  LineTo( end );
194  FinishTo( centre );
195  }
196  else
197  {
198  FinishTo( end );
199  }
200 }
201 
202 
203 void PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
204  const wxPoint& aControl2, const wxPoint& aEnd,
205  int aTolerance, int aLineThickness )
206 {
207  // Generic fallback: Quadratic Bezier curve plotted as a polyline
208  int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
209 
210  std::vector<wxPoint> ctrlPoints;
211  ctrlPoints.push_back( aStart );
212  ctrlPoints.push_back( aControl1 );
213  ctrlPoints.push_back( aControl2 );
214  ctrlPoints.push_back( aEnd );
215 
216  BEZIER_POLY bezier_converter( ctrlPoints );
217 
218  std::vector<wxPoint> approxPoints;
219  bezier_converter.GetPoly( approxPoints, minSegLen );
220 
221  SetCurrentLineWidth( aLineThickness );
222  MoveTo( aStart );
223 
224  for( unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
225  LineTo( approxPoints[ii] );
226 
227  FinishTo( aEnd );
228 }
229 
230 
231 void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos, double aScaleFactor )
232 {
233  wxSize size( aImage.GetWidth() * aScaleFactor,
234  aImage.GetHeight() * aScaleFactor );
235 
236  wxPoint start = aPos;
237  start.x -= size.x / 2;
238  start.y -= size.y / 2;
239 
240  wxPoint end = start;
241  end.x += size.x;
242  end.y += size.y;
243 
244  Rect( start, end, FILL_TYPE::NO_FILL );
245 }
246 
247 
248 void PLOTTER::markerSquare( const wxPoint& position, int radius )
249 {
250  double r = KiROUND( radius / 1.4142 );
251  std::vector< wxPoint > corner_list;
252  wxPoint corner;
253  corner.x = position.x + r;
254  corner.y = position.y + r;
255  corner_list.push_back( corner );
256  corner.x = position.x + r;
257  corner.y = position.y - r;
258  corner_list.push_back( corner );
259  corner.x = position.x - r;
260  corner.y = position.y - r;
261  corner_list.push_back( corner );
262  corner.x = position.x - r;
263  corner.y = position.y + r;
264  corner_list.push_back( corner );
265  corner.x = position.x + r;
266  corner.y = position.y + r;
267  corner_list.push_back( corner );
268 
270 }
271 
272 
273 void PLOTTER::markerCircle( const wxPoint& position, int radius )
274 {
275  Circle( position, radius * 2, FILL_TYPE::NO_FILL, GetCurrentLineWidth() );
276 }
277 
278 
279 void PLOTTER::markerLozenge( const wxPoint& position, int radius )
280 {
281  std::vector< wxPoint > corner_list;
282  wxPoint corner;
283  corner.x = position.x;
284  corner.y = position.y + radius;
285  corner_list.push_back( corner );
286  corner.x = position.x + radius;
287  corner.y = position.y,
288  corner_list.push_back( corner );
289  corner.x = position.x;
290  corner.y = position.y - radius;
291  corner_list.push_back( corner );
292  corner.x = position.x - radius;
293  corner.y = position.y;
294  corner_list.push_back( corner );
295  corner.x = position.x;
296  corner.y = position.y + radius;
297  corner_list.push_back( corner );
298 
300 }
301 
302 
303 void PLOTTER::markerHBar( const wxPoint& pos, int radius )
304 {
305  MoveTo( wxPoint( pos.x - radius, pos.y ) );
306  FinishTo( wxPoint( pos.x + radius, pos.y ) );
307 }
308 
309 
310 void PLOTTER::markerSlash( const wxPoint& pos, int radius )
311 {
312  MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
313  FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
314 }
315 
316 
317 void PLOTTER::markerBackSlash( const wxPoint& pos, int radius )
318 {
319  MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
320  FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
321 }
322 
323 
324 void PLOTTER::markerVBar( const wxPoint& pos, int radius )
325 {
326  MoveTo( wxPoint( pos.x, pos.y - radius ) );
327  FinishTo( wxPoint( pos.x, pos.y + radius ) );
328 }
329 
330 
331 void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
332 {
333  int radius = diametre / 2;
334  /* Marker are composed by a series of 'parts' superimposed; not every
335  combination make sense, obviously. Since they are used in order I
336  tried to keep the uglier/more complex constructions at the end.
337  Also I avoided the |/ |\ -/ -\ construction because they're *very*
338  ugly... if needed they could be added anyway... I'd like to see
339  a board with more than 58 drilling/slotting tools!
340  If Visual C++ supported the 0b literals they would be optimally
341  and easily encoded as an integer array. We have to do with octal */
342  static const unsigned char marker_patterns[MARKER_COUNT] = {
343  // Bit order: O Square Lozenge - | \ /
344  // First choice: simple shapes
345  0003, // X
346  0100, // O
347  0014, // +
348  0040, // Sq
349  0020, // Lz
350  // Two simple shapes
351  0103, // X O
352  0017, // X +
353  0043, // X Sq
354  0023, // X Lz
355  0114, // O +
356  0140, // O Sq
357  0120, // O Lz
358  0054, // + Sq
359  0034, // + Lz
360  0060, // Sq Lz
361  // Three simple shapes
362  0117, // X O +
363  0143, // X O Sq
364  0123, // X O Lz
365  0057, // X + Sq
366  0037, // X + Lz
367  0063, // X Sq Lz
368  0154, // O + Sq
369  0134, // O + Lz
370  0074, // + Sq Lz
371  // Four simple shapes
372  0174, // O Sq Lz +
373  0163, // X O Sq Lz
374  0157, // X O Sq +
375  0137, // X O Lz +
376  0077, // X Sq Lz +
377  // This draws *everything *
378  0177, // X O Sq Lz +
379  // Here we use the single bars... so the cross is forbidden
380  0110, // O -
381  0104, // O |
382  0101, // O /
383  0050, // Sq -
384  0044, // Sq |
385  0041, // Sq /
386  0030, // Lz -
387  0024, // Lz |
388  0021, // Lz /
389  0150, // O Sq -
390  0144, // O Sq |
391  0141, // O Sq /
392  0130, // O Lz -
393  0124, // O Lz |
394  0121, // O Lz /
395  0070, // Sq Lz -
396  0064, // Sq Lz |
397  0061, // Sq Lz /
398  0170, // O Sq Lz -
399  0164, // O Sq Lz |
400  0161, // O Sq Lz /
401  // Last resort: the backlash component (easy to confound)
402  0102, // \ O
403  0042, // \ Sq
404  0022, // \ Lz
405  0142, // \ O Sq
406  0122, // \ O Lz
407  0062, // \ Sq Lz
408  0162 // \ O Sq Lz
409  };
410  if( aShapeId >= MARKER_COUNT )
411  {
412  // Fallback shape
413  markerCircle( position, radius );
414  }
415  else
416  {
417  // Decode the pattern and draw the corresponding parts
418  unsigned char pat = marker_patterns[aShapeId];
419  if( pat & 0001 )
420  markerSlash( position, radius );
421  if( pat & 0002 )
422  markerBackSlash( position, radius );
423  if( pat & 0004 )
424  markerVBar( position, radius );
425  if( pat & 0010 )
426  markerHBar( position, radius );
427  if( pat & 0020 )
428  markerLozenge( position, radius );
429  if( pat & 0040 )
430  markerSquare( position, radius );
431  if( pat & 0100 )
432  markerCircle( position, radius );
433  }
434 }
435 
436 
437 void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
438  OUTLINE_MODE tracemode )
439 {
440  wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
441  wxSize size( end.x - start.x, end.y - start.y );
442  double orient;
443 
444  if( size.y == 0 )
445  orient = 0;
446  else if( size.x == 0 )
447  orient = 900;
448  else
449  orient = -ArcTangente( size.y, size.x );
450 
451  size.x = KiROUND( EuclideanNorm( size ) ) + width;
452  size.y = width;
453 
454  FlashPadOval( center, size, orient, tracemode, NULL );
455 }
456 
457 
458 void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width )
459 {
460  SetCurrentLineWidth( width );
461  width = currentPenWidth;
462  int radius, deltaxy, cx, cy;
463  wxSize size( aSize );
464 
465  if( size.x > size.y )
466  {
467  std::swap( size.x, size.y );
468  orient = AddAngles( orient, 900 );
469  }
470 
471  deltaxy = size.y - size.x; /* distance between centers of the oval */
472  radius = ( size.x - width ) / 2;
473  cx = -radius;
474  cy = -deltaxy / 2;
475  RotatePoint( &cx, &cy, orient );
476  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
477  cx = -radius;
478  cy = deltaxy / 2;
479  RotatePoint( &cx, &cy, orient );
480  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
481 
482  cx = radius;
483  cy = -deltaxy / 2;
484  RotatePoint( &cx, &cy, orient );
485  MoveTo( wxPoint( cx + pos.x, cy + pos.y ) );
486  cx = radius;
487  cy = deltaxy / 2;
488  RotatePoint( &cx, &cy, orient );
489  FinishTo( wxPoint( cx + pos.x, cy + pos.y ) );
490 
491  cx = 0;
492  cy = deltaxy / 2;
493  RotatePoint( &cx, &cy, orient );
494  Arc( wxPoint( cx + pos.x, cy + pos.y ),
495  orient + 1800, orient + 3600,
496  radius, FILL_TYPE::NO_FILL );
497  cx = 0;
498  cy = -deltaxy / 2;
499  RotatePoint( &cx, &cy, orient );
500  Arc( wxPoint( cx + pos.x, cy + pos.y ),
501  orient, orient + 1800,
502  radius, FILL_TYPE::NO_FILL );
503 }
504 
505 
506 void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
507  OUTLINE_MODE tracemode, void* aData )
508 {
509  if( tracemode == FILLED )
510  {
511  if( start == end )
512  {
513  Circle( start, width, FILL_TYPE::FILLED_SHAPE, 0 );
514  }
515  else
516  {
517  SetCurrentLineWidth( width );
518  MoveTo( start );
519  FinishTo( end );
520  }
521  }
522  else
523  {
524  SetCurrentLineWidth( -1 );
525  segmentAsOval( start, end, width, tracemode );
526  }
527 }
528 
529 
530 void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
531  int radius, int width, OUTLINE_MODE tracemode, void* aData )
532 {
533  if( tracemode == FILLED )
534  Arc( centre, StAngle, EndAngle, radius, FILL_TYPE::NO_FILL, width );
535  else
536  {
537  SetCurrentLineWidth( -1 );
538  Arc( centre, StAngle, EndAngle,
539  radius - ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
540  Arc( centre, StAngle, EndAngle,
541  radius + ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
542  }
543 }
544 
545 
546 void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
547  OUTLINE_MODE tracemode, void* aData )
548 {
549  if( tracemode == FILLED )
550  Rect( p1, p2, FILL_TYPE::NO_FILL, width );
551  else
552  {
553  SetCurrentLineWidth( -1 );
554  wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2,
555  p1.y - (width - currentPenWidth) / 2 );
556  wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
557  p2.y + (width - currentPenWidth) / 2 );
558  Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
559  offsetp1.x += (width - currentPenWidth);
560  offsetp1.y += (width - currentPenWidth);
561  offsetp2.x -= (width - currentPenWidth);
562  offsetp2.y -= (width - currentPenWidth);
563  Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
564  }
565 }
566 
567 
568 void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
569  OUTLINE_MODE tracemode, void* aData )
570 {
571  if( tracemode == FILLED )
572  Circle( pos, diametre, FILL_TYPE::NO_FILL, width );
573  else
574  {
575  SetCurrentLineWidth( -1 );
576  Circle( pos, diametre - width + currentPenWidth, FILL_TYPE::NO_FILL, -1 );
577  Circle( pos, diametre + width - currentPenWidth, FILL_TYPE::NO_FILL, -1 );
578  }
579 }
580 
581 
582 void PLOTTER::FilledCircle( const wxPoint& pos, int diametre,
583  OUTLINE_MODE tracemode, void* aData )
584 {
585  if( tracemode == FILLED )
586  Circle( pos, diametre, FILL_TYPE::FILLED_SHAPE, 0 );
587  else
588  {
589  SetCurrentLineWidth( -1 );
590  Circle( pos, diametre, FILL_TYPE::NO_FILL, -1 );
591  }
592 }
593 
594 
595 void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_TYPE aFill,
596  int aWidth, void * aData )
597 {
598  std::vector<wxPoint> cornerList;
599  cornerList.reserve( aCornerList.PointCount() );
600 
601  for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
602  cornerList.emplace_back( aCornerList.CPoint( ii ) );
603 
604  if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
605  cornerList.emplace_back( aCornerList.CPoint( 0 ) );
606 
607  PlotPoly( cornerList, aFill, aWidth, aData );
608 }
609 
610 
611 wxPenStyle GetwxPenStyle( PLOT_DASH_TYPE aType )
612 {
613  switch( aType )
614  {
617  return wxPENSTYLE_SOLID;
619  return wxPENSTYLE_SHORT_DASH;
620  case PLOT_DASH_TYPE::DOT:
621  return wxPENSTYLE_DOT;
623  return wxPENSTYLE_DOT_DASH;
624  default:
625  wxFAIL_MSG( "Unhandled PlotDashType" );
626  return wxPENSTYLE_SOLID;
627  }
628 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:134
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode)
Cdonvert a thick segment and plot it as an oval.
Definition: plotter.cpp:437
void FinishTo(const wxPoint &pos)
Definition: plotter.h:273
OUTLINE_MODE
Definition: outline_mode.h:24
double GetDotMarkLenIU() const
Definition: plotter.cpp:139
void markerHBar(const wxPoint &pos, int radius)
Plot a - bar centered on the position.
Definition: plotter.cpp:303
Common plot library Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF)
FILL_TYPE
Enum class FILL_TYPE is the set of fill types used in plotting or drawing enclosed areas.
Definition: fill_type.h:29
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:568
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void GetPoly(std::vector< wxPoint > &aOutput, int aMinSegLen=0)
Converts Bezier curve to a polygon.
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:437
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:76
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual function FlashPadOval
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:546
virtual void FilledCircle(const wxPoint &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:582
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_TYPE aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
#define DASH_MARK_LEN(aLineWidth)
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:157
virtual void BezierCurve(const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &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:203
bool colorMode
Definition: plotter.h:598
virtual ~PLOTTER()
Definition: plotter.cpp:67
char penState
Definition: plotter.h:601
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
double m_IUsPerDecimil
Definition: plotter.h:580
int PointCount() const
Function PointCount()
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:586
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:506
PLOTTER()
Definition: plotter.cpp:50
double GetDashGapLenIU() const
Definition: plotter.cpp:151
virtual int GetCurrentLineWidth() const
Definition: plotter.h:164
bool m_yaxisReversed
true to mirror horizontally (else vertically)
Definition: plotter.h:592
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void LineTo(const wxPoint &pos)
Definition: plotter.h:268
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:590
#define NULL
bool IsClosed() const override
Function IsClosed()
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
Definition: trigo.h:324
#define DOT_MARK_LEN(aLineWidth)
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:574
RENDER_SETTINGS * m_renderSettings
Definition: plotter.h:612
a few functions useful in geometry calculations.
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:124
virtual void Circle(const wxPoint &pos, int diametre, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void markerSlash(const wxPoint &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:310
void Marker(const wxPoint &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
Definition: plotter.cpp:331
PLOT_DASH_TYPE
Enum for choosing dashed line type.
Definition: plotter.h:93
void MoveTo(const wxPoint &pos)
Definition: plotter.h:263
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:93
double cosdecideg(double r, double a)
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
Definition: trigo.h:428
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor)
Function PlotImage Only Postscript plotters can plot bitmaps for plotters that cannot plot a bitmap,...
Definition: plotter.cpp:231
double sindecideg(double r, double a)
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians.
Definition: trigo.h:419
int currentPenWidth
Definition: plotter.h:600
double GetDashMarkLenIU() const
Definition: plotter.cpp:145
SHAPE_LINE_CHAIN.
void markerLozenge(const wxPoint &position, int radius)
Plot a lozenge centered on the position.
Definition: plotter.cpp:279
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:595
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:68
#define DASH_GAP_LEN(aLineWidth)
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:273
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:530
#define MAX_PAGE_SIZE_MILS
Definition: page_info.h:41
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:583
VECTOR2< double > DPOINT
Definition: vector2d.h:599
wxString filename
Definition: plotter.h:605
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:324
void markerSquare(const wxPoint &position, int radius)
Plot a square centered on the position.
Definition: plotter.cpp:248
void markerBackSlash(const wxPoint &pos, int radius)
Plot a \ bar centered on the position.
Definition: plotter.cpp:317
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:458
wxPenStyle GetwxPenStyle(PLOT_DASH_TYPE aType)
Convert KiCad line plot styles to wxWidgets device context styles.
Definition: plotter.cpp:611
wxSize paperSize
Definition: plotter.h:608
bool m_mirrorIsHorizontal
Definition: plotter.h:591
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
bool negativeMode
Definition: plotter.h:599