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