KiCad PCB EDA Suite
plotter.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
32 #ifndef PLOT_COMMON_H_
33 #define PLOT_COMMON_H_
34 
35 #include <vector>
36 #include <math/box2.h>
37 #include <gr_text.h>
38 #include <page_info.h>
39 #include <eda_text.h> // FILL_T
40 
41 class SHAPE_POLY_SET;
42 class SHAPE_LINE_CHAIN;
44 
50 enum PlotFormat {
60 };
61 
79 };
80 
89 };
90 
97 class PLOTTER
98 {
99 public:
100  // These values are used as flag for pen or aperture selection
101  static const int DO_NOT_SET_LINE_WIDTH = -2; // Skip selection
102  static const int USE_DEFAULT_LINE_WIDTH = -1; // use the default pen
103 
104  PLOTTER();
105 
106  virtual ~PLOTTER();
107 
113  virtual PlotFormat GetPlotterType() const = 0;
114 
115  virtual bool StartPlot() = 0;
116  virtual bool EndPlot() = 0;
117 
118  virtual void SetNegative( bool aNegative )
119  {
120  negativeMode = aNegative;
121  }
122 
126  virtual void SetColorMode( bool aColorMode )
127  {
128  colorMode = aColorMode;
129  }
130 
131  bool GetColorMode() const
132  {
133  return colorMode;
134  }
135 
136  virtual void SetPageSettings( const PAGE_INFO& aPageSettings );
137 
143  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
144 
150  virtual void SetDefaultLineWidth( int width ) = 0;
151 
152  virtual int GetCurrentLineWidth() const
153  {
154  return currentPenWidth;
155  }
156 
157  virtual void SetColor( COLOR4D color ) = 0;
158 
159  virtual void SetDash( int dashed ) = 0;
160 
161  virtual void SetCreator( const wxString& aCreator )
162  {
163  creator = aCreator;
164  }
165 
166  virtual void SetTitle( const wxString& aTitle )
167  {
168  title = aTitle;
169  }
170 
176  void AddLineToHeader( const wxString& aExtraString )
177  {
178  m_headerExtraLines.Add( aExtraString );
179  }
180 
186  {
187  m_headerExtraLines.Clear();
188  }
189 
199  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
200  double aScale, bool aMirror ) = 0;
201 
210  virtual bool OpenFile( const wxString& aFullFilename );
211 
217  double GetIUsPerDecimil() const { return m_IUsPerDecimil; }
218 
219  int GetPlotterArcLowDef() const { return m_IUsPerDecimil * 8; }
220  int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
221 
222  // Low level primitives
223  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
224  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
225  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
226  int width = USE_DEFAULT_LINE_WIDTH ) = 0;
227 
231  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
232  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH );
233 
241  virtual void PenTo( const wxPoint& pos, char plume ) = 0;
242 
243  // Convenience functions for PenTo
244  void MoveTo( const wxPoint& pos )
245  {
246  PenTo( pos, 'U' );
247  }
248 
249  void LineTo( const wxPoint& pos )
250  {
251  PenTo( pos, 'D' );
252  }
253 
254  void FinishTo( const wxPoint& pos )
255  {
256  PenTo( pos, 'D' );
257  PenTo( pos, 'Z' );
258  }
259 
260  void PenFinish()
261  {
262  // The point is not important with Z motion
263  PenTo( wxPoint( 0, 0 ), 'Z' );
264  }
265 
274  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill,
275  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0;
276 
286  virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
287  int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL );
288 
299  virtual void PlotImage( const wxImage & aImage, const wxPoint& aPos,
300  double aScaleFactor );
301 
302  // Higher level primitives -- can be drawn as line, sketch or 'filled'
303  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
304  EDA_DRAW_MODE_T tracemode, void* aData );
305  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
306  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData );
307  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
308  EDA_DRAW_MODE_T tracemode, void* aData );
309  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
310  EDA_DRAW_MODE_T tracemode, void* aData );
311 
312  // Flash primitives
313 
321  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
322  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
323 
332  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
333  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
334 
343  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
344  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
345 
355  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
356  int aCornerRadius, double aOrient,
357  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
358 
367  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
368  SHAPE_POLY_SET* aPolygons,
369  EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0;
370 
380  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
381  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
382  void* aData ) = 0;
383 
392  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
393  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) = 0 ;
394 
399  virtual void Text( const wxPoint& aPos,
400  const COLOR4D aColor,
401  const wxString& aText,
402  double aOrient,
403  const wxSize& aSize,
404  enum EDA_TEXT_HJUSTIFY_T aH_justify,
405  enum EDA_TEXT_VJUSTIFY_T aV_justify,
406  int aWidth,
407  bool aItalic,
408  bool aBold,
409  bool aMultilineAllowed = false,
410  void* aData = NULL );
411 
415  static const unsigned MARKER_COUNT = 58;
416 
422  void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
423 
433  virtual void SetLayerPolarity( bool aPositive )
434  {
435  // NOP for most plotters
436  }
437 
442  virtual void SetTextMode( PlotTextMode mode )
443  {
444  // NOP for most plotters.
445  }
446 
447  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false )
448  {
449  // NOP for most plotters. Only for Gerber plotter
450  }
451 
459  virtual void StartBlock( void* aData ) {}
460 
468  virtual void EndBlock( void* aData ) {}
469 
470 
471 protected:
472  // These are marker subcomponents
476  void markerCircle( const wxPoint& pos, int radius );
477 
481  void markerHBar( const wxPoint& pos, int radius );
482 
486  void markerSlash( const wxPoint& pos, int radius );
487 
491  void markerBackSlash( const wxPoint& pos, int radius );
492 
496  void markerVBar( const wxPoint& pos, int radius );
497 
501  void markerSquare( const wxPoint& position, int radius );
502 
506  void markerLozenge( const wxPoint& position, int radius );
507 
508  // Helper function for sketched filler segment
509 
513  void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
514  EDA_DRAW_MODE_T tracemode );
515 
516  void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
517 
518  // Coordinate and scaling conversion functions
519 
525  virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
526 
531  virtual DPOINT userToDeviceSize( const wxSize& size );
532 
537  virtual double userToDeviceSize( double size ) const;
538 
539  double GetDotMarkLenIU() const;
540 
541  double GetDashMarkLenIU() const;
542 
543  double GetDashGapLenIU() const;
544 
545 protected: // variables used in most of plotters:
547  double plotScale;
548 
549  /* Caller scale (how many IUs in a decimil - always); it's a double
550  * because in eeschema there are 0.1 IUs in a decimil (eeschema
551  * always works in mils internally) while pcbnew can work in decimil
552  * or nanometers, so this value would be >= 1 */
554 
557 
559  wxPoint plotOffset;
560 
566 
568  FILE* outputFile;
569 
570  // Pen handling
571  bool colorMode;
576  char penState;
578  wxPoint penLastpos;
579  wxString creator;
580  wxString filename;
581  wxString title;
584  wxSize paperSize;
585 
586  wxArrayString m_headerExtraLines;
587 };
588 
589 
590 class HPGL_PLOTTER : public PLOTTER
591 {
592 public:
593  HPGL_PLOTTER();
594 
595  virtual PlotFormat GetPlotterType() const override
596  {
597  return PLOT_FORMAT_HPGL;
598  }
599 
600  static wxString GetDefaultFileExtension()
601  {
602  return wxString( wxT( "plt" ) );
603  }
604 
605  virtual bool StartPlot() override;
606  virtual bool EndPlot() override;
607 
609  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
610  {
611  // This is the truth
613  }
614 
615  virtual void SetDefaultLineWidth( int width ) override {}
616  virtual void SetDash( int dashed ) override;
617 
618  virtual void SetColor( COLOR4D color ) override {}
619 
620  virtual void SetPenSpeed( int speed )
621  {
622  penSpeed = speed;
623  }
624 
625  virtual void SetPenNumber( int number )
626  {
627  penNumber = number;
628  }
629 
630  virtual void SetPenDiameter( double diameter );
631 
632  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
633  double aScale, bool aMirror ) override;
634  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
635  int width = USE_DEFAULT_LINE_WIDTH ) override;
636  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
637  int width = USE_DEFAULT_LINE_WIDTH ) override;
638  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
639  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
640  void * aData = NULL) override;
641 
642  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
643  EDA_DRAW_MODE_T tracemode, void* aData ) override;
644  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
645  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
646  virtual void PenTo( const wxPoint& pos, char plume ) override;
647  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
648  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
649  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
650  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
651  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
652  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
653  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
654  int aCornerRadius, double aOrient,
655  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
656  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
657  SHAPE_POLY_SET* aPolygons,
658  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
659  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
660  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
661  void* aData ) override;
662  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
663  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
664 
665 protected:
666  void penControl( char plume );
667 
668  int penSpeed;
670  double penDiameter;
671 };
672 
678 class PSLIKE_PLOTTER : public PLOTTER
679 {
680 public:
683  {
684  }
685 
689  virtual void SetTextMode( PlotTextMode mode ) override
690  {
691  if( mode != PLOTTEXTMODE_DEFAULT )
692  m_textMode = mode;
693  }
694 
695  virtual void SetDefaultLineWidth( int width ) override;
696 
700  void SetScaleAdjust( double scaleX, double scaleY )
701  {
702  plotScaleAdjX = scaleX;
703  plotScaleAdjY = scaleY;
704  }
705 
706  // Pad routines are handled with lower level primitives
707  virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
708  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
709  virtual void FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize, double aPadOrient,
710  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
711  virtual void FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
712  double aPadOrient, EDA_DRAW_MODE_T aTraceMode,
713  void* aData ) override;
714  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
715  int aCornerRadius, double aOrient,
716  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
717  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
718  SHAPE_POLY_SET* aPolygons,
719  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
720  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
721  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
722  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
723  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
724 
729  virtual void SetColor( COLOR4D color ) override;
730 
731 protected:
732  void computeTextParameters( const wxPoint& aPos,
733  const wxString& aText,
734  int aOrient,
735  const wxSize& aSize,
736  bool aMirror,
737  enum EDA_TEXT_HJUSTIFY_T aH_justify,
738  enum EDA_TEXT_VJUSTIFY_T aV_justify,
739  int aWidth,
740  bool aItalic,
741  bool aBold,
742  double *wideningFactor,
743  double *ctm_a,
744  double *ctm_b,
745  double *ctm_c,
746  double *ctm_d,
747  double *ctm_e,
748  double *ctm_f,
749  double *heightFactor );
750  void postscriptOverlinePositions( const wxString& aText, int aXSize,
751  bool aItalic, bool aBold,
752  std::vector<int> *pos_pairs );
753  void fputsPostscriptString(FILE *fout, const wxString& txt);
754 
756  virtual void emitSetRGBColor( double r, double g, double b ) = 0;
757 
759  static const double postscriptTextAscent; // = 0.718;
760 
761  int returnPostscriptTextWidth( const wxString& aText, int aXSize,
762  bool aItalic, bool aBold );
763 
766 
769 };
770 
771 
773 {
774 public:
776  {
777  // The phantom plot in postscript is an hack and reportedly
778  // crashes Adobe's own postscript interpreter!
780  }
781 
782  static wxString GetDefaultFileExtension()
783  {
784  return wxString( wxT( "ps" ) );
785  }
786 
787  virtual PlotFormat GetPlotterType() const override
788  {
789  return PLOT_FORMAT_POST;
790  }
791 
792  virtual bool StartPlot() override;
793  virtual bool EndPlot() override;
794  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
795  virtual void SetDash( int dashed ) override;
796 
797  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
798  double aScale, bool aMirror ) override;
799  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
800  int width = USE_DEFAULT_LINE_WIDTH ) override;
801  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
802  int width = USE_DEFAULT_LINE_WIDTH ) override;
803  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
804  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
805 
806  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
807  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
808  void * aData = NULL ) override;
809 
810  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
811  double aScaleFactor ) override;
812 
813  virtual void PenTo( const wxPoint& pos, char plume ) override;
814  virtual void Text( const wxPoint& aPos,
815  const COLOR4D aColor,
816  const wxString& aText,
817  double aOrient,
818  const wxSize& aSize,
819  enum EDA_TEXT_HJUSTIFY_T aH_justify,
820  enum EDA_TEXT_VJUSTIFY_T aV_justify,
821  int aWidth,
822  bool aItalic,
823  bool aBold,
824  bool aMultilineAllowed = false,
825  void* aData = NULL ) override;
826 protected:
827  virtual void emitSetRGBColor( double r, double g, double b ) override;
828 };
829 
831 {
832 public:
834  {
835  // Avoid non initialized variables:
837  pageTreeHandle = 0;
838  }
839 
840  virtual PlotFormat GetPlotterType() const override
841  {
842  return PLOT_FORMAT_PDF;
843  }
844 
845  static wxString GetDefaultFileExtension()
846  {
847  return wxString( wxT( "pdf" ) );
848  }
849 
858  virtual bool OpenFile( const wxString& aFullFilename ) override;
859 
860  virtual bool StartPlot() override;
861  virtual bool EndPlot() override;
862  virtual void StartPage();
863  virtual void ClosePage();
864  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
865  virtual void SetDash( int dashed ) override;
866 
869  virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
870  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
871  double aScale, bool aMirror ) override;
872  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
873  int width = USE_DEFAULT_LINE_WIDTH ) override;
874  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
875  int width = USE_DEFAULT_LINE_WIDTH ) override;
876  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
877  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
878 
879  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
880  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
881  void * aData = NULL ) override;
882 
883  virtual void PenTo( const wxPoint& pos, char plume ) override;
884 
885  virtual void Text( const wxPoint& aPos,
886  const COLOR4D aColor,
887  const wxString& aText,
888  double aOrient,
889  const wxSize& aSize,
890  enum EDA_TEXT_HJUSTIFY_T aH_justify,
891  enum EDA_TEXT_VJUSTIFY_T aV_justify,
892  int aWidth,
893  bool aItalic,
894  bool aBold,
895  bool aMultilineAllowed = false,
896  void* aData = NULL ) override;
897 
898  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
899  double aScaleFactor ) override;
900 
901 
902 protected:
903  virtual void emitSetRGBColor( double r, double g, double b ) override;
904  int allocPdfObject();
905  int startPdfObject(int handle = -1);
906  void closePdfObject();
907  int startPdfStream(int handle = -1);
908  void closePdfStream();
911  std::vector<int> pageHandles;
914  wxString workFilename;
915  FILE* workFile;
916  std::vector<long> xrefTable;
917 };
918 
920 {
921 public:
922  SVG_PLOTTER();
923 
924  static wxString GetDefaultFileExtension()
925  {
926  return wxString( wxT( "svg" ) );
927  }
928 
929  virtual PlotFormat GetPlotterType() const override
930  {
931  return PLOT_FORMAT_SVG;
932  }
933 
934  virtual void SetColor( COLOR4D color ) override;
935  virtual bool StartPlot() override;
936  virtual bool EndPlot() override;
937  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
938  virtual void SetDash( int dashed ) override;
939 
940  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
941  double aScale, bool aMirror ) override;
942  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
943  int width = USE_DEFAULT_LINE_WIDTH ) override;
944  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
945  int width = USE_DEFAULT_LINE_WIDTH ) override;
946  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
947  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
948 
949  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
950  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
951  void * aData = NULL ) override;
952 
953  virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
954  double aScaleFactor ) override;
955 
956  virtual void PenTo( const wxPoint& pos, char plume ) override;
957 
958 
964  virtual void StartBlock( void* aData ) override;
965 
971  virtual void EndBlock( void* aData ) override;
972 
973  virtual void Text( const wxPoint& aPos,
974  const COLOR4D aColor,
975  const wxString& aText,
976  double aOrient,
977  const wxSize& aSize,
978  enum EDA_TEXT_HJUSTIFY_T aH_justify,
979  enum EDA_TEXT_VJUSTIFY_T aV_justify,
980  int aWidth,
981  bool aItalic,
982  bool aBold,
983  bool aMultilineAllowed = false,
984  void* aData = NULL ) override;
985 
986 protected:
987  FILL_T m_fillMode; // true if the current contour
988  // rect, arc, circle, polygon must be filled
989  long m_pen_rgb_color; // current rgb color value: each color has
990  // a value 0 ... 255, and the 3 colors are
991  // grouped in a 3x8 bits value
992  // (written in hex to svg files)
993  long m_brush_rgb_color; // same as m_pen_rgb_color, used to fill
994  // some contours.
995  bool m_graphics_changed; // true if a pen/brush parameter is modified
996  // color, pen size, fil mode ...
997  // the new SVG stype must be output on file
998  int m_dashed; // 0 = plot solid line style
999  // 1 = plot dashed line style
1000  // 2 = plot dotted line style
1001  // 3 = plot dash-dot line style
1002 
1008  virtual void emitSetRGBColor( double r, double g, double b ) override;
1009 
1017  void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} );
1018 
1023  void setFillMode( FILL_T fill );
1024 };
1025 
1026 /* Class to handle a D_CODE when plotting a board using Standard Aperture Templates
1027  * (complex apertures need aperture macros
1028  * 5 types:
1029  * Circle (round)
1030  * Rectangle
1031  * Obround (oval)
1032  * regular polygon
1033  *
1034  * We need round apertures to plot lines, so we also defined a aperture type for plotting
1035  */
1036 #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
1037 
1039 {
1040 public:
1042  AT_CIRCLE = 1, // round aperture, to flash pads
1043  AT_RECT = 2, // rect aperture, to flash pads
1044  AT_PLOTTING = 3, // round aperture, to plot lines
1045  AT_OVAL = 4, // oval aperture, to flash pads
1046  AT_REGULAR_POLY = 5,// Regular polygon (n vertices, n = 3 .. 12, with rotation)
1047  AT_REGULAR_POLY3, // Regular polygon 3 vertices, with rotation
1048  AT_REGULAR_POLY4, // Regular polygon 4 vertices, with rotation
1049  AT_REGULAR_POLY5, // Regular polygon 5 vertices, with rotation
1050  AT_REGULAR_POLY6, // Regular polygon 6 vertices, with rotation
1051  AT_REGULAR_POLY7, // Regular polygon 7 vertices, with rotation
1052  AT_REGULAR_POLY8, // Regular polygon 8 vertices, with rotation
1053  AT_REGULAR_POLY9, // Regular polygon 9 vertices, with rotation
1054  AT_REGULAR_POLY10, // Regular polygon 10 vertices, with rotation
1055  AT_REGULAR_POLY11, // Regular polygon 11 vertices, with rotation
1056  AT_REGULAR_POLY12, // Regular polygon 12 vertices, with rotation
1057  };
1058 
1059  void SetSize( const wxSize& aSize )
1060  {
1061  m_Size = aSize;
1062  }
1063 
1064  const wxSize GetSize()
1065  {
1066  return m_Size;
1067  }
1068 
1069  void SetDiameter( int aDiameter )
1070  {
1071  m_Size.x = aDiameter;
1072  }
1073 
1075  {
1076  return m_Size.x;
1077  }
1078 
1079  void SetVerticeCount( int aCount )
1080  {
1081  if( aCount < 3 )
1082  aCount = 3;
1083  else if( aCount > 12 )
1084  aCount = 12;
1085 
1086  m_Type = (APERTURE_TYPE)(AT_REGULAR_POLY3 - 3 + aCount);
1087  }
1088 
1090  {
1091  return m_Type - AT_REGULAR_POLY3 + 3;
1092  }
1093 
1094  void SetRotation( double aRotDegree )
1095  {
1096  // The rotation is stored in 1/1000 degree
1097  m_Size.y = int( aRotDegree * 1000.0 );
1098  }
1099 
1100  double GetRotation()
1101  {
1102  // The rotation is stored in 1/1000 degree
1103  return m_Size.y / 1000.0;
1104  }
1105 
1106  // Type ( Line, rect , circulaire , ovale poly 3 to 12 vertices )
1108 
1109  // horiz and Vert size, or diameter and rotation for regular polygon
1110  // The diameter (for circle and polygons) is stored in m_Size.x
1111  // the rotation is stored in m_Size.y in 1/1000 degree
1112  wxSize m_Size;
1113 
1114  // code number ( >= 10 )
1115  int m_DCode;
1116 
1117  // the attribute attached to this aperture
1118  // Only one attribute is allowed by aperture
1119  // 0 = no specific aperture attribute
1121 };
1122 
1123 
1124 class GERBER_PLOTTER : public PLOTTER
1125 {
1126 public:
1127  GERBER_PLOTTER();
1128 
1129  virtual PlotFormat GetPlotterType() const override
1130  {
1131  return PLOT_FORMAT_GERBER;
1132  }
1133 
1134  static wxString GetDefaultFileExtension()
1135  {
1136  return wxString( wxT( "gbr" ) );
1137  }
1138 
1144  virtual bool StartPlot() override;
1145  virtual bool EndPlot() override;
1146  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
1147  virtual void SetDefaultLineWidth( int width ) override;
1148 
1149  // RS274X has no dashing, nor colours
1150  virtual void SetDash( int dashed ) override {}
1151  virtual void SetColor( COLOR4D color ) override {}
1152  // Currently, aScale and aMirror are not used in gerber plotter
1153  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1154  double aScale, bool aMirror ) override;
1155  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1156  int width = USE_DEFAULT_LINE_WIDTH ) override;
1157  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1158  int width = USE_DEFAULT_LINE_WIDTH ) override;
1159  virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
1160  int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
1161 
1162  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1163  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1164 
1165  virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
1166  int rayon, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override;
1167  virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
1168  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1169  virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
1170  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1175  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1176  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
1177  void * aData = NULL ) override;
1178 
1179  virtual void PenTo( const wxPoint& pos, char plume ) override;
1180 
1181  virtual void Text( const wxPoint& aPos,
1182  const COLOR4D aColor,
1183  const wxString& aText,
1184  double aOrient,
1185  const wxSize& aSize,
1186  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1187  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1188  int aWidth,
1189  bool aItalic,
1190  bool aBold,
1191  bool aMultilineAllowed = false,
1192  void* aData = NULL ) override;
1193 
1197  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1198  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1199 
1203  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1204  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1210  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1211  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1212 
1218  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1219  int aCornerRadius, double aOrient,
1220  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1221  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1222  SHAPE_POLY_SET* aPolygons,
1223  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1229  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1230  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1231 
1232  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1233  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1234 
1239  virtual void SetLayerPolarity( bool aPositive ) override;
1240 
1251  virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false ) override;
1252 
1253  void UseX2format( bool aEnable ) { m_useX2format = aEnable; }
1254  void UseX2NetAttributes( bool aEnable ) { m_useNetAttributes = aEnable; }
1255 
1261  virtual void StartBlock( void* aData ) override;
1262 
1269  virtual void EndBlock( void* aData ) override;
1270 
1271 protected:
1277  void selectAperture( const wxSize& aSize, APERTURE::APERTURE_TYPE aType,
1278  int aApertureAttribute );
1285  void selectAperture( int aDiameter, double aPolygonRotation,
1286  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1287 
1293  void emitDcode( const DPOINT& pt, int dcode );
1294 
1303 
1308  void clearNetAttribute();
1309 
1318  std::vector<APERTURE>::iterator getAperture( const wxSize& aSize,
1319  APERTURE::APERTURE_TYPE aType, int aApertureAttribute );
1320 
1321  // the attributes dictionary created/modifed by %TO, attached the objects, when they are created
1322  // by D01, D03 G36/G37 commands
1323  // standard attributes are .P, .C and .N
1324  // this is used by gerber readers when creating a new object. Cleared by %TD command
1325  // Note: m_objectAttributesDictionnary can store more than one attribute
1326  // the string stores the line(s) actually written to the gerber file
1327  // it can store a .P, .C or .N attribute, or 2 or 3 attributes, separated by a \n char (EOL)
1329 
1330  // The last aperture attribute generated (only one aperture attribute can be set)
1332 
1333  FILE* workFile;
1334  FILE* finalFile;
1335  wxString m_workFilename;
1336 
1340  void writeApertureList();
1341 
1342  std::vector<APERTURE> apertures;
1343  std::vector<APERTURE>::iterator currentAperture;
1344 
1345  bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
1346  int m_gerberUnitFmt; // number of digits in mantissa.
1347  // usually 6 in Inches and 5 or 6 in mm
1348  bool m_useX2format; // In recent gerber files, attributes are added.
1349  // Attributes in file header will be added using X2 format if true
1350  // If false (X1 format), these attributes will be added as comments.
1351  bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
1352  // It will be added if this param is true, using X2 or X1 format
1353 };
1354 
1355 
1356 class DXF_PLOTTER : public PLOTTER
1357 {
1358 public:
1360  {
1361  textAsLines = true;
1363  m_currentLineType = 0;
1365  }
1366 
1367  virtual PlotFormat GetPlotterType() const override
1368  {
1369  return PLOT_FORMAT_DXF;
1370  }
1371 
1372  static wxString GetDefaultFileExtension()
1373  {
1374  return wxString( wxT( "dxf" ) );
1375  }
1376 
1380  virtual void SetTextMode( PlotTextMode mode ) override
1381  {
1382  if( mode != PLOTTEXTMODE_DEFAULT )
1383  textAsLines = ( mode != PLOTTEXTMODE_NATIVE );
1384  }
1385 
1386  virtual bool StartPlot() override;
1387  virtual bool EndPlot() override;
1388 
1389  // For now we don't use 'thick' primitives, so no line width
1390  virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override
1391  {
1392  currentPenWidth = 0;
1393  }
1394 
1395  virtual void SetDefaultLineWidth( int width ) override
1396  {
1397  // DXF lines are infinitesimal
1398  defaultPenWidth = 0;
1399  }
1400 
1401  virtual void SetDash( int dashed ) override;
1402 
1403  virtual void SetColor( COLOR4D color ) override;
1404 
1405  virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
1406  double aScale, bool aMirror ) override;
1407  virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
1408  int width = USE_DEFAULT_LINE_WIDTH ) override;
1409  virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
1410  int width = USE_DEFAULT_LINE_WIDTH ) override;
1411  virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
1412  FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override;
1413  virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
1414  EDA_DRAW_MODE_T tracemode, void* aData ) override;
1415  virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
1416  int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
1417  virtual void PenTo( const wxPoint& pos, char plume ) override;
1418 
1419  virtual void FlashPadCircle( const wxPoint& pos, int diametre,
1420  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1421  virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
1422  EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1423  virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
1424  double orient, EDA_DRAW_MODE_T trace_mode, void* aData ) override;
1425  virtual void FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
1426  int aCornerRadius, double aOrient,
1427  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1428  virtual void FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
1429  SHAPE_POLY_SET* aPolygons,
1430  EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1431  virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
1432  double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1433  virtual void FlashRegularPolygon( const wxPoint& aShapePos, int aDiameter, int aCornerCount,
1434  double aOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
1435 
1436  virtual void Text( const wxPoint& aPos,
1437  const COLOR4D aColor,
1438  const wxString& aText,
1439  double aOrient,
1440  const wxSize& aSize,
1441  enum EDA_TEXT_HJUSTIFY_T aH_justify,
1442  enum EDA_TEXT_VJUSTIFY_T aV_justify,
1443  int aWidth,
1444  bool aItalic,
1445  bool aBold,
1446  bool aMultilineAllowed = false,
1447  void* aData = NULL ) override;
1448 
1449 
1450  // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
1452  {
1455  };
1456 
1462  void SetUnits( DXF_UNITS aUnit );
1463 
1470  {
1471  return m_plotUnits;
1472  }
1473 
1480  double GetUnitScaling() const
1481  {
1482  return m_unitScalingFactor;
1483  }
1484 
1490  unsigned int GetMeasurementDirective() const
1491  {
1492  return m_measurementDirective;
1493  }
1494 
1495 protected:
1499 
1503 };
1504 
1505 class TITLE_BLOCK;
1506 void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
1507  const PAGE_INFO& aPageInfo,
1508  int aSheetNumber, int aNumberOfSheets,
1509  const wxString &aSheetDesc,
1510  const wxString &aFilename,
1511  const COLOR4D aColor = COLOR4D::UNSPECIFIED );
1512 
1515 wxString GetDefaultPlotExtension( PlotFormat aFormat );
1516 
1517 
1518 #endif // PLOT_COMMON_H_
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
std::vector< APERTURE >::iterator getAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Function getAperture returns a reference to the aperture which meets the size anf type of tool if the...
static wxString GetDefaultFileExtension()
Definition: plotter.h:845
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:929
void FinishTo(const wxPoint &pos)
Definition: plotter.h:254
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Roundrect pad at the moment are not handled as aperture, since they require aperture macros TODO: alw...
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:410
int penSpeed
Definition: plotter.h:668
double GetDotMarkLenIU() const
Definition: plotter.cpp:137
double m_unitScalingFactor
Definition: plotter.h:1501
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:273
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:618
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
void PenFinish()
Definition: plotter.h:260
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:782
void UseX2NetAttributes(bool aEnable)
Definition: plotter.h:1254
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:468
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: plotter.h:1390
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 SetLayerPolarity(bool aPositive) override
Change the plot polarity and begin a new layer Used to 'scratch off' silk screen away from solder mas...
void SetRotation(double aRotDegree)
Definition: plotter.h:1094
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:1041
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:987
virtual void emitSetRGBColor(double r, double g, double b) override
Virtual primitive for emitting the setrgbcolor operator.
Definition: PS_plotter.cpp:543
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadTrapez flash a trapezoidal pad
Definition: PS_plotter.cpp:254
unsigned int m_measurementDirective
Definition: plotter.h:1502
APERTURE_TYPE m_Type
Definition: plotter.h:1107
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:531
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring.
void setFillMode(FILL_T fill)
function setFillMode() prepare parameters for setSVGPlotStyle()
virtual void StartPage()
Starts a new page in the PDF document.
virtual void SetTitle(const wxString &aTitle)
Definition: plotter.h:166
wxSize m_Size
Definition: plotter.h:1112
bool textAsLines
Definition: plotter.h:1496
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map)
Definition: plotter.h:415
virtual void SetDash(int dashed) override
PDF supports dashed lines.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:80
static wxString GetDefaultFileExtension()
Definition: plotter.h:924
bool m_useNetAttributes
Definition: plotter.h:1351
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:909
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
Definition: PS_plotter.cpp:763
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
Definition: plotter.h:700
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:433
DXF_UNITS m_plotUnits
Definition: plotter.h:1500
int color
Definition: DXF_plotter.cpp:62
The PSLIKE_PLOTTER class is an intermediate class to handle common routines for engines working more ...
Definition: plotter.h:678
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual bool EndPlot() override
Definition: PS_plotter.cpp:965
int GetDiameter()
Definition: plotter.h:1074
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
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:459
virtual void PenTo(const wxPoint &pos, char plume)=0
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:840
std::vector< int > pageHandles
Font resource dictionary.
Definition: plotter.h:911
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
void UseX2format(bool aEnable)
Definition: plotter.h:1253
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
std::vector< APERTURE > apertures
Definition: plotter.h:1342
void SetDiameter(int aDiameter)
Definition: plotter.h:1069
bool colorMode
Definition: plotter.h:571
void SetSize(const wxSize &aSize)
Definition: plotter.h:1059
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual ~PLOTTER()
Definition: plotter.cpp:71
void selectAperture(const wxSize &aSize, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData) override
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Function PlotPoly.
Definition: PS_plotter.cpp:636
char penState
Current pen state: 'U', 'D' or 'Z' (see PenTo)
Definition: plotter.h:576
void AddLineToHeader(const wxString &aExtraString)
Function AddLineToHeader Add a line to the list of free lines to print at the beginning of the file.
Definition: plotter.h:176
COLOR4D m_currentColor
Definition: plotter.h:1497
this class handle info which can be added in a gerber file as attribute of an obtect the GBR_INFO_TYP...
double m_IUsPerDecimil
Definition: plotter.h:553
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:1345
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:560
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot,...
Definition: title_block.h:40
wxArrayString m_headerExtraLines
Definition: plotter.h:586
static wxString GetDefaultFileExtension()
Definition: plotter.h:1134
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:615
wxPoint plotOffset
Plot offset (in IUs)
Definition: plotter.h:559
wxPoint penLastpos
Last pen positions; set to -1,-1 when the pen is at rest.
Definition: plotter.h:578
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCircle
Definition: PS_plotter.cpp:115
virtual bool StartPlot() override
Function StartPlot Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
Definition: plotter.h:447
PAGE_INFO pageInfo
Definition: plotter.h:582
PLOTTER()
Definition: plotter.cpp:54
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:493
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:1480
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:914
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: gr_text.cpp:215
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Polygon plotting for PDF.
double GetDashGapLenIU() const
Definition: plotter.cpp:149
static wxString GetDefaultFileExtension()
Definition: plotter.h:1372
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
virtual int GetCurrentLineWidth() const
Definition: plotter.h:152
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:509
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:565
virtual bool EndPlot()=0
int streamLengthHandle
Handle of the page content object.
Definition: plotter.h:913
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:811
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
void LineTo(const wxPoint &pos)
Definition: plotter.h:249
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1129
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadCircle
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:102
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadCustom
Definition: PS_plotter.cpp:220
bool m_plotMirror
X axis orientation (SVG) and plot mirrored (only for PS, PDF HPGL and SVG)
Definition: plotter.h:563
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
PS_PLOTTER()
Definition: plotter.h:775
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:52
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
HPGL doesn't handle line thickness or color.
Definition: plotter.h:609
virtual void emitSetRGBColor(double r, double g, double b)=0
Virtual primitive for emitting the setrgbcolor operator.
Class SHAPE_POLY_SET.
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
The PDF engine can't directly plot arcs, it uses the base emulation.
long m_pen_rgb_color
Definition: plotter.h:989
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
Definition: PS_plotter.cpp:185
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GraphicTextWidth in drawtxt.cpp Does the same processing (i....
Definition: PS_plotter.cpp:351
double plotScaleAdjY
Definition: plotter.h:765
int startPdfStream(int handle=-1)
Starts a PDF stream (for the page).
EDA_DRAW_MODE_T
Definition: eda_text.h:59
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL) override
Draws text with the plotter.
Definition: PS_plotter.cpp:979
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
virtual void SetTextMode(PlotTextMode mode)
Change the current text mode.
Definition: plotter.h:442
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:620
int m_gerberUnitFmt
Definition: plotter.h:1346
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
Definition: PS_plotter.cpp:136
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadRoundRect
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
Definition: PS_plotter.cpp:600
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PDF_plotter.cpp:69
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:59
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:589
int GetVerticeCount()
Definition: plotter.h:1089
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
double plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:547
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
virtual bool StartPlot() override
The code within this function creates SVG files header.
double GetIUsPerDecimil() const
The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establ...
Definition: plotter.h:217
virtual void SetDash(int dashed) override
HPGL supports dashed lines.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
DXF rectangle: fill not supported.
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadOval
virtual void SetDash(int dashed) override
Postscript supports dashed lines.
Definition: PS_plotter.cpp:555
FILE * workFile
Definition: plotter.h:915
virtual void PenTo(const wxPoint &pos, char plume) override
moveto/lineto primitive, moves the 'pen' to the specified direction
virtual void FlashPadCircle(const wxPoint &pos, int diametre, EDA_DRAW_MODE_T trace_mode, void *aData) override
DXF round pad: always done in sketch mode; it could be filled but it isn't pretty if other kinds of p...
int m_currentLineType
Definition: plotter.h:1498
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate (fo...
virtual DPOINT userToDeviceSize(const wxSize &size)
Modifies size according to the plotter scale factors (wxSize version, returns a DPOINT)
Definition: plotter.cpp:122
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:1334
virtual void SetNegative(bool aNegative)
Definition: plotter.h:118
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
Definition: PS_plotter.cpp:526
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Set the line width for the next drawing.
void markerSlash(const wxPoint &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:280
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:301
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRect
virtual void SetDefaultLineWidth(int width)=0
Set the default line width.
virtual void FlashPadRect(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
DXF rectangular pad: alwayd done in sketch mode.
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
Definition: plotter.h:759
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
int penNumber
Definition: plotter.h:669
void MoveTo(const wxPoint &pos)
Definition: plotter.h:244
bool m_useX2format
Definition: plotter.h:1348
wxString title
Definition: plotter.h:581
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:97
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Rectangles in PDF.
int GetPlotterArcLowDef() const
Definition: plotter.h:219
int fontResDictHandle
Handle to the root of the page tree object.
Definition: plotter.h:910
Base plotter engine class.
Definition: plotter.h:97
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadRect
const wxSize GetSize()
Definition: plotter.h:1064
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:201
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
Definition: plotter.h:1490
virtual void SetTextMode(PlotTextMode mode) override
PS and PDF fully implement native text (for the Latin-1 subset)
Definition: plotter.h:689
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
Postscript-likes at the moment are the only plot engines supporting bitmaps...
Definition: PS_plotter.cpp:661
void fputsPostscriptString(FILE *fout, const wxString &txt)
Write on a stream a string escaped for postscript/PDF.
Definition: PS_plotter.cpp:312
virtual void emitSetRGBColor(double r, double g, double b) override
PDF supports colors fully.
PDF_PLOTTER()
Definition: plotter.h:833
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:916
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:574
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
Definition: PS_plotter.cpp:300
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
Flash a regular polygon.
double GetRotation()
Definition: plotter.h:1100
int defaultPenWidth
true to generate a negative image (PS mode mainly)
Definition: plotter.h:573
virtual bool EndPlot() override
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData)=0
virtual function FlashPadOval
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:578
double GetDashMarkLenIU() const
Definition: plotter.cpp:143
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: plotter.h:1395
Class SHAPE_LINE_CHAIN.
virtual PlotFormat GetPlotterType() const =0
Returns the effective plot engine in use.
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode, void *aData)
Definition: plotter.cpp:476
bool m_graphics_changed
Definition: plotter.h:995
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Circle drawing for PDF.
wxString GetDefaultPlotExtension(PlotFormat aFormat)
Returns the default plot extension for a format.
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:595
long m_brush_rgb_color
Definition: plotter.h:993
PlotDashType
Enum for choosing dashed line type.
Definition: plotter.h:84
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:1367
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
Definition: plotter.h:765
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:1151
double penDiameter
Definition: plotter.h:670
virtual void SetPenNumber(int number)
Definition: plotter.h:625
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:249
FILE * outputFile
true if the Y axis is top to bottom (SVG)
Definition: plotter.h:568
static wxString GetDefaultFileExtension()
Definition: plotter.h:600
std::string m_objectAttributesDictionnary
Definition: plotter.h:1328
virtual void emitSetRGBColor(double r, double g, double b) override
function emitSetRGBColor() initialize m_pen_rgb_color from reduced values r, g ,b ( reduced values ar...
PlotTextMode
Enum for choosing which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:74
void markerCircle(const wxPoint &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:243
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(COLOR4D color) override
The DXF exporter handles 'colors' as layers...
int GetPlotterArcHighDef() const
Definition: plotter.h:220
virtual void SetDash(int dashed) override
void ClearHeaderLinesList()
Function ClearHeaderLinesList remove all lines from the list of free lines to print at the beginning ...
Definition: plotter.h:185
virtual void SetDash(int dashed)=0
virtual void FlashPadOval(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
DXF oval pad: always done in sketch mode.
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Function SetGerberCoordinatesFormat selection of Gerber units and resolution (number of digits in man...
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:155
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:42
void postscriptOverlinePositions(const wxString &aText, int aXSize, bool aItalic, bool aBold, std::vector< int > *pos_pairs)
Computes the x coordinates for the overlining in a string of text.
Definition: PS_plotter.cpp:380
virtual void FlashPadRect(const wxPoint &pos, const wxSize &size, double orient, EDA_DRAW_MODE_T trace_mode, void *aData) override
Filled rect flashes are handled as aperture in the 0 90 180 or 270 degree orientation only and as pol...
virtual void SetDash(int dashed) override
SVG supports dashed lines.
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
Definition: PDF_plotter.cpp:49
virtual void StartBlock(void *aData) override
calling this function allows one to define the beginning of a group of drawing items (used in SVG for...
wxString m_workFilename
Definition: plotter.h:1335
void computeTextParameters(const wxPoint &aPos, const wxString &aText, int aOrient, const wxSize &aSize, bool aMirror, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, double *wideningFactor, double *ctm_a, double *ctm_b, double *ctm_c, double *ctm_d, double *ctm_e, double *ctm_f, double *heightFactor)
This is the core for postscript/PDF text alignment It computes the transformation matrix to generate ...
Definition: PS_plotter.cpp:433
Definition: colors.h:45
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadOval
Definition: PS_plotter.cpp:85
int m_apertureAttribute
Definition: plotter.h:1331
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
PDF can have multiple pages, so SetPageSettings can be called with the outputFile open (but not insid...
Definition: PDF_plotter.cpp:64
int m_DCode
Definition: plotter.h:1115
virtual void SetTextMode(PlotTextMode mode) override
DXF handles NATIVE text emitting TEXT entities.
Definition: plotter.h:1380
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:1120
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:1333
double iuPerDeviceUnit
Device scale (from IUs to plotter device units - usually decimils)
Definition: plotter.h:556
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:101
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, EDA_DRAW_MODE_T tracemode)
Cdonvert a thick segment and plot it as an oval.
Definition: plotter.cpp:407
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:580
virtual void SetDash(int dashed) override
Definition: plotter.h:1150
void markerVBar(const wxPoint &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:294
std::vector< APERTURE >::iterator currentAperture
Definition: plotter.h:1343
PlotTextMode m_textMode
How to draw text.
Definition: plotter.h:768
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:218
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:287
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
Definition: plotter.cpp:428
void SetVerticeCount(int aCount)
Definition: plotter.h:1079
int pageStreamHandle
Handles to the page objects.
Definition: plotter.h:912
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, EDA_DRAW_MODE_T aTraceMode, void *aData) override
virtual function FlashPadRoundRect
virtual PlotFormat GetPlotterType() const override
Returns the effective plot engine in use.
Definition: plotter.h:787
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
wxString creator
Definition: plotter.h:579
wxSize paperSize
Paper size in IU - not in mils.
Definition: plotter.h:584
bool m_mirrorIsHorizontal
Definition: plotter.h:564
DXF_UNITS GetUnits() const
The units currently enabled for plotting.
Definition: plotter.h:1469
int m_dashed
Definition: plotter.h:998
virtual void SetCurrentLineWidth(int width, void *aData=NULL) override
Pen width setting for PDF.
Definition: PDF_plotter.cpp:95
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL) override
Function PlotPoly.
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
virtual void PlotImage(const wxImage &aImage, const wxPoint &aPos, double aScaleFactor) override
PDF images are handles as inline, not XObject streams...
bool GetColorMode() const
Definition: plotter.h:131
bool negativeMode
true to plot in color, false to plot in black and white
Definition: plotter.h:572