KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2010 Lorenzo Marcantonio
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef SCH_PLOTTER_H
28#define SCH_PLOTTER_H
29
30#include <wx/string.h>
31#include <wx/gdicmn.h>
32#include <page_info.h>
33#include <render_settings.h>
34#include <sch_sheet_path.h>
35#include <plotters/plotter.h>
36
37class SCH_EDIT_FRAME;
38class PLOTTER;
39class SCHEMATIC;
40class SCH_SCREEN;
42class PDF_PLOTTER;
43class REPORTER;
44
46{
51};
52
53
55{
59};
60
61
63{
64 DEFAULT = 0,
65 SIZE_A5,
66 SIZE_A4,
67 SIZE_A3,
68 SIZE_A2,
69 SIZE_A1,
70 SIZE_A0,
71 SIZE_A,
72 SIZE_B,
73 SIZE_C,
74 SIZE_D,
75 SIZE_E,
76};
77
78
80{
86 double m_HPGLPenSize; // for HPGL format only: pen size
88 wxString m_theme;
89
91 wxString m_outputFile;
92
94
96 m_plotAll( true ),
97 m_plotDrawingSheet( true ),
98 m_blackAndWhite( false ),
100 m_useBackgroundColor( true ),
101 m_HPGLPenSize( 1.0 ),
103 m_theme(),
105 m_outputFile(),
107 {
108
109 }
110};
111
112
117{
118public:
122 SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
123
127 SCH_PLOTTER( SCHEMATIC* aSch );
128
137 void Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS& aPlotSettings,
138 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
139
143 wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
144
145protected:
149 wxFileName getOutputFilenameSingle( const SCH_PLOT_SETTINGS& aPlotSettings, REPORTER* aReporter,
150 const wxString& ext );
151
152 // PDF
153 void createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
154 REPORTER* aReporter );
155 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
156 const SCH_PLOT_SETTINGS& aPlotSettings );
157 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
158 const SCH_PLOT_SETTINGS& aPlotSettings );
159
160 // DXF
161 void createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
162 REPORTER* aReporter );
163 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
164 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
165 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings );
166
167
168 // HPGL
169 void createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
170 REPORTER* aReporter );
171 bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
172 const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
173 const VECTOR2I& aPlot0ffset, double aScale,
174 const SCH_PLOT_SETTINGS& aPlotSettings );
175
176 // PS
177 void createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
178 REPORTER* aReporter );
179 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
180 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
181 const VECTOR2I& aPlot0ffset, double aScale,
182 const SCH_PLOT_SETTINGS& aPlotSettings );
183
184 // SVG
185 void createSVGFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
186 REPORTER* aReporter );
187 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
188 RENDER_SETTINGS* aRenderSettings,
189 const SCH_PLOT_SETTINGS& aPlotSettings );
190
197 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
198
199
209 wxFileName createPlotFileName( const SCH_PLOT_SETTINGS& aPlotSettings,
210 const wxString& aPlotFileName, const wxString& aExtension,
211 REPORTER* aReporter = nullptr );
212
213private:
216
218
220};
221
222#endif
Color settings are a bit different than most of the settings objects in that there can be more than o...
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
Base plotter engine class.
Definition: plotter.h:110
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
Holds all the data relating to one schematic.
Definition: schematic.h:72
Schematic editor (Eeschema) main window.
Schematic plotting class.
Definition: sch_plotter.h:117
void createSVGFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createDXFFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createPSFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
wxFileName getOutputFilenameSingle(const SCH_PLOT_SETTINGS &aPlotSettings, REPORTER *aReporter, const wxString &ext)
Returns the output filename for formats where the output is a single file.
Definition: sch_plotter.cpp:82
wxFileName createPlotFileName(const SCH_PLOT_SETTINGS &aPlotSettings, const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=nullptr)
Create a file name with an absolute path name.
bool plotOneSheetHpgl(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
bool plotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlotOffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const SCH_PLOT_SETTINGS &aPlotSettings)
void Plot(PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter=nullptr)
Perform the plotting of the schematic using the given aPlotFormat and aPlotSettings.
wxString m_lastOutputFilePath
Definition: sch_plotter.h:219
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
SCH_EDIT_FRAME * m_schFrame
Definition: sch_plotter.h:214
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_SETTINGS &aPlotSettings)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
wxString GetLastOutputFilePath() const
Get the last output file path, this is mainly intended for PDFs with the open after plot GUI option.
Definition: sch_plotter.h:143
COLOR_SETTINGS * m_colorSettings
Definition: sch_plotter.h:217
void createPDFFile(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_SETTINGS &aPlotSettings)
SCHEMATIC * m_schematic
Definition: sch_plotter.h:215
void createHPGLFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70
PageFormatReq
Definition: sch_plotter.h:55
@ PAGE_SIZE_AUTO
Definition: sch_plotter.h:56
@ PAGE_SIZE_A
Definition: sch_plotter.h:58
@ PAGE_SIZE_A4
Definition: sch_plotter.h:57
HPGL_PAGE_SIZE
Definition: sch_plotter.h:63
HPGL_PLOT_ORIGIN_AND_UNITS
Definition: sch_plotter.h:46
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
double m_HPGLPenSize
Definition: sch_plotter.h:86
wxString m_theme
Definition: sch_plotter.h:88
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
Definition: sch_plotter.h:87
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
Definition: sch_plotter.h:93
bool m_useBackgroundColor
Definition: sch_plotter.h:85
wxString m_outputDirectory
Definition: sch_plotter.h:90
wxString m_outputFile
Definition: sch_plotter.h:91