You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
24 KiB

  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-2022 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. /**
  25. * Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
  26. *
  27. * @file plotter.h
  28. */
  29. #ifndef PLOT_COMMON_H_
  30. #define PLOT_COMMON_H_
  31. #include <eda_shape.h>
  32. #include <vector>
  33. #include <math/box2.h>
  34. #include <gr_text.h>
  35. #include <page_info.h>
  36. #include <outline_mode.h>
  37. #include <gal/color4d.h>
  38. #include <stroke_params.h>
  39. #include <render_settings.h>
  40. class COLOR_SETTINGS;
  41. class SHAPE_ARC;
  42. class SHAPE_POLY_SET;
  43. class SHAPE_LINE_CHAIN;
  44. class GBR_NETLIST_METADATA;
  45. class PROJECT;
  46. using KIGFX::RENDER_SETTINGS;
  47. // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
  48. // Units (inch/mm for DXF plotter
  49. enum class DXF_UNITS
  50. {
  51. INCHES = 0,
  52. MILLIMETERS = 1
  53. };
  54. /**
  55. * The set of supported output plot formats.
  56. *
  57. They should be kept in order of the radio buttons in the plot panel/windows.
  58. */
  59. enum class PLOT_FORMAT
  60. {
  61. UNDEFINED = -1,
  62. FIRST_FORMAT = 0,
  63. HPGL = FIRST_FORMAT,
  64. GERBER,
  65. POST,
  66. DXF,
  67. PDF,
  68. SVG,
  69. LAST_FORMAT = SVG
  70. };
  71. /**
  72. * Which kind of text to output with the PSLIKE plotters.
  73. *
  74. * You can:
  75. * 1) only use the internal vector font
  76. * 2) only use native postscript fonts
  77. * 3) use the internal vector font and add 'phantom' text to aid
  78. * searching
  79. * 4) keep the default for the plot driver
  80. *
  81. * This is recognized by the DXF driver too, where NATIVE emits
  82. * TEXT entities instead of stroking the text
  83. */
  84. enum class PLOT_TEXT_MODE
  85. {
  86. STROKE,
  87. NATIVE,
  88. PHANTOM,
  89. DEFAULT
  90. };
  91. /**
  92. * Base plotter engine class. General rule: all the interface with the caller
  93. * is done in IU, the IU size is specified with SetViewport. Internal and
  94. * output processing is usually done in decimils (or whatever unit the
  95. * effective engine class need to use)
  96. */
  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. PLOTTER();
  104. virtual ~PLOTTER();
  105. /**
  106. * Returns the effective plot engine in use. It's not very OO but for
  107. * now is required since some things are only done with some output devices
  108. * (like drill marks, emitted only for postscript
  109. */
  110. virtual PLOT_FORMAT GetPlotterType() const = 0;
  111. virtual bool StartPlot( const wxString& aPageNumber ) = 0;
  112. virtual bool EndPlot() = 0;
  113. virtual void SetNegative( bool aNegative ) { m_negativeMode = aNegative; }
  114. /**
  115. * Plot in B/W or color.
  116. *
  117. * @param aColorMode use true to plot in color, false to plot in black and white.
  118. */
  119. virtual void SetColorMode( bool aColorMode ) { m_colorMode = aColorMode; }
  120. bool GetColorMode() const { return m_colorMode; }
  121. void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; }
  122. RENDER_SETTINGS* RenderSettings() { return m_renderSettings; }
  123. virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_pageInfo = aPageSettings; }
  124. PAGE_INFO& PageSettings() { return m_pageInfo; }
  125. /**
  126. * Set the line width for the next drawing.
  127. *
  128. * @param width is specified in IUs.
  129. * @param aData is an auxiliary parameter, mainly used in gerber plotter.
  130. */
  131. virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) = 0;
  132. virtual int GetCurrentLineWidth() const { return m_currentPenWidth; }
  133. virtual void SetColor( const COLOR4D& color ) = 0;
  134. virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) = 0;
  135. virtual void SetCreator( const wxString& aCreator ) { m_creator = aCreator; }
  136. virtual void SetTitle( const wxString& aTitle ) { m_title = aTitle; }
  137. /**
  138. * Add a line to the list of free lines to print at the beginning of the file.
  139. *
  140. * @param aExtraString is the string to print
  141. */
  142. void AddLineToHeader( const wxString& aExtraString )
  143. {
  144. m_headerExtraLines.Add( aExtraString );
  145. }
  146. /**
  147. * Remove all lines from the list of free lines to print at the beginning of the file
  148. */
  149. void ClearHeaderLinesList()
  150. {
  151. m_headerExtraLines.Clear();
  152. }
  153. /**
  154. * Set the plot offset and scaling for the current plot
  155. *
  156. * @param aOffset is the plot offset.
  157. * @param aIusPerDecimil gives the scaling factor from IUs to device units
  158. * @param aScale is the user set plot scaling factor (either explicitly
  159. * or using 'fit to A4').
  160. * @param aMirror flips the plot in the Y direction (useful for toner
  161. * transfers or some kind of film).
  162. */
  163. virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
  164. double aScale, bool aMirror ) = 0;
  165. /**
  166. * Open or create the plot file \a aFullFilename.
  167. *
  168. * @param aFullFilename is the full file name of the file to create.
  169. * @return true if success, false if the file cannot be created/opened.
  170. *
  171. * Virtual because some plotters use ascii files, some others binary files (PDF)
  172. * The base class open the file in text mode
  173. */
  174. virtual bool OpenFile( const wxString& aFullFilename );
  175. /**
  176. * The IUs per decimil are an essential scaling factor when
  177. * plotting; they are set and saved when establishing the viewport.
  178. * Here they can be get back again
  179. */
  180. double GetIUsPerDecimil() const { return m_IUsPerDecimil; }
  181. int GetPlotterArcLowDef() const { return m_IUsPerDecimil * 8; }
  182. int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
  183. // Low level primitives
  184. virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
  185. int width = USE_DEFAULT_LINE_WIDTH ) = 0;
  186. virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
  187. int width = USE_DEFAULT_LINE_WIDTH ) = 0;
  188. /**
  189. * Generic fallback: arc rendered as a polyline.
  190. */
  191. virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
  192. FILL_T aFill, int aWidth, int aMaxError );
  193. /**
  194. * Generic fallback: Cubic Bezier curve rendered as a polyline
  195. * In KiCad the bezier curves have 4 control points:
  196. * start ctrl1 ctrl2 end
  197. */
  198. virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
  199. const VECTOR2I& aControl2, const VECTOR2I& aEnd,
  200. int aTolerance, int aLineThickness = USE_DEFAULT_LINE_WIDTH );
  201. /**
  202. * Moveto/lineto primitive, moves the 'pen' to the specified direction.
  203. *
  204. * @param pos is the target position.
  205. * @param plume specifies the kind of motion: 'U' only moves the pen,
  206. * 'D' draw a line from the current position and 'Z' finish
  207. * the drawing and returns the 'pen' to rest (flushes the trace).
  208. */
  209. virtual void PenTo( const VECTOR2I& pos, char plume ) = 0;
  210. // Convenience functions for PenTo
  211. void MoveTo( const VECTOR2I& pos )
  212. {
  213. PenTo( pos, 'U' );
  214. }
  215. void LineTo( const VECTOR2I& pos )
  216. {
  217. PenTo( pos, 'D' );
  218. }
  219. void FinishTo( const VECTOR2I& pos )
  220. {
  221. PenTo( pos, 'D' );
  222. PenTo( pos, 'Z' );
  223. }
  224. void PenFinish()
  225. {
  226. // The point is not important with Z motion
  227. PenTo( VECTOR2I( 0, 0 ), 'Z' );
  228. }
  229. /**
  230. * Draw a polygon ( filled or not ).
  231. *
  232. * @param aCornerList is the corners list (a std::vector< VECTOR2I >).
  233. * @param aFill is the type of fill.
  234. * @param aWidth is the line width.
  235. * @param aData is an auxiliary info (mainly for gerber format).
  236. */
  237. virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
  238. int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) = 0;
  239. /**
  240. * Draw a polygon ( filled or not ).
  241. * @param aCornerList is the corners list (a SHAPE_LINE_CHAIN).
  242. * must be closed (IsClosed() == true) for a polygon. Otherwise this is a polyline.
  243. * @param aFill is the type of fill.
  244. * @param aWidth is the line width.
  245. * @param aData is an auxiliary info (mainly for gerber format).
  246. */
  247. virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
  248. int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr );
  249. /**
  250. * Only PostScript plotters can plot bitmaps.
  251. *
  252. * A rectangle is plotted for plotters that cannot plot a bitmap.
  253. *
  254. * @param aImage is the bitmap.
  255. * @param aPos is position of the center of the bitmap.
  256. * @param aScaleFactor is the scale factor to apply to the bitmap size
  257. * (this is not the plot scale factor).
  258. */
  259. virtual void PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aScaleFactor );
  260. // Higher level primitives -- can be drawn as line, sketch or 'filled'
  261. virtual void ThickSegment( const VECTOR2I& start, const VECTOR2I& end, int width,
  262. OUTLINE_MODE tracemode, void* aData );
  263. virtual void ThickArc( const VECTOR2I& aCentre, const VECTOR2I& aStart,
  264. const VECTOR2I& aEnd, int aWidth,
  265. OUTLINE_MODE aTraceMode, void* aData );
  266. virtual void ThickArc( const EDA_SHAPE& aArcShape,
  267. OUTLINE_MODE aTraceMode, void* aData );
  268. virtual void ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width, OUTLINE_MODE tracemode,
  269. void* aData );
  270. virtual void ThickCircle( const VECTOR2I& pos, int diametre, int width, OUTLINE_MODE tracemode,
  271. void* aData );
  272. virtual void FilledCircle( const VECTOR2I& pos, int diametre, OUTLINE_MODE tracemode,
  273. void* aData );
  274. // Flash primitives
  275. /**
  276. * @param aPadPos Position of the shape (center of the rectangle.
  277. * @param aDiameter is the diameter of round pad.
  278. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  279. * @param aData is an auxiliary info (mainly for gerber format attributes).
  280. */
  281. virtual void FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter, OUTLINE_MODE aTraceMode,
  282. void* aData ) = 0;
  283. /**
  284. * @param aPadPos Position of the shape (center of the rectangle.
  285. * @param aSize is the size of oblong shape.
  286. * @param aPadOrient The rotation of the shape.
  287. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  288. * @param aData an auxiliary info (mainly for gerber format attributes).
  289. */
  290. virtual void FlashPadOval( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
  291. const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
  292. void* aData ) = 0;
  293. /**
  294. * @param aPadPos Position of the shape (center of the rectangle).
  295. * @param aSize is the size of rounded rect.
  296. * @param aPadOrient The rotation of the shape.
  297. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  298. * @param aData an auxiliary info (mainly for gerber format attributes).
  299. */
  300. virtual void FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
  301. const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
  302. void* aData ) = 0;
  303. /**
  304. * @param aPadPos Position of the shape (center of the rectangle.
  305. * @param aSize is the size of rounded rect.
  306. * @param aCornerRadius Radius of the rounded corners.
  307. * @param aOrient The rotation of the shape.
  308. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  309. * @param aData an auxiliary info (mainly for gerber format attributes).
  310. */
  311. virtual void FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
  312. int aCornerRadius, const EDA_ANGLE& aOrient,
  313. OUTLINE_MODE aTraceMode, void* aData ) = 0;
  314. /**
  315. * @param aPadPos Position of the shape.
  316. * @param aSize is the size of round reference pad.
  317. * @param aPadOrient is the pad rotation, used only with aperture macros (Gerber plotter).
  318. * @param aPolygons the shape as polygon set.
  319. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  320. * @param aData an auxiliary info (mainly for gerber format attributes).
  321. */
  322. virtual void FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aSize,
  323. const EDA_ANGLE& aPadOrient, SHAPE_POLY_SET* aPolygons,
  324. OUTLINE_MODE aTraceMode, void* aData ) = 0;
  325. /**
  326. * Flash a trapezoidal pad.
  327. *
  328. * @param aPadPos is the the position of the shape.
  329. * @param aCorners is the list of 4 corners positions, relative to the shape position,
  330. * pad orientation 0.
  331. * @param aPadOrient is the rotation of the shape.
  332. * @param aTraceMode is the drawing mode, FILLED or SKETCH.
  333. * @param aData an auxiliary info (mainly for gerber format attributes).
  334. */
  335. virtual void FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aCorners,
  336. const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
  337. void* aData ) = 0;
  338. /**
  339. * Flash a regular polygon. Useful only in Gerber files to flash a regular polygon.
  340. *
  341. * @param aShapePos is the center of the circle containing the polygon.
  342. * @param aRadius is the radius of the circle containing the polygon.
  343. * @param aCornerCount is the number of vertices.
  344. * @param aOrient is the polygon rotation.
  345. * @param aData is a auxiliary parameter used (if needed) to handle extra info
  346. * specific to the plotter.
  347. */
  348. virtual void FlashRegularPolygon( const VECTOR2I& aShapePos, int aDiameter, int aCornerCount,
  349. const EDA_ANGLE& aOrient, OUTLINE_MODE aTraceMode,
  350. void* aData ) = 0;
  351. /**
  352. * Draw text with the plotter.
  353. *
  354. * For convenience it accept the color to use for specific plotters (GERBER) aData is used
  355. * to pass extra parameters.
  356. */
  357. virtual void Text( const VECTOR2I& aPos,
  358. const COLOR4D& aColor,
  359. const wxString& aText,
  360. const EDA_ANGLE& aOrient,
  361. const VECTOR2I& aSize,
  362. enum GR_TEXT_H_ALIGN_T aH_justify,
  363. enum GR_TEXT_V_ALIGN_T aV_justify,
  364. int aPenWidth,
  365. bool aItalic,
  366. bool aBold,
  367. bool aMultilineAllowed,
  368. KIFONT::FONT* aFont,
  369. void* aData = nullptr );
  370. /**
  371. * Create a clickable hyperlink with a rectangular click area
  372. *
  373. * @aBox is the rectangular click target
  374. * @aDestinationURL is the target URL
  375. */
  376. virtual void HyperlinkBox( const BOX2I& aBox, const wxString& aDestinationURL )
  377. {
  378. // NOP for most plotters.
  379. }
  380. /**
  381. * Create a clickable hyperlink menu with a rectangular click area
  382. *
  383. * @aBox is the rectangular click target
  384. * @aDestURLs is the list of target URLs for the menu
  385. */
  386. virtual void HyperlinkMenu( const BOX2I& aBox, const std::vector<wxString>& aDestURLs )
  387. {
  388. // NOP for most plotters.
  389. }
  390. /**
  391. * Create a bookmark to a symbol
  392. *
  393. * @aBox is the bounding box of the symbol
  394. * @aSymbolReference is the symbol schematic ref
  395. */
  396. virtual void Bookmark( const BOX2I& aBox, const wxString& aName,
  397. const wxString& aGroupName = wxEmptyString )
  398. {
  399. // NOP for most plotters.
  400. }
  401. /**
  402. * Draw a marker (used for the drill map).
  403. */
  404. static const unsigned MARKER_COUNT = 58;
  405. /**
  406. * Draw a pattern shape number aShapeId, to coord position.
  407. *
  408. * @param aPosition is the position of the marker.
  409. * @param aDiameter is the diameter of the marker.
  410. * @param aShapeId is the index (used to generate forms characters).
  411. */
  412. void Marker( const VECTOR2I& position, int diametre, unsigned aShapeId );
  413. /**
  414. * Set the current Gerber layer polarity to positive or negative
  415. * by writing \%LPD*\% or \%LPC*\% to the Gerber file, respectively.
  416. * (obviously starts a new Gerber layer, too)
  417. *
  418. * @param aPositive is the layer polarity and true for positive.
  419. * It's not useful with most other plotter since they can't 'scratch'
  420. * the film like photoplotter imagers do
  421. */
  422. virtual void SetLayerPolarity( bool aPositive )
  423. {
  424. // NOP for most plotters
  425. }
  426. /**
  427. * Change the current text mode. See the PlotTextMode
  428. * explanation at the beginning of the file.
  429. */
  430. virtual void SetTextMode( PLOT_TEXT_MODE mode )
  431. {
  432. // NOP for most plotters.
  433. }
  434. virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false )
  435. {
  436. // NOP for most plotters. Only for Gerber plotter
  437. }
  438. /// Set the number of digits for mantissa in coordinates in mm for SVG plotter
  439. virtual void SetSvgCoordinatesFormat( unsigned aPrecision )
  440. {
  441. // NOP for most plotters. Only for SVG plotter
  442. }
  443. /**
  444. * calling this function allows one to define the beginning of a group
  445. * of drawing items, for instance in SVG or Gerber format.
  446. * (example: group all segments of a letter or a text)
  447. * @param aData can define any parameter
  448. * for most of plotters: do nothing
  449. */
  450. virtual void StartBlock( void* aData ) {}
  451. /**
  452. * calling this function allows one to define the end of a group of drawing
  453. * items for instance in SVG or Gerber format.
  454. * the group is started by StartBlock()
  455. * @param aData can define any parameter
  456. * for most of plotters: do nothing
  457. */
  458. virtual void EndBlock( void* aData ) {}
  459. protected:
  460. /**
  461. * Generic fallback: arc rendered as a polyline.
  462. */
  463. virtual void Arc( const VECTOR2I& aCentre, const EDA_ANGLE& aStartAngle,
  464. const EDA_ANGLE& aEndAngle, int aRadius, FILL_T aFill,
  465. int aWidth = USE_DEFAULT_LINE_WIDTH );
  466. virtual void ThickArc( const VECTOR2I& aCentre, const EDA_ANGLE& StAngle,
  467. const EDA_ANGLE& EndAngle, int aRadius, int aWidth,
  468. OUTLINE_MODE aTraceMode, void* aData );
  469. // These are marker subcomponents
  470. /**
  471. * Plot a circle centered on the position. Building block for markers
  472. */
  473. void markerCircle( const VECTOR2I& pos, int radius );
  474. /**
  475. * Plot a - bar centered on the position. Building block for markers
  476. */
  477. void markerHBar( const VECTOR2I& pos, int radius );
  478. /**
  479. * Plot a / bar centered on the position. Building block for markers
  480. */
  481. void markerSlash( const VECTOR2I& pos, int radius );
  482. /**
  483. * Plot a \ bar centered on the position. Building block for markers
  484. */
  485. void markerBackSlash( const VECTOR2I& pos, int radius );
  486. /**
  487. * Plot a | bar centered on the position. Building block for markers
  488. */
  489. void markerVBar( const VECTOR2I& pos, int radius );
  490. /**
  491. * Plot a square centered on the position. Building block for markers
  492. */
  493. void markerSquare( const VECTOR2I& position, int radius );
  494. /**
  495. * Plot a lozenge centered on the position. Building block for markers
  496. */
  497. void markerLozenge( const VECTOR2I& position, int radius );
  498. // Helper function for sketched filler segment
  499. /**
  500. * Convert a thick segment and plot it as an oval
  501. */
  502. void segmentAsOval( const VECTOR2I& start, const VECTOR2I& end, int width,
  503. OUTLINE_MODE tracemode );
  504. void sketchOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA_ANGLE& aOrient,
  505. int aWidth );
  506. // Coordinate and scaling conversion functions
  507. /**
  508. * Modify coordinates according to the orientation, scale factor, and offsets trace. Also
  509. * convert from a VECTOR2I to VECTOR2D, since some output engines needs floating point
  510. * coordinates.
  511. */
  512. virtual VECTOR2D userToDeviceCoordinates( const VECTOR2I& aCoordinate );
  513. /**
  514. * Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
  515. */
  516. virtual VECTOR2D userToDeviceSize( const VECTOR2I& size );
  517. /**
  518. * Modify size according to the plotter scale factors (simple double version).
  519. */
  520. virtual double userToDeviceSize( double size ) const;
  521. double GetDotMarkLenIU( int aLineWidth ) const;
  522. double GetDashMarkLenIU( int aLineWidth ) const;
  523. double GetDashGapLenIU( int aLineWidth ) const;
  524. protected: // variables used in most of plotters:
  525. /// Plot scale - chosen by the user (even implicitly with 'fit in a4')
  526. double m_plotScale;
  527. /* Caller scale (how many IUs in a decimil - always); it's a double
  528. * because in Eeschema there are 0.1 IUs in a decimil (Eeschema
  529. * always works in mils internally) while PcbNew can work in decimil
  530. * or nanometers, so this value would be >= 1 */
  531. double m_IUsPerDecimil;
  532. double m_iuPerDeviceUnit; // Device scale (from IUs to plotter device units;
  533. // usually decimils)
  534. VECTOR2I m_plotOffset; // Plot offset (in IUs)
  535. bool m_plotMirror; // X axis orientation (SVG)
  536. // and plot mirrored (only for PS, PDF HPGL and SVG)
  537. bool m_mirrorIsHorizontal; // true to mirror horizontally (else vertically)
  538. bool m_yaxisReversed; // true if the Y axis is top to bottom (SVG)
  539. /// Output file
  540. FILE* m_outputFile;
  541. // Pen handling
  542. bool m_colorMode; // true to plot in color, otherwise black & white
  543. bool m_negativeMode; // true to generate a negative image (PS mode mainly)
  544. int m_currentPenWidth;
  545. char m_penState; // current pen state: 'U', 'D' or 'Z' (see PenTo)
  546. VECTOR2I m_penLastpos; // last pen position; -1,-1 when pen is at rest
  547. wxString m_creator;
  548. wxString m_filename;
  549. wxString m_title;
  550. PAGE_INFO m_pageInfo;
  551. VECTOR2I m_paperSize; // Paper size in IU - not in mils
  552. wxArrayString m_headerExtraLines; // a set of string to print in header file
  553. RENDER_SETTINGS* m_renderSettings;
  554. };
  555. class TITLE_BLOCK;
  556. void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK& aTitleBlock,
  557. const PAGE_INFO& aPageInfo, const std::map<wxString, wxString>*aProperties,
  558. const wxString& aSheetNumber, int aSheetCount, const wxString& aSheetName,
  559. const wxString& aSheetPath, const wxString& aFilename,
  560. COLOR4D aColor = COLOR4D::UNSPECIFIED, bool aIsFirstPage = true );
  561. /** Returns the default plot extension for a format
  562. */
  563. wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat );
  564. #endif // PLOT_COMMON_H_