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-2023 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{
83 std::vector<wxString> m_plotPages;
84
88 double m_HPGLPenSize; // for HPGL format only: pen size
91 wxString m_theme;
92
94 wxString m_outputFile;
95
97
99 m_plotAll( true ),
100 m_plotDrawingSheet( true ),
101 m_blackAndWhite( false ),
102 m_pageSizeSelect( 0 ),
103 m_useBackgroundColor( true ),
104 m_HPGLPenSize( 1.0 ),
106 m_PDFPropertyPopups( false ),
107 m_theme(),
109 m_outputFile(),
111 {
112
113 }
114};
115
116
121{
122public:
126 SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
127
131 SCH_PLOTTER( SCHEMATIC* aSch );
132
141 void Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS& aPlotSettings,
142 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
143
147 wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
148
149protected:
153 wxFileName getOutputFilenameSingle( const SCH_PLOT_SETTINGS& aPlotSettings, REPORTER* aReporter,
154 const wxString& ext );
155
156 // PDF
157 void createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
158 REPORTER* aReporter );
159 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
160 const SCH_PLOT_SETTINGS& aPlotSettings );
161 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
162 const SCH_PLOT_SETTINGS& aPlotSettings );
163
164 // DXF
165 void createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
166 REPORTER* aReporter );
167 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
168 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
169 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings );
170
171
172 // HPGL
173 void createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
174 REPORTER* aReporter );
175 bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
176 const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
177 const VECTOR2I& aPlot0ffset, double aScale,
178 const SCH_PLOT_SETTINGS& aPlotSettings );
179
180 // PS
181 void createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
182 REPORTER* aReporter );
183 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
184 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
185 const VECTOR2I& aPlot0ffset, double aScale,
186 const SCH_PLOT_SETTINGS& aPlotSettings );
187
188 // SVG
189 void createSVGFiles( const SCH_PLOT_SETTINGS& aPlotSettings, RENDER_SETTINGS* aRenderSettings,
190 REPORTER* aReporter );
191 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
192 RENDER_SETTINGS* aRenderSettings,
193 const SCH_PLOT_SETTINGS& aPlotSettings );
194
201 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
202
203
213 wxFileName createPlotFileName( const SCH_PLOT_SETTINGS& aPlotSettings,
214 const wxString& aPlotFileName, const wxString& aExtension,
215 REPORTER* aReporter = nullptr );
216
217private:
221};
222
223#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:59
Base plotter engine class.
Definition: plotter.h:104
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:75
Schematic editor (Eeschema) main window.
Schematic plotting class.
Definition: sch_plotter.h:121
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:87
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:220
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
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:147
COLOR_SETTINGS * m_colorSettings
Definition: sch_plotter.h:219
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:218
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_FORMAT
The set of supported output plot formats.
Definition: plotter.h:64
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.
bool m_PDFPropertyPopups
Definition: sch_plotter.h:90
double m_HPGLPenSize
Definition: sch_plotter.h:88
wxString m_theme
Definition: sch_plotter.h:91
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
Definition: sch_plotter.h:89
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
Definition: sch_plotter.h:96
bool m_useBackgroundColor
Definition: sch_plotter.h:87
std::vector< wxString > m_plotPages
Definition: sch_plotter.h:83
wxString m_outputDirectory
Definition: sch_plotter.h:93
wxString m_outputFile
Definition: sch_plotter.h:94