KiCad PCB EDA Suite
plotter.h
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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2016-2017 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 
32 #ifndef PLOT_COMMON_H_
33 #define PLOT_COMMON_H_
34 
35 #include <vector>
36 #include <math/box2.h>
37 #include <gr_text.h>
38 #include <page_info.h>
39 #include <eda_text.h> // FILL_T
40 
41 class SHAPE_POLY_SET;
42 class SHAPE_LINE_CHAIN;
44 
50 enum PlotFormat {
60 };
61 
79 };
80 
89 };
90 
97 class PLOTTER
98 {
99 public:
100  // These values are used as flag for pen or aperture selection
101  static const int DO_NOT_SET_LINE_WIDTH = -2; // Skip selection
102  static const int USE_DEFAULT_LINE_WIDTH = -1; // use the default pen
103 
104  PLOTTER();
105 
106  virtual ~PLOTTER();
107 
113  virtual PlotFormat GetPlotterType() const = 0;
114 
115  virtual bool StartPlot() = 0;
116  virtual bool EndPlot() = 0;
117 
118  virtual void SetNegative( bool aNegative )
119  {
120  negativeMode = aNegative;
121  }
122 
126  virtual void SetColorMode( bool aColorMode )
127  {
128  colorMode = aColorMode;
129  }
130 
131  bool GetColorMode() const
132  {
133  return colorMode;
134  }
135 
136  virtual void SetPageSettings( const PAGE_INFO& aPageSettings );
137 
143  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
144 
150  virtual void SetDefaultLineWidth( int width ) = 0;
151 
152  virtual int GetCurrentLineWidth() const
153  {
154  return currentPenWidth;
155  }
156 
157  virtual void SetColor( COLOR4D color ) = 0;
158 
159  virtual void SetDash( int dashed ) = 0;
160 
161  virtual void SetCreator( const wxString& aCreator )
162  {
163  creator = aCreator;
164  }
165 
166  virtual void SetTitle( const wxString& aTitle )
167  {
168  title = aTitle;
169  }
170 
176  void AddLineToHeader( const wxString& aExtraString )
177  {
178  m_headerExtraLines.Add( aExtraString );
179  }
180 
186  {
187  m_headerExtraLines.Clear();
188  }
189 
199  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
200  double aScale, bool aMirror ) = 0;
201 
210  virtual bool OpenFile( const wxString& aFullFilename );
211 
217  double GetIUsPerDecimil() const { return m_IUsPerDecimil; }
218 
219  int GetPlotterArcLowDef() const { return m_IUsPerDecimil * 8; }
220  int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
221 
222  // Low level primitives
223  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
224  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
225  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
226  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
227 
231  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
232  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH );
233 
239  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
240  const wxPoint& aControl2, const wxPoint& aEnd,
241  int aTolerance,
242  int aLineThickness = USE_DEFAULT_LINE_WIDTH );
243 
251  virtual void PenTo( const wxPoint& pos, char plume ) = 0;
252 
253  // Convenience functions for PenTo
254  void MoveTo( const wxPoint& pos )
255  {
256  PenTo( pos, 'U' );
257  }
258 
259  void LineTo( const wxPoint& pos )
260  {
261  PenTo( pos, 'D' );
262  }
263 
264  void FinishTo( const wxPoint& pos )
265  {
266  PenTo( pos, 'D' );
267  PenTo( pos, 'Z' );
268  }
269 
270  void PenFinish()
271  {
272  // The point is not important with Z motion
273  PenTo( wxPoint( 0, 0 ), 'Z' );
274  }
275 
284  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
285  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0;
286 
296  virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
297  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL );
298 
309  virtual void PlotImage( const wxImage & aImage, const wxPoint& aPos,
310  double aScaleFactor );
311 
312  // Higher level primitives -- can be drawn as line, sketch or 'filled'
313  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
314  EDA_DRAW_MODE_T tracemode, void* aData );
315  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
316  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData );
317  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
318  EDA_DRAW_MODE_T tracemode, void* aData );
319  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
320  EDA_DRAW_MODE_T tracemode, void* aData );
321 
322  // Flash primitives
323 
331  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
332  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
333 
342  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
343  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
344 
353  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
354  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
355 
365  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
366  int aCornerRadius, double aOrient,
367  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
368 
377  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
378  SHAPE_POLY_SET* aPolygons,
379  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
380 
390  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
391  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
392  void* aData ) = 0;
393 
402  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
403  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0 ;
404 
409  virtual void Text( const wxPoint& aPos,
410  const COLOR4D aColor,
411  const wxString& aText,
412  double aOrient,
413  const wxSize& aSize,
414  enum EDA_TEXT_HJUSTIFY_T aH_justify,
415  enum EDA_TEXT_VJUSTIFY_T aV_justify,
416  int aWidth,
417  bool aItalic,
418  bool aBold,
419  bool aMultilineAllowed = false,
420  void* aData = NULL );
421 
425  static const unsigned MARKER_COUNT = 58;
426 
432  void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
433 
443  virtual void SetLayerPolarity( bool aPositive )
444  {
445  // NOP for most plotters
446  }
447 
452  virtual void SetTextMode( PlotTextMode mode )
453  {
454  // NOP for most plotters.
455  }
456 
457  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false )
458  {
459  // NOP for most plotters. Only for Gerber plotter
460  }
461 
469  virtual void StartBlock( void* aData ) {}
470 
478  virtual void EndBlock( void* aData ) {}
479 
480 
481 protected:
482  // These are marker subcomponents
486  void markerCircle( const wxPoint& pos, int radius );
487 
491  void markerHBar( const wxPoint& pos, int radius );
492 
496  void markerSlash( const wxPoint& pos, int radius );
497 
501  void markerBackSlash( const wxPoint& pos, int radius );
502 
506  void markerVBar( const wxPoint& pos, int radius );
507 
511  void markerSquare( const wxPoint& position, int radius );
512 
516  void markerLozenge( const wxPoint& position, int radius );
517 
518  // Helper function for sketched filler segment
519 
523  void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
524  EDA_DRAW_MODE_T tracemode );
525 
526  void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
527 
528  // Coordinate and scaling conversion functions
529 
535  virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
536 
541  virtual DPOINT userToDeviceSize( const wxSize& size );
542 
547  virtual double userToDeviceSize( double size ) const;
548 
549  double GetDotMarkLenIU() const;
550 
551  double GetDashMarkLenIU() const;
552 
553  double GetDashGapLenIU() const;
554 
555 protected: // variables used in most of plotters:
557  double plotScale;
558 
559  /* Caller scale (how many IUs in a decimil - always); it's a double
560  * because in eeschema there are 0.1 IUs in a decimil (eeschema
561  * always works in mils internally) while pcbnew can work in decimil
562  * or nanometers, so this value would be >= 1 */
564 
567 
569  wxPoint plotOffset;
570 
576 
578  FILE* outputFile;
579 
580  // Pen handling
581  bool colorMode;
586  char penState;
588  wxPoint penLastpos;
589  wxString creator;
590  wxString filename;
591  wxString title;
594  wxSize paperSize;
595 
596  wxArrayString m_headerExtraLines;
597 };
598 
599 
600 class HPGL_PLOTTER : public PLOTTER
601 {
602 public:
603  HPGL_PLOTTER();
604 
605  virtual PlotFormat GetPlotterType() const override
606  {
607  return PLOT_FORMAT_HPGL;
608  }
609 
610  static wxString GetDefaultFileExtension()
611  {
612  return wxString( wxT( "plt" ) );
613  }
614 
615  virtual bool StartPlot() override;
616  virtual bool EndPlot() override;
617 
619  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
620  {
621  // This is the truth
623  }
624 
625  virtual void SetDefaultLineWidth( int width ) override {}
626  virtual void SetDash( int dashed ) override;
627 
628  virtual void SetColor( COLOR4D color ) override {}
629 
630  virtual void SetPenSpeed( int speed )
631  {
632  penSpeed = speed;
633  }
634 
635  virtual void SetPenNumber( int number )
636  {
637  penNumber = number;
638  }
639 
640  virtual void SetPenDiameter( double diameter );
641 
642  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
643  double aScale, bool aMirror ) override;
644  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
645  int width = USE_DEFAULT_LINE_WIDTH ) override;
646  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
647  int width = USE_DEFAULT_LINE_WIDTH ) override;
648  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
649  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
650  void * aData = NULL) override;
651 
652  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
653  EDA_DRAW_MODE_T tracemode, void* aData ) override;
654  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
655  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
656  virtual void PenTo( const wxPoint& pos, char plume ) override;
657  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
658  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
659  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
660  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
661  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
662  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
663  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
664  int aCornerRadius, double aOrient,
665  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
666  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
667  SHAPE_POLY_SET* aPolygons,
668  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
669  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
670  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
671  void* aData ) override;
672  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
673  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
674 
675 protected:
676  void penControl( char plume );
677 
678  int penSpeed;
680  double penDiameter;
681 };
682 
688 class PSLIKE_PLOTTER : public PLOTTER
689 {
690 public:
693  {
694  }
695 
699  virtual void SetTextMode( PlotTextMode mode ) override
700  {
701  if( mode != PLOTTEXTMODE_DEFAULT )
702  m_textMode = mode;
703  }
704 
705  virtual void SetDefaultLineWidth( int width ) override;
706 
710  void SetScaleAdjust( double scaleX, double scaleY )
711  {
712  plotScaleAdjX = scaleX;
713  plotScaleAdjY = scaleY;
714  }
715 
716  // Pad routines are handled with lower level primitives
717  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
718  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
719  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
720  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
721  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
722  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
723  void* aData ) override;
724  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
725  int aCornerRadius, double aOrient,
726  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
727  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
728  SHAPE_POLY_SET* aPolygons,
729  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
730  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
731  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
732  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
733  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
734 
739  virtual void SetColor( COLOR4D color ) override;
740 
741 protected:
742  void computeTextParameters( const wxPoint& aPos,
743  const wxString& aText,
744  int aOrient,
745  const wxSize& aSize,
746  bool aMirror,
747  enum EDA_TEXT_HJUSTIFY_T aH_justify,
748  enum EDA_TEXT_VJUSTIFY_T aV_justify,
749  int aWidth,
750  bool aItalic,
751  bool aBold,
752  double *wideningFactor,
753  double *ctm_a,
754  double *ctm_b,
755  double *ctm_c,
756  double *ctm_d,
757  double *ctm_e,
758  double *ctm_f,
759  double *heightFactor );
760  void postscriptOverlinePositions( const wxString& aText, int aXSize,
761  bool aItalic, bool aBold,
762  std::vector<int> *pos_pairs );
763  void fputsPostscriptString(FILE *fout, const wxString& txt);
764 
766  virtual void emitSetRGBColor( double r, double g, double b ) = 0;
767 
769  static const double postscriptTextAscent; // = 0.718;
770 
771  int returnPostscriptTextWidth( const wxString& aText, int aXSize,
772  bool aItalic, bool aBold );
773 
776 
779 };
780 
781 
783 {
784 public:
786  {
787  // The phantom plot in postscript is an hack and reportedly
788  // crashes Adobe's own postscript interpreter!
790  }
791 
792  static wxString GetDefaultFileExtension()
793  {
794  return wxString( wxT( "ps" ) );
795  }
796 
797  virtual PlotFormat GetPlotterType() const override
798  {
799  return PLOT_FORMAT_POST;
800  }
801 
802  virtual bool StartPlot() override;
803  virtual bool EndPlot() override;
804  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
805  virtual void SetDash( int dashed ) override;
806 
807  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
808  double aScale, bool aMirror ) override;
809  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
810  int width = USE_DEFAULT_LINE_WIDTH ) override;
811  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
812  int width = USE_DEFAULT_LINE_WIDTH ) override;
813  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
814  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
815 
816  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
817  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
818  void * aData = NULL ) override;
819 
820  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
821  double aScaleFactor ) override;
822 
823  virtual void PenTo( const wxPoint& pos, char plume ) override;
824  virtual void Text( const wxPoint& aPos,
825  const COLOR4D aColor,
826  const wxString& aText,
827  double aOrient,
828  const wxSize& aSize,
829  enum EDA_TEXT_HJUSTIFY_T aH_justify,
830  enum EDA_TEXT_VJUSTIFY_T aV_justify,
831  int aWidth,
832  bool aItalic,
833  bool aBold,
834  bool aMultilineAllowed = false,
835  void* aData = NULL ) override;
836 protected:
837  virtual void emitSetRGBColor( double r, double g, double b ) override;
838 };
839 
841 {
842 public:
844  {
845  // Avoid non initialized variables:
847  pageTreeHandle = 0;
848  }
849 
850  virtual PlotFormat GetPlotterType() const override
851  {
852  return PLOT_FORMAT_PDF;
853  }
854 
855  static wxString GetDefaultFileExtension()
856  {
857  return wxString( wxT( "pdf" ) );
858  }
859 
868  virtual bool OpenFile( const wxString& aFullFilename ) override;
869 
870  virtual bool StartPlot() override;
871  virtual bool EndPlot() override;
872  virtual void StartPage();
873  virtual void ClosePage();
874  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
875  virtual void SetDash( int dashed ) override;
876 
879  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
880  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
881  double aScale, bool aMirror ) override;
882  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
883  int width = USE_DEFAULT_LINE_WIDTH ) override;
884  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
885  int width = USE_DEFAULT_LINE_WIDTH ) override;
886  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
887  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
888 
889  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
890  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
891  void * aData = NULL ) override;
892 
893  virtual void PenTo( const wxPoint& pos, char plume ) override;
894 
895  virtual void Text( const wxPoint& aPos,
896  const COLOR4D aColor,
897  const wxString& aText,
898  double aOrient,
899  const wxSize& aSize,
900  enum EDA_TEXT_HJUSTIFY_T aH_justify,
901  enum EDA_TEXT_VJUSTIFY_T aV_justify,
902  int aWidth,
903  bool aItalic,
904  bool aBold,
905  bool aMultilineAllowed = false,
906  void* aData = NULL ) override;
907 
908  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
909  double aScaleFactor ) override;
910 
911 
912 protected:
913  virtual void emitSetRGBColor( double r, double g, double b ) override;
914  int allocPdfObject();
915  int startPdfObject(int handle = -1);
916  void closePdfObject();
917  int startPdfStream(int handle = -1);
918  void closePdfStream();
921  std::vector<int> pageHandles;
924  wxString workFilename;
925  FILE* workFile;
926  std::vector<long> xrefTable;
927 };
928 
930 {
931 public:
932  SVG_PLOTTER();
933 
934  static wxString GetDefaultFileExtension()
935  {
936  return wxString( wxT( "svg" ) );
937  }
938 
939  virtual PlotFormat GetPlotterType() const override
940  {
941  return PLOT_FORMAT_SVG;
942  }
943 
944  virtual void SetColor( COLOR4D color ) override;
945  virtual bool StartPlot() override;
946  virtual bool EndPlot() override;
947  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
948  virtual void SetDash( int dashed ) override;
949 
950  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
951  double aScale, bool aMirror ) override;
952  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
953  int width = USE_DEFAULT_LINE_WIDTH ) override;
954  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
955  int width = USE_DEFAULT_LINE_WIDTH ) override;
956  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
957  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
958 
959  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
960  const wxPoint& aControl2, const wxPoint& aEnd,
961  int aTolerance,
962  int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
963 
964  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
965  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
966  void * aData = NULL ) override;
967 
968  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
969  double aScaleFactor ) override;
970 
971  virtual void PenTo( const wxPoint& pos, char plume ) override;
972 
973 
979  virtual void StartBlock( void* aData ) override;
980 
986  virtual void EndBlock( void* aData ) override;
987 
988  virtual void Text( const wxPoint& aPos,
989  const COLOR4D aColor,
990  const wxString& aText,
991  double aOrient,
992  const wxSize& aSize,
993  enum EDA_TEXT_HJUSTIFY_T aH_justify,
994  enum EDA_TEXT_VJUSTIFY_T aV_justify,
995  int aWidth,
996  bool aItalic,
997  bool aBold,
998  bool aMultilineAllowed = false,
999  void* aData = NULL ) override;
1000 
1001 protected:
1002  FILL_T m_fillMode; // true if the current contour
1003  // rect, arc, circle, polygon must be filled
1004  long m_pen_rgb_color; // current rgb color value: each color has
1005  // a value 0 ... 255, and the 3 colors are
1006  // grouped in a 3x8 bits value
1007  // (written in hex to svg files)
1008  long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
1009  // some contours.
1010  bool m_graphics_changed; // true if a pen/brush parameter is modified
1011  // color, pen size, fil mode ...
1012  // the new SVG stype must be output on file
1013  int m_dashed; // 0 = plot solid line style
1014  // 1 = plot dashed line style
1015  // 2 = plot dotted line style
1016  // 3 = plot dash-dot line style
1017 
1023  virtual void emitSetRGBColor( double r, double g, double b ) override;
1024 
1032  void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} );
1033 
1038  void setFillMode( FILL_T fill );
1039 };
1040 
1041 /* Class to handle a D_CODE when plotting a board using Standard Aperture Templates
1042  * (complex apertures need aperture macros
1043  * 5 types:
1044  * Circle (round)
1045  * Rectangle
1046  * Obround (oval)
1047  * regular polygon
1048  *
1049  * We need round apertures to plot lines, so we also defined a aperture type for plotting
1050  */
1051 #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
1052 
1054 {
1055 public:
1057  AT_CIRCLE = 1, // round aperture, to flash pads
1058  AT_RECT = 2, // rect aperture, to flash pads
1059  AT_PLOTTING = 3, // round aperture, to plot lines
1060  AT_OVAL = 4, // oval aperture, to flash pads
1061  AT_REGULAR_POLY = 5,// Regular polygon (n vertices, n = 3 .. 12, with rotation)
1062  AT_REGULAR_POLY3, // Regular polygon 3 vertices, with rotation
1063  AT_REGULAR_POLY4, // Regular polygon 4 vertices, with rotation
1064  AT_REGULAR_POLY5, // Regular polygon 5 vertices, with rotation
1065  AT_REGULAR_POLY6, // Regular polygon 6 vertices, with rotation
1066  AT_REGULAR_POLY7, // Regular polygon 7 vertices, with rotation
1067  AT_REGULAR_POLY8, // Regular polygon 8 vertices, with rotation
1068  AT_REGULAR_POLY9, // Regular polygon 9 vertices, with rotation
1069  AT_REGULAR_POLY10, // Regular polygon 10 vertices, with rotation
1070  AT_REGULAR_POLY11, // Regular polygon 11 vertices, with rotation
1071  AT_REGULAR_POLY12, // Regular polygon 12 vertices, with rotation
1072  };
1073 
1074  void SetSize( const wxSize& aSize )
1075  {
1076  m_Size = aSize;
1077  }
1078 
1079  const wxSize GetSize()
1080  {
1081  return m_Size;
1082  }
1083 
1084  void SetDiameter( int aDiameter )
1085  {
1086  m_Size.x = aDiameter;
1087  }
1088 
1090  {
1091  return m_Size.x;
1092  }
1093 
1094  void SetVerticeCount( int aCount )
1095  {
1096  if( aCount < 3 )
1097  aCount = 3;
1098  else if( aCount > 12 )
1099  aCount = 12;
1100 
1101  m_Type = (APERTURE_TYPE)(AT_REGULAR_POLY3 - 3 + aCount);
1102  }
1103 
1105  {
1106  return m_Type - AT_REGULAR_POLY3 + 3;
1107  }
1108 
1109  void SetRotation( double aRotDegree )
1110  {
1111  // The rotation is stored in 1/1000 degree
1112  m_Size.y = int( aRotDegree * 1000.0 );
1113  }
1114 
1115  double GetRotation()
1116  {
1117  // The rotation is stored in 1/1000 degree
1118  return m_Size.y / 1000.0;
1119  }
1120 
1121  // Type ( Line, rect , circulaire , ovale poly 3 to 12 vertices )
1123 
1124  // horiz and Vert size, or diameter and rotation for regular polygon
1125  // The diameter (for circle and polygons) is stored in m_Size.x
1126  // the rotation is stored in m_Size.y in 1/1000 degree
1127  wxSize m_Size;
1128 
1129  // code number ( >= 10 )
1130  int m_DCode;
1131 
1132  // the attribute attached to this aperture
1133  // Only one attribute is allowed by aperture
1134  // 0 = no specific aperture attribute
1136 };
1137 
1138 
1139 class GERBER_PLOTTER : public PLOTTER
1140 {
1141 public:
1142  GERBER_PLOTTER();
1143 
1144  virtual PlotFormat GetPlotterType() const override
1145  {
1146  return PLOT_FORMAT_GERBER;
1147  }
1148 
1149  static wxString GetDefaultFileExtension()
1150  {
1151  return wxString( wxT( "gbr" ) );
1152  }
1153 
1159  virtual bool StartPlot() override;
1160  virtual bool EndPlot() override;
1161  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
1162  virtual void SetDefaultLineWidth( int width ) override;
1163 
1164  // RS274X has no dashing, nor colours
1165  virtual void SetDash( int dashed ) override {}
1166  virtual void SetColor( COLOR4D color ) override {}
1167  // Currently, aScale and aMirror are not used in gerber plotter
1168  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1169  double aScale, bool aMirror ) override;
1170  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1171  int width = USE_DEFAULT_LINE_WIDTH ) override;
1172  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1173  int width = USE_DEFAULT_LINE_WIDTH ) override;
1174  virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
1175  int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
1176 
1177  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1178  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1179 
1180  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
1181  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override;
1182  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
1183  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1184  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
1185  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1190  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1191  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
1192  void* aData = nullptr ) override;
1193 
1194  virtual void PenTo( const wxPoint& pos, char plume ) override;
1195 
1196  virtual void Text( const wxPoint& aPos,
1197  const COLOR4D aColor,
1198  const wxString& aText,
1199  double aOrient,
1200  const wxSize& aSize,
1201  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1202  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1203  int aWidth,
1204  bool aItalic,
1205  bool aBold,
1206  bool aMultilineAllowed = false,
1207  void* aData = NULL ) override;
1208 
1212  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1213  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1214 
1218  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1219  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1225  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1226  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1227 
1233  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1234  int aCornerRadius, double aOrient,
1235  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1236  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1237  SHAPE_POLY_SET* aPolygons,
1238  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1244  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1245  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1246 
1247  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1248  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1249 
1255  void PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
1256  void * aData = NULL );
1257 
1262  virtual void SetLayerPolarity( bool aPositive ) override;
1263 
1274  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false ) override;
1275 
1276  void UseX2format( bool aEnable ) { m_useX2format = aEnable; }
1277  void UseX2NetAttributes( bool aEnable ) { m_useNetAttributes = aEnable; }
1278 
1284  virtual void StartBlock( void* aData ) override;
1285 
1292  virtual void EndBlock( void* aData ) override;
1293 
1297  void ClearAllAttributes();
1298 
1307  int GetOrCreateAperture( const wxSize& aSize,
1308  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1309 
1310 protected:
1316  void selectAperture( const wxSize& aSize, APERTURE::APERTURE_TYPE aType,
1317  int aApertureAttribute );
1324  void selectAperture( int aDiameter, double aPolygonRotation,
1325  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1326 
1332  void emitDcode( const DPOINT& pt, int dcode );
1333 
1342 
1348  void clearNetAttribute();
1349 
1350  // the attributes dictionary created/modifed by %TO, attached to objects, when they are created
1351  // by D01, D03, G36/G37 commands
1352  // standard attributes are .P, .C and .N
1353  // this is used by gerber readers when creating a new object. Cleared by %TD command
1354  // Note: m_objectAttributesDictionnary can store more than one attribute
1355  // the string stores the line(s) actually written to the gerber file
1356  // it can store a .P, .C or .N attribute, or 2 or 3 attributes, separated by a \n char (EOL)
1358 
1359  // The last aperture attribute generated (only one aperture attribute can be set)
1361 
1362  FILE* workFile;
1363  FILE* finalFile;
1364  wxString m_workFilename;
1365 
1369  void writeApertureList();
1370 
1371  std::vector<APERTURE> m_apertures; // The list of available apertures
1372  int m_currentApertureIdx; // The index of the current aperture in m_apertures
1373 
1374  bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
1375  int m_gerberUnitFmt; // number of digits in mantissa.
1376  // usually 6 in Inches and 5 or 6 in mm
1377  bool m_useX2format; // In recent gerber files, attributes are added.
1378  // Attributes in file header will be added using X2 format if true
1379  // If false (X1 format), these attributes will be added as comments.
1380  bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
1381  // It will be added if this param is true, using X2 or X1 format
1382 };
1383 
1384 
1385 class DXF_PLOTTER : public PLOTTER
1386 {
1387 public:
1389  {
1390  textAsLines = true;
1392  m_currentLineType = 0;
1394  }
1395 
1396  virtual PlotFormat GetPlotterType() const override
1397  {
1398  return PLOT_FORMAT_DXF;
1399  }
1400 
1401  static wxString GetDefaultFileExtension()
1402  {
1403  return wxString( wxT( "dxf" ) );
1404  }
1405 
1409  virtual void SetTextMode( PlotTextMode mode ) override
1410  {
1411  if( mode != PLOTTEXTMODE_DEFAULT )
1412  textAsLines = ( mode != PLOTTEXTMODE_NATIVE );
1413  }
1414 
1415  virtual bool StartPlot() override;
1416  virtual bool EndPlot() override;
1417 
1418  // For now we don't use 'thick' primitives, so no line width
1419  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
1420  {
1421  currentPenWidth = 0;
1422  }
1423 
1424  virtual void SetDefaultLineWidth( int width ) override
1425  {
1426  // DXF lines are infinitesimal
1427  defaultPenWidth = 0;
1428  }
1429 
1430  virtual void SetDash( int dashed ) override;
1431 
1432  virtual void SetColor( COLOR4D color ) override;
1433 
1434  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1435  double aScale, bool aMirror ) override;
1436  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1437  int width = USE_DEFAULT_LINE_WIDTH ) override;
1438  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1439  int width = USE_DEFAULT_LINE_WIDTH ) override;
1440  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1441  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override;
1442  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1443  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1444  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
1445  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
1446  virtual void PenTo( const wxPoint& pos, char plume ) override;
1447 
1448  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1449  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1450  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1451  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1452  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1453  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1454  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1455  int aCornerRadius, double aOrient,
1456  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1457  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1458  SHAPE_POLY_SET* aPolygons,
1459  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1460  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1461  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1462  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1463  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1464 
1465  virtual void Text( const wxPoint& aPos,
1466  const COLOR4D aColor,
1467  const wxString& aText,
1468  double aOrient,
1469  const wxSize& aSize,
1470  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1471  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1472  int aWidth,
1473  bool aItalic,
1474  bool aBold,
1475  bool aMultilineAllowed = false,
1476  void* aData = NULL ) override;
1477 
1478 
1479  // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
1481  {
1484  };
1485 
1491  void SetUnits( DXF_UNITS aUnit );
1492 
1499  {
1500  return m_plotUnits;
1501  }
1502 
1509  double GetUnitScaling() const
1510  {
1511  return m_unitScalingFactor;
1512  }
1513 
1519  unsigned int GetMeasurementDirective() const
1520  {
1521  return m_measurementDirective;
1522  }
1523 
1524 protected:
1528 
1532 };
1533 
1534 class TITLE_BLOCK;
1535 void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
1536  const PAGE_INFO& aPageInfo,
1537  int aSheetNumber, int aNumberOfSheets,
1538  const wxString &aSheetDesc,
1539  const wxString &aFilename,
1540  const COLOR4D aColor = COLOR4D::UNSPECIFIED );
1541 
1544 wxString GetDefaultPlotExtension( PlotFormat aFormat );
1545 
1546 
1547 #endif // PLOT_COMMON_H_
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
static wxString GetDefaultFileExtension()
Definition: plotter.h:855
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:939
void FinishTo(const wxPoint &pos)
Definition: plotter.h:264
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Roundrect pad at the moment are not handled as aperture, since they require aperture macros TODO: alw...
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:410
int penSpeed
Definition: plotter.h:678
double GetDotMarkLenIU() const
Definition: plotter.cpp:138
double m_unitScalingFactor
Definition: plotter.h:1530
void writeApertureList()
Generate the table of D codes.
void markerHBar(const wxPoint &pos, int radius)
Plot a - bar centered on the position.
Definition: plotter.cpp:302
void closePdfStream()
Finish the current PDF stream (writes the deferred length, too)
void clearNetAttribute()
clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object a...
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:628
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
void PenFinish()
Definition: plotter.h:270
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Trapezoidal pad at the moment are never handled as aperture, since they require aperture macros TODO:...
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
static wxString GetDefaultFileExtension()
Definition: plotter.h:792
void UseX2NetAttributes(bool aEnable)
Definition: plotter.h:1277
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
Postscript-likes at the moment are the only plot engines supporting bitmaps...
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
Definition: plotter.h:478
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: plotter.h:1419
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
HPGL polygon:
int GetOrCreateAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
virtual void SetLayerPolarity(bool aPositive) override
Change the plot polarity and begin a new layer Used to 'scratch off' silk screen away from solder mas...
void SetRotation(double aRotDegree)
Definition: plotter.h:1109
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor=COLOR4D::UNSPECIFIED)
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
APERTURE_TYPE
Definition: plotter.h:1056
virtual bool StartPlot()=0
virtual void EndBlock(void *aData) override
calling this function allows one to define the end of a group of drawing items the group is started b...
virtual bool EndPlot() override
FILL_T m_fillMode
Definition: plotter.h:1002
virtual void emitSetRGBColor(double r, double g, double b) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:543
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadTrapez flash a trapezoidal pad
Definition: PS_plotter.cpp:254
unsigned int m_measurementDirective
Definition: plotter.h:1531
APERTURE_TYPE m_Type
Definition: plotter.h:1122
virtual void SetColor(COLOR4D color)=0
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:560
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring.
void setFillMode(FILL_T fill)
function setFillMode() prepare parameters for setSVGPlotStyle()
virtual void StartPage()
Starts a new page in the PDF document.
virtual void SetTitle(const wxString &aTitle)
Definition: plotter.h:166
wxSize m_Size
Definition: plotter.h:1127
bool textAsLines
Definition: plotter.h:1525
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:425
virtual void SetDash(int dashed) override
PDF supports dashed lines.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:81
static wxString GetDefaultFileExtension()
Definition: plotter.h:934
bool m_useNetAttributes
Definition: plotter.h:1380
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
DXF trapezoidal pad: only sketch mode is supported.
int pageTreeHandle
Definition: plotter.h:919
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
Definition: PS_plotter.cpp:763
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
Definition: plotter.h:710
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
print a Gerber net attribute object record.
virtual void SetLayerPolarity(bool aPositive)
Function SetLayerPolarity sets current Gerber layer polarity to positive or negative by writing %LPD*...
Definition: plotter.h:443
DXF_UNITS m_plotUnits
Definition: plotter.h:1529
int color
Definition: DXF_plotter.cpp:62
The PSLIKE_PLOTTER class is an intermediate class to handle common routines for engines working more ...
Definition: plotter.h:688
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual bool EndPlot() override
Definition: PS_plotter.cpp:965
int GetDiameter()
Definition: plotter.h:1089
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
void setSVGPlotStyle(bool aIsGroup=true, const std::string &aExtraStyle={})
function setSVGPlotStyle() output the string which define pen and brush color, shape,...
virtual void SetPenDiameter(double diameter)
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
Definition: plotter.h:469
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:850
std::vector< int > pageHandles
Font resource dictionary.
Definition: plotter.h:921
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
void UseX2format(bool aEnable)
Definition: plotter.h:1276
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
void SetDiameter(int aDiameter)
Definition: plotter.h:1084
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:202
bool colorMode
Definition: plotter.h:581
void SetSize(const wxSize &aSize)
Definition: plotter.h:1074
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual ~PLOTTER()
Definition: plotter.cpp:72
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Function PlotPoly.
Definition: PS_plotter.cpp:636
char penState
Current pen state: 'U', 'D' or 'Z' (see PenTo)
Definition: plotter.h:586
void AddLineToHeader(const wxString &aExtraString)
Function AddLineToHeader Add a line to the list of free lines to print at the beginning of the file.
Definition: plotter.h:176
COLOR4D m_currentColor
Definition: plotter.h:1526
this class handle info which can be added in a gerber file as attribute of an object the GBR_INFO_TYP...
double m_IUsPerDecimil
Definition: plotter.h:563
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Function PlotPoly.
bool m_gerberUnitInch
Definition: plotter.h:1374
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:589
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot,...
Definition: title_block.h:40
wxArrayString m_headerExtraLines
Definition: plotter.h:596
static wxString GetDefaultFileExtension()
Definition: plotter.h:1149
virtual bool StartPlot() override
At the start of the HPGL plot pen speed and number are requested.
virtual void FlashPadOval(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled oval flashes are handled as aperture in the 90 degree positions only.
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: plotter.h:625
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:569
wxPoint penLastpos
Last pen positions; set to -1,-1 when the pen is at rest.
Definition: plotter.h:588
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
Definition: PS_plotter.cpp:115
virtual bool StartPlot() override
Function StartPlot Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
Definition: plotter.h:457
PAGE_INFO pageInfo
Definition: plotter.h:592
PLOTTER()
Definition: plotter.cpp:55
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:522
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadCustom
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
Definition: plotter.h:1509
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
HPGL rectangle: fill not supported.
wxString workFilename
Handle to the deferred stream length.
Definition: plotter.h:924
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: gr_text.cpp:215
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Polygon plotting for PDF.
double GetDashGapLenIU() const
Definition: plotter.cpp:150
static wxString GetDefaultFileExtension()
Definition: plotter.h:1401
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:538
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
virtual bool EndPlot() override
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream)
bool m_yaxisReversed
true to mirror horizontally (else vertically)
Definition: plotter.h:575
virtual bool EndPlot()=0
int streamLengthHandle
Handle of the page content object.
Definition: plotter.h:923
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:811
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
void LineTo(const wxPoint &pos)
Definition: plotter.h:259
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1144
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadCircle
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
Definition: PS_plotter.cpp:220
virtual void PlotPoly(const std::vector< wxPoint > &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.
std::vector< APERTURE > m_apertures
Definition: plotter.h:1371
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:573
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
PS_PLOTTER()
Definition: plotter.h:785
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:52
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
HPGL doesn't handle line thickness or color.
Definition: plotter.h:619
virtual void emitSetRGBColor(double r, double g, double b)=0
Virtual primitive for emitting the setrgbcolor operator.
Class SHAPE_POLY_SET.
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
The PDF engine can't directly plot arcs, it uses the base emulation.
long m_pen_rgb_color
Definition: plotter.h:1004
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
Definition: PS_plotter.cpp:185
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i....
Definition: PS_plotter.cpp:351
double plotScaleAdjY
Definition: plotter.h:775
int startPdfStream(int handle=-1)
Starts a PDF stream (for the page).
EDA_DRAW_MODE_T
Definition: eda_text.h:59
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
Definition: PS_plotter.cpp:979
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
virtual void SetTextMode(PlotTextMode mode)
Change the current text mode.
Definition: plotter.h:452
int startPdfObject(int handle=-1)
Open a new PDF object and returns the handle if the parameter is -1.
virtual void SetPenSpeed(int speed)
Definition: plotter.h:630
int m_gerberUnitFmt
Definition: plotter.h:1375
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
Definition: PS_plotter.cpp:136
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadRoundRect
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
Definition: PS_plotter.cpp:600
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PDF_plotter.cpp:69
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:59
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:589
int GetVerticeCount()
Definition: plotter.h:1104
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:557
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
virtual bool StartPlot() override
The code within this function creates SVG files header.
double GetIUsPerDecimil() const
The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establ...
Definition: plotter.h:217
virtual void SetDash(int dashed) override
HPGL supports dashed lines.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
DXF rectangle: fill not supported.
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadOval
virtual void SetDash(int dashed) override
Postscript supports dashed lines.
Definition: PS_plotter.cpp:555
FILE * workFile
Definition: plotter.h:925
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, 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...
int m_currentLineType
Definition: plotter.h:1527
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:123
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
FILE * finalFile
Definition: plotter.h:1363
virtual void SetNegative(bool aNegative)
Definition: plotter.h:118
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: PS_plotter.cpp:526
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
void markerSlash(const wxPoint &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:309
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide a...
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
void closePdfObject()
Close the current PDF object.
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
void Marker(const wxPoint &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
Definition: plotter.cpp:330
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
virtual void SetDefaultLineWidth(int width)=0
Set the default line width.
virtual void FlashPadRect(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
DXF rectangular pad: alwayd done in sketch mode.
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
Definition: plotter.h:769
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
int penNumber
Definition: plotter.h:679
void MoveTo(const wxPoint &pos)
Definition: plotter.h:254
bool m_useX2format
Definition: plotter.h:1377
wxString title
Definition: plotter.h:591
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
Flash a regular polygon.
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modifies coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:98
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Rectangles in PDF.
int GetPlotterArcLowDef() const
Definition: plotter.h:219
int fontResDictHandle
Handle to the root of the page tree object.
Definition: plotter.h:920
Base plotter engine class.
Definition: plotter.h:97
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadRect
const wxSize GetSize()
Definition: plotter.h:1079
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:230
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
Definition: plotter.h:1519
virtual void SetTextMode(PlotTextMode mode) override
PS and PDF fully implement native text (for the Latin-1 subset)
Definition: plotter.h:699
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
Postscript-likes at the moment are the only plot engines supporting bitmaps...
Definition: PS_plotter.cpp:661
void fputsPostscriptString(FILE *fout, const wxString &txt)
Write on a stream a string escaped for postscript/PDF.
Definition: PS_plotter.cpp:312
virtual void emitSetRGBColor(double r, double g, double b) override
PDF supports colors fully.
PDF_PLOTTER()
Definition: plotter.h:843
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...
std::vector< long > xrefTable
Temporary file to costruct the stream before zipping.
Definition: plotter.h:926
virtual void Arc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
int currentPenWidth
Definition: plotter.h:584
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
Definition: PS_plotter.cpp:300
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
double GetRotation()
Definition: plotter.h:1115
void PlotGerberRegion(const std::vector< wxPoint > &aCornerList, void *aData=NULL)
Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA....
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:583
virtual bool EndPlot() override
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadOval
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:578
double GetDashMarkLenIU() const
Definition: plotter.cpp:144
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: plotter.h:1424
Class SHAPE_LINE_CHAIN.
virtual PlotFormat GetPlotterType() const =0
Returns the effective plot engine in use.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:505
bool m_graphics_changed
Definition: plotter.h:1010
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Circle drawing for PDF.
wxString GetDefaultPlotExtension(PlotFormat aFormat)
Returns the default plot extension for a format.
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:605
long m_brush_rgb_color
Definition: plotter.h:1008
PlotDashType
Enum for choosing dashed line type.
Definition: plotter.h:84
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1396
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
Definition: plotter.h:775
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:1166
double penDiameter
Definition: plotter.h:680
virtual void SetPenNumber(int number)
Definition: plotter.h:635
virtual void EndBlock(void *aData) override
calling this function allows one to define the end of a group of drawing items the group is started b...
void markerLozenge(const wxPoint &position, int radius)
Plot a lozenge centered on the position.
Definition: plotter.cpp:278
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:578
static wxString GetDefaultFileExtension()
Definition: plotter.h:610
std::string m_objectAttributesDictionnary
Definition: plotter.h:1357
virtual void emitSetRGBColor(double r, double g, double b) override
function emitSetRGBColor() initialize m_pen_rgb_color from reduced values r, g ,b ( reduced values ar...
PlotTextMode
Enum for choosing which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:74
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:272
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(COLOR4D color) override
The DXF exporter handles 'colors' as layers...
int GetPlotterArcHighDef() const
Definition: plotter.h:220
virtual void SetDash(int dashed) override
void ClearHeaderLinesList()
Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning ...
Definition: plotter.h:185
virtual void SetDash(int dashed)=0
virtual void FlashPadOval(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
DXF oval pad: always done in sketch mode.
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Function SetGerberCoordinatesFormat selection of Gerber units and resolution (number of digits in man...
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:156
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:42
void postscriptOverlinePositions(const wxString &aText, int aXSize, bool aItalic, bool aBold, std::vector< int > *pos_pairs)
Computes the x coordinates for the overlining in a string of text.
Definition: PS_plotter.cpp:380
virtual void FlashPadRect(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled rect flashes are handled as aperture in the 0 90 180 or 270 degree orientation only and as pol...
virtual void SetDash(int dashed) override
SVG supports dashed lines.
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
Definition: PDF_plotter.cpp:49
virtual void StartBlock(void *aData) override
calling this function allows one to define the beginning of a group of drawing items (used in SVG for...
wxString m_workFilename
Definition: plotter.h:1364
void computeTextParameters(const wxPoint &aPos, const wxString &aText, int aOrient, const wxSize &aSize, bool aMirror, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, double *wideningFactor, double *ctm_a, double *ctm_b, double *ctm_c, double *ctm_d, double *ctm_e, double *ctm_f, double *heightFactor)
This is the core for postscript/PDF text alignment It computes the transformation matrix to generate ...
Definition: PS_plotter.cpp:433
Definition: colors.h:45
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadOval
Definition: PS_plotter.cpp:85
int m_apertureAttribute
Definition: plotter.h:1360
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
PDF can have multiple pages, so SetPageSettings can be called with the outputFile open (but not insid...
Definition: PDF_plotter.cpp:64
int m_DCode
Definition: plotter.h:1130
virtual void SetTextMode(PlotTextMode mode) override
DXF handles NATIVE text emitting TEXT entities.
Definition: plotter.h:1409
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
void penControl(char plume)
Pen control logic (remove redundant pen activations)
int m_ApertureAttribute
Definition: plotter.h:1135
virtual bool StartPlot() override
The PDF engine supports multiple pages; the first one is opened 'for free' the following are to be cl...
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
FILE * workFile
Definition: plotter.h:1362
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:566
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode)
Cdonvert a thick segment and plot it as an oval.
Definition: plotter.cpp:436
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadTrapez flash a trapezoidal pad
wxString filename
Definition: plotter.h:590
virtual void SetDash(int dashed) override
Definition: plotter.h:1165
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:323
PlotTextMode m_textMode
How to draw text.
Definition: plotter.h:778
int allocPdfObject()
Allocate a new handle in the table of the PDF object.
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadTrapez flash a trapezoidal pad
void markerSquare(const wxPoint &position, int radius)
Plot a square centered on the position.
Definition: plotter.cpp:247
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
void markerBackSlash(const wxPoint &pos, int radius)
Plot a \ bar centered on the position.
Definition: plotter.cpp:316
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:457
void SetVerticeCount(int aCount)
Definition: plotter.h:1094
int pageStreamHandle
Handles to the page objects.
Definition: plotter.h:922
virtual void BezierCurve(const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: Cubic Bezier curve rendered as a polyline In Kicad the bezier curves have 4 control...
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:797
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
wxString creator
Definition: plotter.h:589
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:594
bool m_mirrorIsHorizontal
Definition: plotter.h:574
DXF_UNITS GetUnits() const
The units currently enabled for plotting.
Definition: plotter.h:1498
int m_dashed
Definition: plotter.h:1013
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Pen width setting for PDF.
Definition: PDF_plotter.cpp:95
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Function PlotPoly.
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
int m_currentApertureIdx
Definition: plotter.h:1372
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
PDF images are handles as inline, not XObject streams...
bool GetColorMode() const
Definition: plotter.h:131
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:582