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-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
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 <base_struct.h> // FILL_T
40 
41 class COLOR_SETTINGS;
42 class SHAPE_POLY_SET;
43 class SHAPE_LINE_CHAIN;
45 
51 enum class PLOT_FORMAT
52 {
53  UNDEFINED = -1,
54  FIRST_FORMAT = 0,
56  GERBER,
57  POST,
58  DXF,
59  PDF,
60  SVG,
62 };
63 
76 enum class PLOT_TEXT_MODE
77 {
78  STROKE,
79  NATIVE,
80  PHANTOM,
81  DEFAULT
82 };
83 
87 enum class PLOT_DASH_TYPE
88 {
89  DEFAULT = -1,
90  SOLID = 0,
91  FIRST_TYPE = SOLID,
92  DASH,
93  DOT,
94  DASHDOT,
96 };
97 
105 wxPenStyle GetwxPenStyle( PLOT_DASH_TYPE aType );
106 
107 
114 class PLOTTER
115 {
116 public:
117  // These values are used as flag for pen or aperture selection
118  static const int DO_NOT_SET_LINE_WIDTH = -2; // Skip selection
119  static const int USE_DEFAULT_LINE_WIDTH = -1; // use the default pen
120 
121  PLOTTER();
122 
123  virtual ~PLOTTER();
124 
130  virtual PLOT_FORMAT GetPlotterType() const = 0;
131 
132  virtual bool StartPlot() = 0;
133  virtual bool EndPlot() = 0;
134 
135  virtual void SetNegative( bool aNegative )
136  {
137  negativeMode = aNegative;
138  }
139 
143  virtual void SetColorMode( bool aColorMode ) { colorMode = aColorMode; }
144  bool GetColorMode() const { return colorMode; }
145 
146  void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; }
148 
149  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { pageInfo = aPageSettings; }
151 
157  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
158  virtual int GetCurrentLineWidth() const { return currentPenWidth; }
159 
160  virtual void SetColor( COLOR4D color ) = 0;
161 
162  virtual void SetDash( PLOT_DASH_TYPE dashed ) = 0;
163 
164  virtual void SetCreator( const wxString& aCreator )
165  {
166  creator = aCreator;
167  }
168 
169  virtual void SetTitle( const wxString& aTitle )
170  {
171  title = aTitle;
172  }
173 
179  void AddLineToHeader( const wxString& aExtraString )
180  {
181  m_headerExtraLines.Add( aExtraString );
182  }
183 
189  {
190  m_headerExtraLines.Clear();
191  }
192 
202  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
203  double aScale, bool aMirror ) = 0;
204 
213  virtual bool OpenFile( const wxString& aFullFilename );
214 
220  double GetIUsPerDecimil() const { return m_IUsPerDecimil; }
221 
222  int GetPlotterArcLowDef() const { return m_IUsPerDecimil * 8; }
223  int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
224 
225  // Low level primitives
226  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
227  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
228  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
229  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
230 
234  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
235  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH );
236 
242  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
243  const wxPoint& aControl2, const wxPoint& aEnd,
244  int aTolerance,
245  int aLineThickness = USE_DEFAULT_LINE_WIDTH );
246 
254  virtual void PenTo( const wxPoint& pos, char plume ) = 0;
255 
256  // Convenience functions for PenTo
257  void MoveTo( const wxPoint& pos )
258  {
259  PenTo( pos, 'U' );
260  }
261 
262  void LineTo( const wxPoint& pos )
263  {
264  PenTo( pos, 'D' );
265  }
266 
267  void FinishTo( const wxPoint& pos )
268  {
269  PenTo( pos, 'D' );
270  PenTo( pos, 'Z' );
271  }
272 
273  void PenFinish()
274  {
275  // The point is not important with Z motion
276  PenTo( wxPoint( 0, 0 ), 'Z' );
277  }
278 
287  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
288  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0;
289 
299  virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
300  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL );
301 
312  virtual void PlotImage( const wxImage & aImage, const wxPoint& aPos,
313  double aScaleFactor );
314 
315  // Higher level primitives -- can be drawn as line, sketch or 'filled'
316  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
317  EDA_DRAW_MODE_T tracemode, void* aData );
318  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
319  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData );
320  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
321  EDA_DRAW_MODE_T tracemode, void* aData );
322  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
323  EDA_DRAW_MODE_T tracemode, void* aData );
324 
325  // Flash primitives
326 
334  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
335  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
336 
345  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
346  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
347 
356  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
357  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
358 
368  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
369  int aCornerRadius, double aOrient,
370  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
371 
380  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
381  SHAPE_POLY_SET* aPolygons,
382  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
383 
393  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
394  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
395  void* aData ) = 0;
396 
405  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
406  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0 ;
407 
412  virtual void Text( const wxPoint& aPos,
413  const COLOR4D aColor,
414  const wxString& aText,
415  double aOrient,
416  const wxSize& aSize,
417  enum EDA_TEXT_HJUSTIFY_T aH_justify,
418  enum EDA_TEXT_VJUSTIFY_T aV_justify,
419  int aWidth,
420  bool aItalic,
421  bool aBold,
422  bool aMultilineAllowed = false,
423  void* aData = NULL );
424 
428  static const unsigned MARKER_COUNT = 58;
429 
435  void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
436 
446  virtual void SetLayerPolarity( bool aPositive )
447  {
448  // NOP for most plotters
449  }
450 
455  virtual void SetTextMode( PLOT_TEXT_MODE mode )
456  {
457  // NOP for most plotters.
458  }
459 
460  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false )
461  {
462  // NOP for most plotters. Only for Gerber plotter
463  }
464 
465  virtual void SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches = false )
466  {
467  // NOP for most plotters. Only for SVG plotter
468  }
469 
477  virtual void StartBlock( void* aData ) {}
478 
486  virtual void EndBlock( void* aData ) {}
487 
488 
489 protected:
490  // These are marker subcomponents
494  void markerCircle( const wxPoint& pos, int radius );
495 
499  void markerHBar( const wxPoint& pos, int radius );
500 
504  void markerSlash( const wxPoint& pos, int radius );
505 
509  void markerBackSlash( const wxPoint& pos, int radius );
510 
514  void markerVBar( const wxPoint& pos, int radius );
515 
519  void markerSquare( const wxPoint& position, int radius );
520 
524  void markerLozenge( const wxPoint& position, int radius );
525 
526  // Helper function for sketched filler segment
527 
531  void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
532  EDA_DRAW_MODE_T tracemode );
533 
534  void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
535 
536  // Coordinate and scaling conversion functions
537 
543  virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
544 
549  virtual DPOINT userToDeviceSize( const wxSize& size );
550 
555  virtual double userToDeviceSize( double size ) const;
556 
557  double GetDotMarkLenIU() const;
558 
559  double GetDashMarkLenIU() const;
560 
561  double GetDashGapLenIU() const;
562 
563 protected: // variables used in most of plotters:
565  double plotScale;
566 
567  /* Caller scale (how many IUs in a decimil - always); it's a double
568  * because in eeschema there are 0.1 IUs in a decimil (eeschema
569  * always works in mils internally) while pcbnew can work in decimil
570  * or nanometers, so this value would be >= 1 */
572 
575 
578 
584 
586  FILE* outputFile;
587 
588  // Pen handling
589  bool colorMode; // true to plot in color, false to plot in black & white
590  bool negativeMode; // true to generate a negative image (PS mode mainly)
592  char penState; // Current pen state: 'U', 'D' or 'Z' (see PenTo)
593  wxPoint penLastpos; // Last pen positions; set to -1,-1 when the pen is
594  // at rest
595  wxString creator;
596  wxString filename;
597  wxString title;
599  wxSize paperSize; // Paper size in IU - not in mils
600 
601  wxArrayString m_headerExtraLines; // a set of string to print in header file
602 
604 };
605 
606 
607 class HPGL_PLOTTER : public PLOTTER
608 {
609 public:
610  HPGL_PLOTTER();
611 
612  virtual PLOT_FORMAT GetPlotterType() const override
613  {
614  return PLOT_FORMAT::HPGL;
615  }
616 
617  static wxString GetDefaultFileExtension()
618  {
619  return wxString( wxT( "plt" ) );
620  }
621 
622  virtual bool StartPlot() override;
623  virtual bool EndPlot() override;
624 
626  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
627  {
628  // This is the truth
630  }
631 
632  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
633 
634  virtual void SetColor( COLOR4D color ) override {}
635 
636  virtual void SetPenSpeed( int speed )
637  {
638  penSpeed = speed;
639  }
640 
641  virtual void SetPenNumber( int number )
642  {
643  penNumber = number;
644  }
645 
646  virtual void SetPenDiameter( double diameter );
647 
648  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
649  double aScale, bool aMirror ) override;
650  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
651  int width = USE_DEFAULT_LINE_WIDTH ) override;
652  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
653  int width = USE_DEFAULT_LINE_WIDTH ) override;
654  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
655  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
656  void * aData = NULL) override;
657 
658  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
659  EDA_DRAW_MODE_T tracemode, void* aData ) override;
660  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
661  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
662  virtual void PenTo( const wxPoint& pos, char plume ) override;
663  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
664  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
665  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
666  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
667  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
668  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
669  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
670  int aCornerRadius, double aOrient,
671  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
672  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
673  SHAPE_POLY_SET* aPolygons,
674  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
675  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
676  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
677  void* aData ) override;
678  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
679  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
680 
681 protected:
682  void penControl( char plume );
683 
684  int penSpeed;
686  double penDiameter;
687 };
688 
694 class PSLIKE_PLOTTER : public PLOTTER
695 {
696 public:
698  plotScaleAdjX( 1 ),
699  plotScaleAdjY( 1 ),
701  {
702  }
703 
707  virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
708  {
709  if( mode != PLOT_TEXT_MODE::DEFAULT )
710  m_textMode = mode;
711  }
712 
716  void SetScaleAdjust( double scaleX, double scaleY )
717  {
718  plotScaleAdjX = scaleX;
719  plotScaleAdjY = scaleY;
720  }
721 
722  // Pad routines are handled with lower level primitives
723  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
724  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
725  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
726  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
727  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
728  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
729  void* aData ) override;
730  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
731  int aCornerRadius, double aOrient,
732  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
733  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
734  SHAPE_POLY_SET* aPolygons,
735  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
736  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
737  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
738  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
739  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
740 
745  virtual void SetColor( COLOR4D color ) override;
746 
747 protected:
748  void computeTextParameters( const wxPoint& aPos,
749  const wxString& aText,
750  int aOrient,
751  const wxSize& aSize,
752  bool aMirror,
753  enum EDA_TEXT_HJUSTIFY_T aH_justify,
754  enum EDA_TEXT_VJUSTIFY_T aV_justify,
755  int aWidth,
756  bool aItalic,
757  bool aBold,
758  double *wideningFactor,
759  double *ctm_a,
760  double *ctm_b,
761  double *ctm_c,
762  double *ctm_d,
763  double *ctm_e,
764  double *ctm_f,
765  double *heightFactor );
766  void postscriptOverlinePositions( const wxString& aText, int aXSize,
767  bool aItalic, bool aBold,
768  std::vector<int> *pos_pairs );
769 
772  virtual std::string encodeStringForPlotter( const wxString& aUnicode );
773 
775  virtual void emitSetRGBColor( double r, double g, double b ) = 0;
776 
778  static const double postscriptTextAscent; // = 0.718;
779 
780  int returnPostscriptTextWidth( const wxString& aText, int aXSize,
781  bool aItalic, bool aBold );
782 
785 
788 };
789 
790 
792 {
793 public:
795  {
796  // The phantom plot in postscript is an hack and reportedly
797  // crashes Adobe's own postscript interpreter!
799  }
800 
801  static wxString GetDefaultFileExtension()
802  {
803  return wxString( wxT( "ps" ) );
804  }
805 
806  virtual PLOT_FORMAT GetPlotterType() const override
807  {
808  return PLOT_FORMAT::POST;
809  }
810 
811  virtual bool StartPlot() override;
812  virtual bool EndPlot() override;
813  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
814  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
815 
816  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
817  double aScale, bool aMirror ) override;
818  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
819  int width = USE_DEFAULT_LINE_WIDTH ) override;
820  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
821  int width = USE_DEFAULT_LINE_WIDTH ) override;
822  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
823  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
824 
825  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
826  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
827  void * aData = NULL ) override;
828 
829  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
830  double aScaleFactor ) override;
831 
832  virtual void PenTo( const wxPoint& pos, char plume ) override;
833  virtual void Text( const wxPoint& aPos,
834  const COLOR4D aColor,
835  const wxString& aText,
836  double aOrient,
837  const wxSize& aSize,
838  enum EDA_TEXT_HJUSTIFY_T aH_justify,
839  enum EDA_TEXT_VJUSTIFY_T aV_justify,
840  int aWidth,
841  bool aItalic,
842  bool aBold,
843  bool aMultilineAllowed = false,
844  void* aData = NULL ) override;
845 protected:
846  virtual void emitSetRGBColor( double r, double g, double b ) override;
847 };
848 
850 {
851 public:
853  pageTreeHandle( 0 ),
854  fontResDictHandle( 0 ),
855  pageStreamHandle( 0 ),
856  streamLengthHandle( 0 ),
857  workFile( nullptr )
858  {
859  }
860 
861  virtual PLOT_FORMAT GetPlotterType() const override
862  {
863  return PLOT_FORMAT::PDF;
864  }
865 
866  static wxString GetDefaultFileExtension()
867  {
868  return wxString( wxT( "pdf" ) );
869  }
870 
879  virtual bool OpenFile( const wxString& aFullFilename ) override;
880 
881  virtual bool StartPlot() override;
882  virtual bool EndPlot() override;
883  virtual void StartPage();
884  virtual void ClosePage();
885  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
886  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
887 
890  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
891  double aScale, bool aMirror ) override;
892  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
893  int width = USE_DEFAULT_LINE_WIDTH ) override;
894  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
895  int width = USE_DEFAULT_LINE_WIDTH ) override;
896  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
897  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
898 
899  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
900  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
901  void * aData = NULL ) override;
902 
903  virtual void PenTo( const wxPoint& pos, char plume ) override;
904 
905  virtual void Text( const wxPoint& aPos,
906  const COLOR4D aColor,
907  const wxString& aText,
908  double aOrient,
909  const wxSize& aSize,
910  enum EDA_TEXT_HJUSTIFY_T aH_justify,
911  enum EDA_TEXT_VJUSTIFY_T aV_justify,
912  int aWidth,
913  bool aItalic,
914  bool aBold,
915  bool aMultilineAllowed = false,
916  void* aData = NULL ) override;
917 
918  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
919  double aScaleFactor ) override;
920 
921 
922 protected:
925  std::string encodeStringForPlotter( const wxString& aUnicode ) override;
926 
927  virtual void emitSetRGBColor( double r, double g, double b ) override;
928  int allocPdfObject();
929  int startPdfObject(int handle = -1);
930  void closePdfObject();
931  int startPdfStream(int handle = -1);
932  void closePdfStream();
935  std::vector<int> pageHandles;
938  wxString workFilename;
939  FILE* workFile;
940  std::vector<long> xrefTable;
941 };
942 
944 {
945 public:
946  SVG_PLOTTER();
947 
948  static wxString GetDefaultFileExtension()
949  {
950  return wxString( wxT( "svg" ) );
951  }
952 
953  virtual PLOT_FORMAT GetPlotterType() const override
954  {
955  return PLOT_FORMAT::SVG;
956  }
957 
958  virtual void SetColor( COLOR4D color ) override;
959  virtual bool StartPlot() override;
960  virtual bool EndPlot() override;
961  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
962  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
963 
964  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
965  double aScale, bool aMirror ) override;
966  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
967  int width = USE_DEFAULT_LINE_WIDTH ) override;
968  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
969  int width = USE_DEFAULT_LINE_WIDTH ) override;
970  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
971  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
972 
973  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
974  const wxPoint& aControl2, const wxPoint& aEnd,
975  int aTolerance,
976  int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
977 
978  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
979  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
980  void * aData = NULL ) override;
981 
982  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
983  double aScaleFactor ) override;
984 
985  virtual void PenTo( const wxPoint& pos, char plume ) override;
986 
998  virtual void SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches = false ) override;
999 
1005  virtual void StartBlock( void* aData ) override;
1006 
1012  virtual void EndBlock( void* aData ) override;
1013 
1014  virtual void Text( const wxPoint& aPos,
1015  const COLOR4D aColor,
1016  const wxString& aText,
1017  double aOrient,
1018  const wxSize& aSize,
1019  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1020  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1021  int aWidth,
1022  bool aItalic,
1023  bool aBold,
1024  bool aMultilineAllowed = false,
1025  void* aData = NULL ) override;
1026 
1027 protected:
1028  FILL_T m_fillMode; // true if the current contour
1029  // rect, arc, circle, polygon must be filled
1030  long m_pen_rgb_color; // current rgb color value: each color has
1031  // a value 0 ... 255, and the 3 colors are
1032  // grouped in a 3x8 bits value
1033  // (written in hex to svg files)
1034  long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
1035  // some contours.
1036  bool m_graphics_changed; // true if a pen/brush parameter is modified
1037  // color, pen size, fil mode ...
1038  // the new SVG stype must be output on file
1039  PLOT_DASH_TYPE m_dashed; // plot line style
1040  bool m_useInch; // is 0 if the step size is 10**-n*mm
1041  // is 1 if the step size is 10**-n*inch
1042  // Where n is given from m_precision
1043  unsigned m_precision; // How fine the step size is
1044  // Use 3-6 (3 means um precision, 6 nm precision) in pcbnew
1045  // 3-4 in other moduls (avoid values >4 to avoid overflow)
1046  // see also comment for m_useInch.
1047 
1053  virtual void emitSetRGBColor( double r, double g, double b ) override;
1054 
1062  void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} );
1063 
1068  void setFillMode( FILL_T fill );
1069 };
1070 
1071 /* Class to handle a D_CODE when plotting a board using Standard Aperture Templates
1072  * (complex apertures need aperture macros
1073  * 5 types:
1074  * Circle (round)
1075  * Rectangle
1076  * Obround (oval)
1077  * regular polygon
1078  *
1079  * We need round apertures to plot lines, so we also defined a aperture type for plotting
1080  */
1081 #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
1082 
1084 {
1085 public:
1087  AT_CIRCLE = 1, // round aperture, to flash pads
1088  AT_RECT = 2, // rect aperture, to flash pads
1089  AT_PLOTTING = 3, // round aperture, to plot lines
1090  AT_OVAL = 4, // oval aperture, to flash pads
1091  AT_REGULAR_POLY = 5,// Regular polygon (n vertices, n = 3 .. 12, with rotation)
1092  AT_REGULAR_POLY3, // Regular polygon 3 vertices, with rotation
1093  AT_REGULAR_POLY4, // Regular polygon 4 vertices, with rotation
1094  AT_REGULAR_POLY5, // Regular polygon 5 vertices, with rotation
1095  AT_REGULAR_POLY6, // Regular polygon 6 vertices, with rotation
1096  AT_REGULAR_POLY7, // Regular polygon 7 vertices, with rotation
1097  AT_REGULAR_POLY8, // Regular polygon 8 vertices, with rotation
1098  AT_REGULAR_POLY9, // Regular polygon 9 vertices, with rotation
1099  AT_REGULAR_POLY10, // Regular polygon 10 vertices, with rotation
1100  AT_REGULAR_POLY11, // Regular polygon 11 vertices, with rotation
1101  AT_REGULAR_POLY12, // Regular polygon 12 vertices, with rotation
1102  };
1103 
1104  void SetSize( const wxSize& aSize )
1105  {
1106  m_Size = aSize;
1107  }
1108 
1109  const wxSize GetSize()
1110  {
1111  return m_Size;
1112  }
1113 
1114  void SetDiameter( int aDiameter )
1115  {
1116  m_Size.x = aDiameter;
1117  }
1118 
1120  {
1121  return m_Size.x;
1122  }
1123 
1124  void SetVerticeCount( int aCount )
1125  {
1126  if( aCount < 3 )
1127  aCount = 3;
1128  else if( aCount > 12 )
1129  aCount = 12;
1130 
1131  m_Type = (APERTURE_TYPE)(AT_REGULAR_POLY3 - 3 + aCount);
1132  }
1133 
1135  {
1136  return m_Type - AT_REGULAR_POLY3 + 3;
1137  }
1138 
1139  void SetRotation( double aRotDegree )
1140  {
1141  // The rotation is stored in 1/1000 degree
1142  m_Size.y = int( aRotDegree * 1000.0 );
1143  }
1144 
1145  double GetRotation()
1146  {
1147  // The rotation is stored in 1/1000 degree
1148  return m_Size.y / 1000.0;
1149  }
1150 
1151  // Type ( Line, rect , circulaire , ovale poly 3 to 12 vertices )
1153 
1154  // horiz and Vert size, or diameter and rotation for regular polygon
1155  // The diameter (for circle and polygons) is stored in m_Size.x
1156  // the rotation is stored in m_Size.y in 1/1000 degree
1157  wxSize m_Size;
1158 
1159  // code number ( >= 10 )
1160  int m_DCode;
1161 
1162  // the attribute attached to this aperture
1163  // Only one attribute is allowed by aperture
1164  // 0 = no specific aperture attribute
1166 };
1167 
1168 
1169 class GERBER_PLOTTER : public PLOTTER
1170 {
1171 public:
1172  GERBER_PLOTTER();
1173 
1174  virtual PLOT_FORMAT GetPlotterType() const override
1175  {
1176  return PLOT_FORMAT::GERBER;
1177  }
1178 
1179  static wxString GetDefaultFileExtension()
1180  {
1181  return wxString( wxT( "gbr" ) );
1182  }
1183 
1189  virtual bool StartPlot() override;
1190  virtual bool EndPlot() override;
1191  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
1192 
1193  // RS274X has no dashing, nor colours
1194  virtual void SetDash( PLOT_DASH_TYPE dashed ) override
1195  {
1196  }
1197 
1198  virtual void SetColor( COLOR4D color ) override {}
1199  // Currently, aScale and aMirror are not used in gerber plotter
1200  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1201  double aScale, bool aMirror ) override;
1202  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1203  int width = USE_DEFAULT_LINE_WIDTH ) override;
1204  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1205  int width = USE_DEFAULT_LINE_WIDTH ) override;
1206  virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
1207  int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
1208 
1209  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1210  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1211 
1212  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
1213  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override;
1214  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
1215  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1216  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
1217  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1222  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1223  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
1224  void* aData = nullptr ) override;
1225 
1226  virtual void PenTo( const wxPoint& pos, char plume ) override;
1227 
1228  virtual void Text( const wxPoint& aPos,
1229  const COLOR4D aColor,
1230  const wxString& aText,
1231  double aOrient,
1232  const wxSize& aSize,
1233  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1234  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1235  int aWidth,
1236  bool aItalic,
1237  bool aBold,
1238  bool aMultilineAllowed = false,
1239  void* aData = NULL ) override;
1240 
1244  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1245  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1246 
1250  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1251  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1257  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1258  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1259 
1265  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1266  int aCornerRadius, double aOrient,
1267  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1268  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1269  SHAPE_POLY_SET* aPolygons,
1270  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1276  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1277  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1278 
1279  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1280  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1281 
1287  void PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
1288  void * aData = NULL );
1289 
1294  virtual void SetLayerPolarity( bool aPositive ) override;
1295 
1306  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false ) override;
1307 
1308  void UseX2format( bool aEnable ) { m_useX2format = aEnable; }
1309  void UseX2NetAttributes( bool aEnable ) { m_useNetAttributes = aEnable; }
1310 
1316  virtual void StartBlock( void* aData ) override;
1317 
1324  virtual void EndBlock( void* aData ) override;
1325 
1329  void ClearAllAttributes();
1330 
1339  int GetOrCreateAperture( const wxSize& aSize,
1340  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1341 
1342 protected:
1351  void plotRoundRectAsRegion( const wxPoint& aRectCenter, const wxSize& aSize,
1352  int aCornerRadius, double aOrient );
1364  void plotArc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
1365  int aRadius, bool aPlotInRegion );
1366 
1372  void selectAperture( const wxSize& aSize, APERTURE::APERTURE_TYPE aType,
1373  int aApertureAttribute );
1380  void selectAperture( int aDiameter, double aPolygonRotation,
1381  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1382 
1388  void emitDcode( const DPOINT& pt, int dcode );
1389 
1398 
1404  void clearNetAttribute();
1405 
1406  // the attributes dictionary created/modifed by %TO, attached to objects, when they are created
1407  // by D01, D03, G36/G37 commands
1408  // standard attributes are .P, .C and .N
1409  // this is used by gerber readers when creating a new object. Cleared by %TD command
1410  // Note: m_objectAttributesDictionnary can store more than one attribute
1411  // the string stores the line(s) actually written to the gerber file
1412  // it can store a .P, .C or .N attribute, or 2 or 3 attributes, separated by a \n char (EOL)
1414 
1415  // The last aperture attribute generated (only one aperture attribute can be set)
1417 
1418  FILE* workFile;
1419  FILE* finalFile;
1420  wxString m_workFilename;
1421 
1425  void writeApertureList();
1426 
1427  std::vector<APERTURE> m_apertures; // The list of available apertures
1428  int m_currentApertureIdx; // The index of the current aperture in m_apertures
1429 
1430  bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
1431  int m_gerberUnitFmt; // number of digits in mantissa.
1432  // usually 6 in Inches and 5 or 6 in mm
1433  bool m_useX2format; // Add X2 file header attributes. If false, attributes
1434  // will be added as comments.
1435  bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
1436  // It will be added if this param is true, using X2 or
1437  // X1 format
1438 };
1439 
1440 
1441 class DXF_PLOTTER : public PLOTTER
1442 {
1443 public:
1445  {
1446  m_textAsLines = true;
1450  }
1451 
1452  virtual PLOT_FORMAT GetPlotterType() const override
1453  {
1454  return PLOT_FORMAT::DXF;
1455  }
1456 
1457  static wxString GetDefaultFileExtension()
1458  {
1459  return wxString( wxT( "dxf" ) );
1460  }
1461 
1465  virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
1466  {
1467  if( mode != PLOT_TEXT_MODE::DEFAULT )
1468  m_textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
1469  }
1470 
1471  virtual bool StartPlot() override;
1472  virtual bool EndPlot() override;
1473 
1474  // For now we don't use 'thick' primitives, so no line width
1475  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
1476  {
1477  currentPenWidth = 0;
1478  }
1479 
1480  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
1481 
1482  virtual void SetColor( COLOR4D color ) override;
1483 
1484  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1485  double aScale, bool aMirror ) override;
1486  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1487  int width = USE_DEFAULT_LINE_WIDTH ) override;
1488  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1489  int width = USE_DEFAULT_LINE_WIDTH ) override;
1490  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1491  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override;
1492  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1493  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1494  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
1495  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
1496  virtual void PenTo( const wxPoint& pos, char plume ) override;
1497 
1498  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1499  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1500  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1501  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1502  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1503  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1504  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1505  int aCornerRadius, double aOrient,
1506  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1507  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1508  SHAPE_POLY_SET* aPolygons,
1509  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1510  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1511  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1512  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1513  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1514 
1515  virtual void Text( const wxPoint& aPos,
1516  const COLOR4D aColor,
1517  const wxString& aText,
1518  double aOrient,
1519  const wxSize& aSize,
1520  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1521  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1522  int aWidth,
1523  bool aItalic,
1524  bool aBold,
1525  bool aMultilineAllowed = false,
1526  void* aData = NULL ) override;
1527 
1528 
1529  // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
1530  enum class DXF_UNITS
1531  {
1532  INCHES = 0,
1533  MILLIMETERS = 1
1534  };
1535 
1541  void SetUnits( DXF_UNITS aUnit );
1542 
1549  {
1550  return m_plotUnits;
1551  }
1552 
1559  double GetUnitScaling() const
1560  {
1561  return m_unitScalingFactor;
1562  }
1563 
1569  unsigned int GetMeasurementDirective() const
1570  {
1571  return m_measurementDirective;
1572  }
1573 
1574 protected:
1578 
1582 };
1583 
1584 class TITLE_BLOCK;
1585 
1586 void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK& aTitleBlock,
1587  const PAGE_INFO& aPageInfo, int aSheetNumber, int aNumberOfSheets,
1588  const wxString &aSheetDesc, const wxString &aFilename,
1589  COLOR4D aColor = COLOR4D::UNSPECIFIED );
1590 
1593 wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat );
1594 
1595 
1596 #endif // PLOT_COMMON_H_
static wxString GetDefaultFileExtension()
Definition: plotter.h:866
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
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:407
int penSpeed
Definition: plotter.h:684
double GetDotMarkLenIU() const
Definition: plotter.cpp:140
double m_unitScalingFactor
Definition: plotter.h:1580
unsigned m_precision
Definition: plotter.h:1043
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:304
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:634
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:164
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:48
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void SetDash(PLOT_DASH_TYPE dashed) override
SVG supports dashed lines.
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
void PenFinish()
Definition: plotter.h:273
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:801
void UseX2NetAttributes(bool aEnable)
Definition: plotter.h:1309
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
Postscript-likes at the moment are the only plot engines supporting bitmaps...
void plotRoundRectAsRegion(const wxPoint &aRectCenter, const wxSize &aSize, int aCornerRadius, double aOrient)
Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners.
PROJECT holds project specific data.
Definition: project.h:61
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:486
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:806
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: plotter.h:1475
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
HPGL polygon:
virtual void SetSvgCoordinatesFormat(unsigned aResolution, bool aUseInches=false) override
Function SetSvgCoordinatesFormat selection of SVG step size (number of digits needed for 1 mm or 1 in...
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...
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
void SetRotation(double aRotDegree)
Definition: plotter.h:1139
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
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:1086
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:1028
virtual void emitSetRGBColor(double r, double g, double b) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:542
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:248
unsigned int m_measurementDirective
Definition: plotter.h:1581
APERTURE_TYPE m_Type
Definition: plotter.h:1152
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:569
virtual void SetDash(PLOT_DASH_TYPE dashed) override
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:169
wxSize m_Size
Definition: plotter.h:1157
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:428
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:77
static wxString GetDefaultFileExtension()
Definition: plotter.h:948
bool m_useNetAttributes
Definition: plotter.h:1435
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:612
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:933
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
Definition: PS_plotter.cpp:762
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:143
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
Definition: plotter.h:716
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:446
DXF_UNITS m_plotUnits
Definition: plotter.h:1579
int color
Definition: DXF_plotter.cpp:61
The PSLIKE_PLOTTER class is an intermediate class to handle common routines for engines working more ...
Definition: plotter.h:694
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:964
int GetDiameter()
Definition: plotter.h:1119
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:146
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
bool m_textAsLines
Definition: plotter.h:1575
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:477
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the 'pen' to the specified direction
std::vector< int > pageHandles
Font resource dictionary.
Definition: plotter.h:935
virtual void SetDash(PLOT_DASH_TYPE dashed) override
PDF supports dashed lines.
void UseX2format(bool aEnable)
Definition: plotter.h:1308
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
void plotArc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, bool aPlotInRegion)
Plot a Gerber arc.
void SetDiameter(int aDiameter)
Definition: plotter.h:1114
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:204
bool colorMode
Definition: plotter.h:589
void SetSize(const wxSize &aSize)
Definition: plotter.h:1104
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual ~PLOTTER()
Definition: plotter.cpp:68
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:635
Definition: color4d.h:44
char penState
Definition: plotter.h:592
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:179
COLOR4D m_currentColor
Definition: plotter.h:1576
this class handle info which can be added in a gerber file as attribute of an object the GBR_INFO_TYP...
PLOT_TEXT_MODE m_textMode
How to draw text.
Definition: plotter.h:787
double m_IUsPerDecimil
Definition: plotter.h:571
void PlotWorkSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor=COLOR4D::UNSPECIFIED)
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:1430
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
wxArrayString m_headerExtraLines
Definition: plotter.h:601
virtual std::string encodeStringForPlotter(const wxString &aUnicode)
convert a wxString unicode string to a char string compatible with the accepted string plotter format...
Definition: PS_plotter.cpp:303
static wxString GetDefaultFileExtension()
Definition: plotter.h:1179
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.
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:577
wxPoint penLastpos
Definition: plotter.h:593
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
Definition: PS_plotter.cpp:108
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:460
PAGE_INFO pageInfo
Definition: plotter.h:598
virtual void SetSvgCoordinatesFormat(unsigned aResolution, bool aUseInches=false)
Definition: plotter.h:465
virtual void SetTextMode(PLOT_TEXT_MODE mode) override
DXF handles NATIVE text emitting TEXT entities.
Definition: plotter.h:1465
PLOTTER()
Definition: plotter.cpp:51
PLOT_DASH_TYPE m_dashed
Definition: plotter.h:1039
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:531
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:1559
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:938
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:222
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:152
static wxString GetDefaultFileExtension()
Definition: plotter.h:1457
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:158
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:547
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:583
virtual bool EndPlot()=0
int streamLengthHandle
Handle of the page content object.
Definition: plotter.h:937
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:810
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:262
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:119
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:214
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:1427
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:581
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
PS_PLOTTER()
Definition: plotter.h:794
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
#define NULL
wxPenStyle GetwxPenStyle(PLOT_DASH_TYPE aType)
Convert KiCad line plot styles to wxWidgets device context styles.
Definition: plotter.cpp:599
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:626
virtual void emitSetRGBColor(double r, double g, double b)=0
Virtual primitive for emitting the setrgbcolor operator.
virtual void SetTextMode(PLOT_TEXT_MODE mode) override
PS and PDF fully implement native text (for the Latin-1 subset)
Definition: plotter.h:707
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:1030
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:178
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:348
double plotScaleAdjY
Definition: plotter.h:784
int startPdfStream(int handle=-1)
Starts a PDF stream (for the page).
PLOT_FORMAT
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:51
EDA_DRAW_MODE_T
Definition: eda_text.h:63
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
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:978
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.
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:636
int m_gerberUnitFmt
Definition: plotter.h:1431
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:129
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:599
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
Definition: plotter.h:455
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
PDF can have multiple pages, so SetPageSettings can be called with the outputFile open (but not insid...
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:52
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:588
int GetVerticeCount()
Definition: plotter.h:1134
bool m_useInch
Definition: plotter.h:1040
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:565
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
std::string encodeStringForPlotter(const wxString &aUnicode) override
convert a wxString unicode string to a char string compatible with the accepted string PDF format (co...
Definition: PDF_plotter.cpp:44
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:220
RENDER_SETTINGS * m_renderSettings
Definition: plotter.h:603
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
FILE * workFile
Definition: plotter.h:939
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...
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 PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1174
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:125
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:1419
virtual void SetNegative(bool aNegative)
Definition: plotter.h:135
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: PS_plotter.cpp:522
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:311
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:332
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
PLOT_DASH_TYPE
Enum for choosing dashed line type.
Definition: plotter.h:87
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:778
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:55
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1452
int penNumber
Definition: plotter.h:685
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
bool m_useX2format
Definition: plotter.h:1433
wxString title
Definition: plotter.h:597
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:94
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:222
int fontResDictHandle
Handle to the root of the page tree object.
Definition: plotter.h:934
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:953
Base plotter engine class.
Definition: plotter.h:114
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:1109
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:232
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
Definition: plotter.h:1569
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:660
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:147
virtual void emitSetRGBColor(double r, double g, double b) override
PDF supports colors fully.
PDF_PLOTTER()
Definition: plotter.h:852
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:940
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:591
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:294
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:1145
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....
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:577
double GetDashMarkLenIU() const
Definition: plotter.cpp:146
SHAPE_LINE_CHAIN.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:507
bool m_graphics_changed
Definition: plotter.h:1036
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Circle drawing for PDF.
long m_brush_rgb_color
Definition: plotter.h:1034
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
Definition: plotter.h:784
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:1198
double penDiameter
Definition: plotter.h:686
virtual void SetPenNumber(int number)
Definition: plotter.h:641
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:280
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:586
static wxString GetDefaultFileExtension()
Definition: plotter.h:617
std::string m_objectAttributesDictionnary
Definition: plotter.h:1413
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...
PLOT_DASH_TYPE m_currentLineType
Definition: plotter.h:1577
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:274
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:223
void ClearHeaderLinesList()
Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning ...
Definition: plotter.h:188
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:158
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:377
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 bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
Color settings are a bit different than most of the settings objects in that there can be more than o...
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:1420
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:429
PLOT_TEXT_MODE
Enum for choosing which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:76
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:78
int m_apertureAttribute
Definition: plotter.h:1416
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
int m_DCode
Definition: plotter.h:1160
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:1165
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:1418
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:574
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:118
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:438
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:596
PAGE_INFO & PageSettings()
Definition: plotter.h:150
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:861
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:325
virtual void SetDash(PLOT_DASH_TYPE dashed) override
Definition: plotter.h:1194
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:249
virtual void SetDash(PLOT_DASH_TYPE dashed) override
HPGL supports dashed lines.
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:318
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:459
void SetVerticeCount(int aCount)
Definition: plotter.h:1124
int pageStreamHandle
Handles to the page objects.
Definition: plotter.h:936
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 void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
wxString creator
Definition: plotter.h:595
virtual void SetDash(PLOT_DASH_TYPE dashed)=0
wxSize paperSize
Definition: plotter.h:599
bool m_mirrorIsHorizontal
Definition: plotter.h:582
DXF_UNITS GetUnits() const
The units currently enabled for plotting.
Definition: plotter.h:1548
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Pen width setting for PDF.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:149
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 SetDash(PLOT_DASH_TYPE dashed) override
Postscript supports dashed lines.
Definition: PS_plotter.cpp:554
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
int m_currentApertureIdx
Definition: plotter.h:1428
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99
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:144
bool negativeMode
Definition: plotter.h:590