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 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 
104 class PLOTTER
105 {
106 public:
107  // These values are used as flag for pen or aperture selection
108  static const int DO_NOT_SET_LINE_WIDTH = -2; // Skip selection
109  static const int USE_DEFAULT_LINE_WIDTH = -1; // use the default pen
110 
111  PLOTTER();
112 
113  virtual ~PLOTTER();
114 
120  virtual PLOT_FORMAT GetPlotterType() const = 0;
121 
122  virtual bool StartPlot() = 0;
123  virtual bool EndPlot() = 0;
124 
125  virtual void SetNegative( bool aNegative )
126  {
127  negativeMode = aNegative;
128  }
129 
133  virtual void SetColorMode( bool aColorMode )
134  {
135  colorMode = aColorMode;
136  }
137 
138  bool GetColorMode() const
139  {
140  return colorMode;
141  }
142 
143  void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
144 
146 
147  virtual void SetPageSettings( const PAGE_INFO& aPageSettings )
148  {
149  pageInfo = aPageSettings;
150  }
151 
153  {
154  return pageInfo;
155  }
156 
162  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
163 
169  virtual void SetDefaultLineWidth( int width ) = 0;
170 
171  virtual int GetCurrentLineWidth() const
172  {
173  return currentPenWidth;
174  }
175 
176  virtual void SetColor( COLOR4D color ) = 0;
177 
178  virtual void SetDash( PLOT_DASH_TYPE dashed ) = 0;
179 
180  virtual void SetCreator( const wxString& aCreator )
181  {
182  creator = aCreator;
183  }
184 
185  virtual void SetTitle( const wxString& aTitle )
186  {
187  title = aTitle;
188  }
189 
195  void AddLineToHeader( const wxString& aExtraString )
196  {
197  m_headerExtraLines.Add( aExtraString );
198  }
199 
205  {
206  m_headerExtraLines.Clear();
207  }
208 
218  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
219  double aScale, bool aMirror ) = 0;
220 
229  virtual bool OpenFile( const wxString& aFullFilename );
230 
236  double GetIUsPerDecimil() const { return m_IUsPerDecimil; }
237 
238  int GetPlotterArcLowDef() const { return m_IUsPerDecimil * 8; }
239  int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
240 
241  // Low level primitives
242  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
243  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
244  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
245  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
246 
250  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
251  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH );
252 
258  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
259  const wxPoint& aControl2, const wxPoint& aEnd,
260  int aTolerance,
261  int aLineThickness = USE_DEFAULT_LINE_WIDTH );
262 
270  virtual void PenTo( const wxPoint& pos, char plume ) = 0;
271 
272  // Convenience functions for PenTo
273  void MoveTo( const wxPoint& pos )
274  {
275  PenTo( pos, 'U' );
276  }
277 
278  void LineTo( const wxPoint& pos )
279  {
280  PenTo( pos, 'D' );
281  }
282 
283  void FinishTo( const wxPoint& pos )
284  {
285  PenTo( pos, 'D' );
286  PenTo( pos, 'Z' );
287  }
288 
289  void PenFinish()
290  {
291  // The point is not important with Z motion
292  PenTo( wxPoint( 0, 0 ), 'Z' );
293  }
294 
303  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
304  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0;
305 
315  virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
316  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL );
317 
328  virtual void PlotImage( const wxImage & aImage, const wxPoint& aPos,
329  double aScaleFactor );
330 
331  // Higher level primitives -- can be drawn as line, sketch or 'filled'
332  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
333  EDA_DRAW_MODE_T tracemode, void* aData );
334  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
335  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData );
336  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
337  EDA_DRAW_MODE_T tracemode, void* aData );
338  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
339  EDA_DRAW_MODE_T tracemode, void* aData );
340 
341  // Flash primitives
342 
350  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
351  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
352 
361  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
362  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
363 
372  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
373  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
374 
384  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
385  int aCornerRadius, double aOrient,
386  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
387 
396  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
397  SHAPE_POLY_SET* aPolygons,
398  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
399 
409  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
410  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
411  void* aData ) = 0;
412 
421  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
422  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0 ;
423 
428  virtual void Text( const wxPoint& aPos,
429  const COLOR4D aColor,
430  const wxString& aText,
431  double aOrient,
432  const wxSize& aSize,
433  enum EDA_TEXT_HJUSTIFY_T aH_justify,
434  enum EDA_TEXT_VJUSTIFY_T aV_justify,
435  int aWidth,
436  bool aItalic,
437  bool aBold,
438  bool aMultilineAllowed = false,
439  void* aData = NULL );
440 
444  static const unsigned MARKER_COUNT = 58;
445 
451  void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
452 
462  virtual void SetLayerPolarity( bool aPositive )
463  {
464  // NOP for most plotters
465  }
466 
471  virtual void SetTextMode( PLOT_TEXT_MODE mode )
472  {
473  // NOP for most plotters.
474  }
475 
476  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false )
477  {
478  // NOP for most plotters. Only for Gerber plotter
479  }
480 
488  virtual void StartBlock( void* aData ) {}
489 
497  virtual void EndBlock( void* aData ) {}
498 
499 
500 protected:
501  // These are marker subcomponents
505  void markerCircle( const wxPoint& pos, int radius );
506 
510  void markerHBar( const wxPoint& pos, int radius );
511 
515  void markerSlash( const wxPoint& pos, int radius );
516 
520  void markerBackSlash( const wxPoint& pos, int radius );
521 
525  void markerVBar( const wxPoint& pos, int radius );
526 
530  void markerSquare( const wxPoint& position, int radius );
531 
535  void markerLozenge( const wxPoint& position, int radius );
536 
537  // Helper function for sketched filler segment
538 
542  void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
543  EDA_DRAW_MODE_T tracemode );
544 
545  void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
546 
547  // Coordinate and scaling conversion functions
548 
554  virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
555 
560  virtual DPOINT userToDeviceSize( const wxSize& size );
561 
566  virtual double userToDeviceSize( double size ) const;
567 
568  double GetDotMarkLenIU() const;
569 
570  double GetDashMarkLenIU() const;
571 
572  double GetDashGapLenIU() const;
573 
574 protected: // variables used in most of plotters:
576  double plotScale;
577 
578  /* Caller scale (how many IUs in a decimil - always); it's a double
579  * because in eeschema there are 0.1 IUs in a decimil (eeschema
580  * always works in mils internally) while pcbnew can work in decimil
581  * or nanometers, so this value would be >= 1 */
583 
586 
589 
595 
597  FILE* outputFile;
598 
599  // Pen handling
600  bool colorMode;
605  char penState;
608  wxString creator;
609  wxString filename;
610  wxString title;
613  wxSize paperSize;
614 
615  wxArrayString m_headerExtraLines;
616 
619 };
620 
621 
622 class HPGL_PLOTTER : public PLOTTER
623 {
624 public:
625  HPGL_PLOTTER();
626 
627  virtual PLOT_FORMAT GetPlotterType() const override
628  {
629  return PLOT_FORMAT::HPGL;
630  }
631 
632  static wxString GetDefaultFileExtension()
633  {
634  return wxString( wxT( "plt" ) );
635  }
636 
637  virtual bool StartPlot() override;
638  virtual bool EndPlot() override;
639 
641  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
642  {
643  // This is the truth
645  }
646 
647  virtual void SetDefaultLineWidth( int width ) override {}
648  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
649 
650  virtual void SetColor( COLOR4D color ) override {}
651 
652  virtual void SetPenSpeed( int speed )
653  {
654  penSpeed = speed;
655  }
656 
657  virtual void SetPenNumber( int number )
658  {
659  penNumber = number;
660  }
661 
662  virtual void SetPenDiameter( double diameter );
663 
664  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
665  double aScale, bool aMirror ) override;
666  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
667  int width = USE_DEFAULT_LINE_WIDTH ) override;
668  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
669  int width = USE_DEFAULT_LINE_WIDTH ) override;
670  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
671  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
672  void * aData = NULL) override;
673 
674  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
675  EDA_DRAW_MODE_T tracemode, void* aData ) override;
676  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
677  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
678  virtual void PenTo( const wxPoint& pos, char plume ) override;
679  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
680  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
681  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
682  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
683  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
684  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
685  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
686  int aCornerRadius, double aOrient,
687  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
688  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
689  SHAPE_POLY_SET* aPolygons,
690  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
691  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
692  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
693  void* aData ) override;
694  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
695  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
696 
697 protected:
698  void penControl( char plume );
699 
700  int penSpeed;
702  double penDiameter;
703 };
704 
710 class PSLIKE_PLOTTER : public PLOTTER
711 {
712 public:
714  {
715  }
716 
720  virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
721  {
722  if( mode != PLOT_TEXT_MODE::DEFAULT )
723  m_textMode = mode;
724  }
725 
726  virtual void SetDefaultLineWidth( int width ) override;
727 
731  void SetScaleAdjust( double scaleX, double scaleY )
732  {
733  plotScaleAdjX = scaleX;
734  plotScaleAdjY = scaleY;
735  }
736 
737  // Pad routines are handled with lower level primitives
738  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
739  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
740  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
741  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
742  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
743  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
744  void* aData ) override;
745  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
746  int aCornerRadius, double aOrient,
747  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
748  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
749  SHAPE_POLY_SET* aPolygons,
750  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
751  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
752  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
753  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
754  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
755 
760  virtual void SetColor( COLOR4D color ) override;
761 
762 protected:
763  void computeTextParameters( const wxPoint& aPos,
764  const wxString& aText,
765  int aOrient,
766  const wxSize& aSize,
767  bool aMirror,
768  enum EDA_TEXT_HJUSTIFY_T aH_justify,
769  enum EDA_TEXT_VJUSTIFY_T aV_justify,
770  int aWidth,
771  bool aItalic,
772  bool aBold,
773  double *wideningFactor,
774  double *ctm_a,
775  double *ctm_b,
776  double *ctm_c,
777  double *ctm_d,
778  double *ctm_e,
779  double *ctm_f,
780  double *heightFactor );
781  void postscriptOverlinePositions( const wxString& aText, int aXSize,
782  bool aItalic, bool aBold,
783  std::vector<int> *pos_pairs );
784  void fputsPostscriptString(FILE *fout, const wxString& txt);
785 
787  virtual void emitSetRGBColor( double r, double g, double b ) = 0;
788 
790  static const double postscriptTextAscent; // = 0.718;
791 
792  int returnPostscriptTextWidth( const wxString& aText, int aXSize,
793  bool aItalic, bool aBold );
794 
797 
800 };
801 
802 
804 {
805 public:
807  {
808  // The phantom plot in postscript is an hack and reportedly
809  // crashes Adobe's own postscript interpreter!
811  }
812 
813  static wxString GetDefaultFileExtension()
814  {
815  return wxString( wxT( "ps" ) );
816  }
817 
818  virtual PLOT_FORMAT GetPlotterType() const override
819  {
820  return PLOT_FORMAT::POST;
821  }
822 
823  virtual bool StartPlot() override;
824  virtual bool EndPlot() override;
825  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
826  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
827 
828  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
829  double aScale, bool aMirror ) override;
830  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
831  int width = USE_DEFAULT_LINE_WIDTH ) override;
832  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
833  int width = USE_DEFAULT_LINE_WIDTH ) override;
834  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
835  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
836 
837  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
838  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
839  void * aData = NULL ) override;
840 
841  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
842  double aScaleFactor ) override;
843 
844  virtual void PenTo( const wxPoint& pos, char plume ) override;
845  virtual void Text( const wxPoint& aPos,
846  const COLOR4D aColor,
847  const wxString& aText,
848  double aOrient,
849  const wxSize& aSize,
850  enum EDA_TEXT_HJUSTIFY_T aH_justify,
851  enum EDA_TEXT_VJUSTIFY_T aV_justify,
852  int aWidth,
853  bool aItalic,
854  bool aBold,
855  bool aMultilineAllowed = false,
856  void* aData = NULL ) override;
857 protected:
858  virtual void emitSetRGBColor( double r, double g, double b ) override;
859 };
860 
862 {
863 public:
865  {
866  // Avoid non initialized variables:
868  pageTreeHandle = 0;
869  }
870 
871  virtual PLOT_FORMAT GetPlotterType() const override
872  {
873  return PLOT_FORMAT::PDF;
874  }
875 
876  static wxString GetDefaultFileExtension()
877  {
878  return wxString( wxT( "pdf" ) );
879  }
880 
889  virtual bool OpenFile( const wxString& aFullFilename ) override;
890 
891  virtual bool StartPlot() override;
892  virtual bool EndPlot() override;
893  virtual void StartPage();
894  virtual void ClosePage();
895  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
896  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
897 
900  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
901  double aScale, bool aMirror ) override;
902  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
903  int width = USE_DEFAULT_LINE_WIDTH ) override;
904  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
905  int width = USE_DEFAULT_LINE_WIDTH ) override;
906  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
907  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
908 
909  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
910  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
911  void * aData = NULL ) override;
912 
913  virtual void PenTo( const wxPoint& pos, char plume ) override;
914 
915  virtual void Text( const wxPoint& aPos,
916  const COLOR4D aColor,
917  const wxString& aText,
918  double aOrient,
919  const wxSize& aSize,
920  enum EDA_TEXT_HJUSTIFY_T aH_justify,
921  enum EDA_TEXT_VJUSTIFY_T aV_justify,
922  int aWidth,
923  bool aItalic,
924  bool aBold,
925  bool aMultilineAllowed = false,
926  void* aData = NULL ) override;
927 
928  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
929  double aScaleFactor ) override;
930 
931 
932 protected:
933  virtual void emitSetRGBColor( double r, double g, double b ) override;
934  int allocPdfObject();
935  int startPdfObject(int handle = -1);
936  void closePdfObject();
937  int startPdfStream(int handle = -1);
938  void closePdfStream();
941  std::vector<int> pageHandles;
944  wxString workFilename;
945  FILE* workFile;
946  std::vector<long> xrefTable;
947 };
948 
950 {
951 public:
952  SVG_PLOTTER();
953 
954  static wxString GetDefaultFileExtension()
955  {
956  return wxString( wxT( "svg" ) );
957  }
958 
959  virtual PLOT_FORMAT GetPlotterType() const override
960  {
961  return PLOT_FORMAT::SVG;
962  }
963 
964  virtual void SetColor( COLOR4D color ) override;
965  virtual bool StartPlot() override;
966  virtual bool EndPlot() override;
967  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
968  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
969 
970  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
971  double aScale, bool aMirror ) override;
972  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
973  int width = USE_DEFAULT_LINE_WIDTH ) override;
974  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
975  int width = USE_DEFAULT_LINE_WIDTH ) override;
976  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
977  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
978 
979  virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
980  const wxPoint& aControl2, const wxPoint& aEnd,
981  int aTolerance,
982  int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
983 
984  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
985  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
986  void * aData = NULL ) override;
987 
988  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
989  double aScaleFactor ) override;
990 
991  virtual void PenTo( const wxPoint& pos, char plume ) override;
992 
993 
999  virtual void StartBlock( void* aData ) override;
1000 
1006  virtual void EndBlock( void* aData ) override;
1007 
1008  virtual void Text( const wxPoint& aPos,
1009  const COLOR4D aColor,
1010  const wxString& aText,
1011  double aOrient,
1012  const wxSize& aSize,
1013  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1014  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1015  int aWidth,
1016  bool aItalic,
1017  bool aBold,
1018  bool aMultilineAllowed = false,
1019  void* aData = NULL ) override;
1020 
1021 protected:
1022  FILL_T m_fillMode; // true if the current contour
1023  // rect, arc, circle, polygon must be filled
1024  long m_pen_rgb_color; // current rgb color value: each color has
1025  // a value 0 ... 255, and the 3 colors are
1026  // grouped in a 3x8 bits value
1027  // (written in hex to svg files)
1028  long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
1029  // some contours.
1030  bool m_graphics_changed; // true if a pen/brush parameter is modified
1031  // color, pen size, fil mode ...
1032  // the new SVG stype must be output on file
1033  PLOT_DASH_TYPE m_dashed; // plot line style
1034 
1040  virtual void emitSetRGBColor( double r, double g, double b ) override;
1041 
1049  void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} );
1050 
1055  void setFillMode( FILL_T fill );
1056 };
1057 
1058 /* Class to handle a D_CODE when plotting a board using Standard Aperture Templates
1059  * (complex apertures need aperture macros
1060  * 5 types:
1061  * Circle (round)
1062  * Rectangle
1063  * Obround (oval)
1064  * regular polygon
1065  *
1066  * We need round apertures to plot lines, so we also defined a aperture type for plotting
1067  */
1068 #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
1069 
1071 {
1072 public:
1074  AT_CIRCLE = 1, // round aperture, to flash pads
1075  AT_RECT = 2, // rect aperture, to flash pads
1076  AT_PLOTTING = 3, // round aperture, to plot lines
1077  AT_OVAL = 4, // oval aperture, to flash pads
1078  AT_REGULAR_POLY = 5,// Regular polygon (n vertices, n = 3 .. 12, with rotation)
1079  AT_REGULAR_POLY3, // Regular polygon 3 vertices, with rotation
1080  AT_REGULAR_POLY4, // Regular polygon 4 vertices, with rotation
1081  AT_REGULAR_POLY5, // Regular polygon 5 vertices, with rotation
1082  AT_REGULAR_POLY6, // Regular polygon 6 vertices, with rotation
1083  AT_REGULAR_POLY7, // Regular polygon 7 vertices, with rotation
1084  AT_REGULAR_POLY8, // Regular polygon 8 vertices, with rotation
1085  AT_REGULAR_POLY9, // Regular polygon 9 vertices, with rotation
1086  AT_REGULAR_POLY10, // Regular polygon 10 vertices, with rotation
1087  AT_REGULAR_POLY11, // Regular polygon 11 vertices, with rotation
1088  AT_REGULAR_POLY12, // Regular polygon 12 vertices, with rotation
1089  };
1090 
1091  void SetSize( const wxSize& aSize )
1092  {
1093  m_Size = aSize;
1094  }
1095 
1096  const wxSize GetSize()
1097  {
1098  return m_Size;
1099  }
1100 
1101  void SetDiameter( int aDiameter )
1102  {
1103  m_Size.x = aDiameter;
1104  }
1105 
1107  {
1108  return m_Size.x;
1109  }
1110 
1111  void SetVerticeCount( int aCount )
1112  {
1113  if( aCount < 3 )
1114  aCount = 3;
1115  else if( aCount > 12 )
1116  aCount = 12;
1117 
1118  m_Type = (APERTURE_TYPE)(AT_REGULAR_POLY3 - 3 + aCount);
1119  }
1120 
1122  {
1123  return m_Type - AT_REGULAR_POLY3 + 3;
1124  }
1125 
1126  void SetRotation( double aRotDegree )
1127  {
1128  // The rotation is stored in 1/1000 degree
1129  m_Size.y = int( aRotDegree * 1000.0 );
1130  }
1131 
1132  double GetRotation()
1133  {
1134  // The rotation is stored in 1/1000 degree
1135  return m_Size.y / 1000.0;
1136  }
1137 
1138  // Type ( Line, rect , circulaire , ovale poly 3 to 12 vertices )
1140 
1141  // horiz and Vert size, or diameter and rotation for regular polygon
1142  // The diameter (for circle and polygons) is stored in m_Size.x
1143  // the rotation is stored in m_Size.y in 1/1000 degree
1144  wxSize m_Size;
1145 
1146  // code number ( >= 10 )
1147  int m_DCode;
1148 
1149  // the attribute attached to this aperture
1150  // Only one attribute is allowed by aperture
1151  // 0 = no specific aperture attribute
1153 };
1154 
1155 
1156 class GERBER_PLOTTER : public PLOTTER
1157 {
1158 public:
1159  GERBER_PLOTTER();
1160 
1161  virtual PLOT_FORMAT GetPlotterType() const override
1162  {
1163  return PLOT_FORMAT::GERBER;
1164  }
1165 
1166  static wxString GetDefaultFileExtension()
1167  {
1168  return wxString( wxT( "gbr" ) );
1169  }
1170 
1176  virtual bool StartPlot() override;
1177  virtual bool EndPlot() override;
1178  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
1179  virtual void SetDefaultLineWidth( int width ) override;
1180 
1181  // RS274X has no dashing, nor colours
1182  virtual void SetDash( PLOT_DASH_TYPE dashed ) override
1183  {
1184  }
1185 
1186  virtual void SetColor( COLOR4D color ) override {}
1187  // Currently, aScale and aMirror are not used in gerber plotter
1188  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1189  double aScale, bool aMirror ) override;
1190  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1191  int width = USE_DEFAULT_LINE_WIDTH ) override;
1192  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1193  int width = USE_DEFAULT_LINE_WIDTH ) override;
1194  virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
1195  int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
1196 
1197  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1198  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1199 
1200  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
1201  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override;
1202  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
1203  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1204  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
1205  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1210  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1211  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
1212  void* aData = nullptr ) override;
1213 
1214  virtual void PenTo( const wxPoint& pos, char plume ) override;
1215 
1216  virtual void Text( const wxPoint& aPos,
1217  const COLOR4D aColor,
1218  const wxString& aText,
1219  double aOrient,
1220  const wxSize& aSize,
1221  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1222  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1223  int aWidth,
1224  bool aItalic,
1225  bool aBold,
1226  bool aMultilineAllowed = false,
1227  void* aData = NULL ) override;
1228 
1232  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1233  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1234 
1238  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1239  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1245  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1246  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1247 
1253  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1254  int aCornerRadius, double aOrient,
1255  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1256  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1257  SHAPE_POLY_SET* aPolygons,
1258  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1264  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1265  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1266 
1267  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1268  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1269 
1275  void PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
1276  void * aData = NULL );
1277 
1282  virtual void SetLayerPolarity( bool aPositive ) override;
1283 
1294  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false ) override;
1295 
1296  void UseX2format( bool aEnable ) { m_useX2format = aEnable; }
1297  void UseX2NetAttributes( bool aEnable ) { m_useNetAttributes = aEnable; }
1298 
1304  virtual void StartBlock( void* aData ) override;
1305 
1312  virtual void EndBlock( void* aData ) override;
1313 
1317  void ClearAllAttributes();
1318 
1327  int GetOrCreateAperture( const wxSize& aSize,
1328  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1329 
1330 protected:
1336  void selectAperture( const wxSize& aSize, APERTURE::APERTURE_TYPE aType,
1337  int aApertureAttribute );
1344  void selectAperture( int aDiameter, double aPolygonRotation,
1345  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1346 
1352  void emitDcode( const DPOINT& pt, int dcode );
1353 
1362 
1368  void clearNetAttribute();
1369 
1370  // the attributes dictionary created/modifed by %TO, attached to objects, when they are created
1371  // by D01, D03, G36/G37 commands
1372  // standard attributes are .P, .C and .N
1373  // this is used by gerber readers when creating a new object. Cleared by %TD command
1374  // Note: m_objectAttributesDictionnary can store more than one attribute
1375  // the string stores the line(s) actually written to the gerber file
1376  // it can store a .P, .C or .N attribute, or 2 or 3 attributes, separated by a \n char (EOL)
1378 
1379  // The last aperture attribute generated (only one aperture attribute can be set)
1381 
1382  FILE* workFile;
1383  FILE* finalFile;
1384  wxString m_workFilename;
1385 
1389  void writeApertureList();
1390 
1391  std::vector<APERTURE> m_apertures; // The list of available apertures
1392  int m_currentApertureIdx; // The index of the current aperture in m_apertures
1393 
1394  bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
1395  int m_gerberUnitFmt; // number of digits in mantissa.
1396  // usually 6 in Inches and 5 or 6 in mm
1397  bool m_useX2format; // In recent gerber files, attributes are added.
1398  // Attributes in file header will be added using X2 format if true
1399  // If false (X1 format), these attributes will be added as comments.
1400  bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
1401  // It will be added if this param is true, using X2 or X1 format
1402 };
1403 
1404 
1405 class DXF_PLOTTER : public PLOTTER
1406 {
1407 public:
1409  {
1410  textAsLines = true;
1414  }
1415 
1416  virtual PLOT_FORMAT GetPlotterType() const override
1417  {
1418  return PLOT_FORMAT::DXF;
1419  }
1420 
1421  static wxString GetDefaultFileExtension()
1422  {
1423  return wxString( wxT( "dxf" ) );
1424  }
1425 
1429  virtual void SetTextMode( PLOT_TEXT_MODE mode ) override
1430  {
1431  if( mode != PLOT_TEXT_MODE::DEFAULT )
1432  textAsLines = ( mode != PLOT_TEXT_MODE::NATIVE );
1433  }
1434 
1435  virtual bool StartPlot() override;
1436  virtual bool EndPlot() override;
1437 
1438  // For now we don't use 'thick' primitives, so no line width
1439  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
1440  {
1441  currentPenWidth = 0;
1442  }
1443 
1444  virtual void SetDefaultLineWidth( int width ) override
1445  {
1446  // DXF lines are infinitesimal
1447  defaultPenWidth = 0;
1448  }
1449 
1450  virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
1451 
1452  virtual void SetColor( COLOR4D color ) override;
1453 
1454  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1455  double aScale, bool aMirror ) override;
1456  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1457  int width = USE_DEFAULT_LINE_WIDTH ) override;
1458  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1459  int width = USE_DEFAULT_LINE_WIDTH ) override;
1460  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1461  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override;
1462  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1463  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1464  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
1465  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
1466  virtual void PenTo( const wxPoint& pos, char plume ) override;
1467 
1468  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1469  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1470  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1471  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1472  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1473  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1474  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1475  int aCornerRadius, double aOrient,
1476  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1477  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1478  SHAPE_POLY_SET* aPolygons,
1479  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1480  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1481  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1482  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1483  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1484 
1485  virtual void Text( const wxPoint& aPos,
1486  const COLOR4D aColor,
1487  const wxString& aText,
1488  double aOrient,
1489  const wxSize& aSize,
1490  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1491  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1492  int aWidth,
1493  bool aItalic,
1494  bool aBold,
1495  bool aMultilineAllowed = false,
1496  void* aData = NULL ) override;
1497 
1498 
1499  // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
1500  enum class DXF_UNITS
1501  {
1502  INCHES = 0,
1503  MILLIMETERS = 1
1504  };
1505 
1511  void SetUnits( DXF_UNITS aUnit );
1512 
1519  {
1520  return m_plotUnits;
1521  }
1522 
1529  double GetUnitScaling() const
1530  {
1531  return m_unitScalingFactor;
1532  }
1533 
1539  unsigned int GetMeasurementDirective() const
1540  {
1541  return m_measurementDirective;
1542  }
1543 
1544 protected:
1548 
1552 };
1553 
1554 class TITLE_BLOCK;
1555 void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
1556  const PAGE_INFO& aPageInfo,
1557  int aSheetNumber, int aNumberOfSheets,
1558  const wxString &aSheetDesc,
1559  const wxString &aFilename,
1560  const COLOR4D aColor = COLOR4D::UNSPECIFIED );
1561 
1564 wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat );
1565 
1566 
1567 #endif // PLOT_COMMON_H_
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
static wxString GetDefaultFileExtension()
Definition: plotter.h:876
void FinishTo(const wxPoint &pos)
Definition: plotter.h:283
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:412
int penSpeed
Definition: plotter.h:700
double GetDotMarkLenIU() const
Definition: plotter.cpp:139
double m_unitScalingFactor
Definition: plotter.h:1550
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:303
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:650
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:180
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 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:289
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:813
void UseX2NetAttributes(bool aEnable)
Definition: plotter.h:1297
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:497
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:818
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: plotter.h:1439
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...
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
void SetRotation(double aRotDegree)
Definition: plotter.h:1126
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:1073
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:1022
virtual void emitSetRGBColor(double r, double g, double b) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:545
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:256
unsigned int m_measurementDirective
Definition: plotter.h:1551
APERTURE_TYPE m_Type
Definition: plotter.h:1139
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:568
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:185
wxSize m_Size
Definition: plotter.h:1144
bool textAsLines
Definition: plotter.h:1545
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:444
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:82
static wxString GetDefaultFileExtension()
Definition: plotter.h:954
bool m_useNetAttributes
Definition: plotter.h:1400
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:627
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:939
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
Definition: PS_plotter.cpp:765
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:133
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
Definition: plotter.h:731
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:462
DXF_UNITS m_plotUnits
Definition: plotter.h:1549
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:710
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:967
int GetDiameter()
Definition: plotter.h:1106
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:488
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:941
virtual void SetDash(PLOT_DASH_TYPE dashed) override
PDF supports dashed lines.
void UseX2format(bool aEnable)
Definition: plotter.h:1296
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:1101
virtual void BezierCurve(const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH)
Generic fallback: Cubic Bezier curve rendered as a polyline In Kicad the bezier curves have 4 control...
Definition: plotter.cpp:203
bool colorMode
Definition: plotter.h:600
void SetSize(const wxSize &aSize)
Definition: plotter.h:1091
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual ~PLOTTER()
Definition: plotter.cpp:73
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:638
char penState
Current pen state: 'U', 'D' or 'Z' (see PenTo)
Definition: plotter.h:605
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:195
COLOR4D m_currentColor
Definition: plotter.h:1546
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:799
double m_IUsPerDecimil
Definition: plotter.h:582
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:1394
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:615
static wxString GetDefaultFileExtension()
Definition: plotter.h:1166
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:647
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:588
wxPoint penLastpos
Last pen positions; set to -1,-1 when the pen is at rest.
Definition: plotter.h:607
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
Definition: PS_plotter.cpp:116
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:476
PAGE_INFO pageInfo
Definition: plotter.h:611
virtual void SetTextMode(PLOT_TEXT_MODE mode) override
DXF handles NATIVE text emitting TEXT entities.
Definition: plotter.h:1429
PLOTTER()
Definition: plotter.cpp:56
PLOT_DASH_TYPE m_dashed
Definition: plotter.h:1033
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:530
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:1529
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:944
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:232
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:151
static wxString GetDefaultFileExtension()
Definition: plotter.h:1421
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:171
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:546
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:594
virtual bool EndPlot()=0
int streamLengthHandle
Handle of the page content object.
Definition: plotter.h:943
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:813
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:278
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:109
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:222
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:1391
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:592
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
PS_PLOTTER()
Definition: plotter.h:806
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
#define NULL
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:53
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:641
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:720
SHAPE_POLY_SET.
COLOR_SETTINGS * ColorSettings()
Definition: plotter.h:145
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:1024
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:186
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:353
double plotScaleAdjY
Definition: plotter.h:796
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:59
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:981
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:652
int m_gerberUnitFmt
Definition: plotter.h:1395
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:137
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:602
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
Definition: plotter.h:471
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...
Definition: PDF_plotter.cpp:66
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:60
COLOR_SETTINGS * m_colors
a set of string to print in header file
Definition: plotter.h:618
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:591
int GetVerticeCount()
Definition: plotter.h:1121
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:576
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:236
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:945
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:1161
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:124
virtual void 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:1383
virtual void SetNegative(bool aNegative)
Definition: plotter.h:125
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: PS_plotter.cpp:528
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:310
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:331
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 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:790
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1416
int penNumber
Definition: plotter.h:701
void MoveTo(const wxPoint &pos)
Definition: plotter.h:273
bool m_useX2format
Definition: plotter.h:1397
wxString title
Definition: plotter.h:610
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:99
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:238
int fontResDictHandle
Handle to the root of the page tree object.
Definition: plotter.h:940
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:959
Base plotter engine class.
Definition: plotter.h:104
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:1096
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor)
Function PlotImage Only Postscript plotters can plot bitmaps for plotters that cannot plot a bitmap,...
Definition: plotter.cpp:231
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
Definition: plotter.h:1539
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:663
void fputsPostscriptString(FILE *fout, const wxString &txt)
Write on a stream a string escaped for postscript/PDF.
Definition: PS_plotter.cpp:314
virtual void emitSetRGBColor(double r, double g, double b) override
PDF supports colors fully.
PDF_PLOTTER()
Definition: plotter.h:864
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:946
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:603
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:302
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:1132
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:602
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:580
double GetDashMarkLenIU() const
Definition: plotter.cpp:145
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: plotter.h:1444
SHAPE_LINE_CHAIN.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:506
bool m_graphics_changed
Definition: plotter.h:1030
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:1028
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
Definition: plotter.h:796
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:1186
double penDiameter
Definition: plotter.h:702
virtual void SetPenNumber(int number)
Definition: plotter.h:657
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:279
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:597
static wxString GetDefaultFileExtension()
Definition: plotter.h:632
std::string m_objectAttributesDictionnary
Definition: plotter.h:1377
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:1547
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:273
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void SetColorSettings(COLOR_SETTINGS *aSettings)
Definition: plotter.h:143
virtual void SetColor(COLOR4D color) override
The DXF exporter handles 'colors' as layers...
int GetPlotterArcHighDef() const
Definition: plotter.h:239
void ClearHeaderLinesList()
Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning ...
Definition: plotter.h:204
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:157
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:382
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.
Definition: PDF_plotter.cpp:50
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:1384
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:435
Definition: colors.h:45
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:86
int m_apertureAttribute
Definition: plotter.h:1380
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
int m_DCode
Definition: plotter.h:1147
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:1152
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:1382
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:585
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:108
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:437
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:609
PAGE_INFO & PageSettings()
Definition: plotter.h:152
virtual PLOT_FORMAT GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:871
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:324
virtual void SetDash(PLOT_DASH_TYPE dashed) override
Definition: plotter.h:1182
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:248
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:317
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:458
void SetVerticeCount(int aCount)
Definition: plotter.h:1111
int pageStreamHandle
Handles to the page objects.
Definition: plotter.h:942
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:608
virtual void SetDash(PLOT_DASH_TYPE dashed)=0
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:613
bool m_mirrorIsHorizontal
Definition: plotter.h:593
DXF_UNITS GetUnits() const
The units currently enabled for plotting.
Definition: plotter.h:1518
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Pen width setting for PDF.
Definition: PDF_plotter.cpp:92
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:147
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:557
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
int m_currentApertureIdx
Definition: plotter.h:1392
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40
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:138
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:601