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, 2024 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/filename.h>
31#include <wx/string.h>
32#include <wx/gdicmn.h>
33#include <page_info.h>
34#include <sch_render_settings.h>
35#include <sch_sheet_path.h>
36#include <plotters/plotter.h>
37
38class SCH_EDIT_FRAME;
39class PLOTTER;
40class SCHEMATIC;
41class SCH_SCREEN;
43class PDF_PLOTTER;
44class REPORTER;
45
47{
52};
53
54
56{
60};
61
62
64{
65 DEFAULT = 0,
66 SIZE_A5,
67 SIZE_A4,
68 SIZE_A3,
69 SIZE_A2,
70 SIZE_A1,
71 SIZE_A0,
72 SIZE_A,
73 SIZE_B,
74 SIZE_C,
75 SIZE_D,
76 SIZE_E,
77};
78
79
81{
84 std::vector<wxString> m_plotPages;
85
89 double m_HPGLPenSize; // for HPGL format only: pen size
94 wxString m_theme;
95
97 wxString m_outputFile;
98
100
102 m_plotAll( true ),
103 m_plotDrawingSheet( true ),
104 m_blackAndWhite( false ),
105 m_pageSizeSelect( 0 ),
106 m_useBackgroundColor( true ),
107 m_HPGLPenSize( 1.0 ),
109 m_PDFPropertyPopups( false ),
110 m_PDFHierarchicalLinks( false ),
111 m_PDFMetadata( false ),
112 m_theme(),
114 m_outputFile(),
116 {
117
118 }
119};
120
121
126{
127public:
131 SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
132
136 SCH_PLOTTER( SCHEMATIC* aSch );
137
146 void Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS& aPlotOpts,
147 SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
148
152 wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
153
154protected:
158 wxFileName getOutputFilenameSingle( const SCH_PLOT_OPTS& aPlotOpts, REPORTER* aReporter,
159 const wxString& ext );
160
161 // PDF
162 void createPDFFile( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
163 REPORTER* aReporter );
164 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
165 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
166
167 // DXF
168 void createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
169 REPORTER* aReporter );
170 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
171 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
172 double aScale, const SCH_PLOT_OPTS& aPlotOpts );
173
174
175 // HPGL
176 void createHPGLFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
177 REPORTER* aReporter );
178 bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
179 const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
180 const VECTOR2I& aPlot0ffset, double aScale,
181 const SCH_PLOT_OPTS& aPlotOpts );
182
183 // PS
184 void createPSFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
185 REPORTER* aReporter );
186 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
187 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
188 const VECTOR2I& aPlot0ffset, double aScale,
189 const SCH_PLOT_OPTS& aPlotOpts );
190
191 // SVG
192 void createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
193 REPORTER* aReporter );
194 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
195 RENDER_SETTINGS* aRenderSettings, const SCH_PLOT_OPTS& aPlotOpts );
196
203 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
204
205
215 wxFileName createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts, const wxString& aPlotFileName,
216 const wxString& aExtension, REPORTER* aReporter = nullptr );
217
218private:
222};
223
224#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:105
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Holds all the data relating to one schematic.
Definition: schematic.h:77
Schematic editor (Eeschema) main window.
Schematic plotting class.
Definition: sch_plotter.h:126
void Plot(PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter=nullptr)
Perform the plotting of the schematic using the given aPlotFormat and aPlotSettings.
wxFileName getOutputFilenameSingle(const SCH_PLOT_OPTS &aPlotOpts, REPORTER *aReporter, const wxString &ext)
Returns the output filename for formats where the output is a single file.
Definition: sch_plotter.cpp:87
void createSVGFiles(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createPSFiles(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_OPTS &aPlotOpts)
wxFileName createPlotFileName(const SCH_PLOT_OPTS &aPlotOpts, const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=nullptr)
Create a file name with an absolute path name.
bool plotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlotOffset, double aScale, const SCH_PLOT_OPTS &aPlotOpts)
void createDXFFiles(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createHPGLFiles(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
wxString m_lastOutputFilePath
Definition: sch_plotter.h:221
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const SCH_PLOT_OPTS &aPlotOpts)
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_OPTS &aPlotOpts)
bool plotOneSheetHpgl(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_OPTS &aPlotOpts)
void createPDFFile(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
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:152
COLOR_SETTINGS * m_colorSettings
Definition: sch_plotter.h:220
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_OPTS &aPlotOpts)
SCHEMATIC * m_schematic
Definition: sch_plotter.h:219
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:65
PageFormatReq
Definition: sch_plotter.h:56
@ PAGE_SIZE_AUTO
Definition: sch_plotter.h:57
@ PAGE_SIZE_A
Definition: sch_plotter.h:59
@ PAGE_SIZE_A4
Definition: sch_plotter.h:58
HPGL_PAGE_SIZE
Definition: sch_plotter.h:64
HPGL_PLOT_ORIGIN_AND_UNITS
Definition: sch_plotter.h:47
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< wxString > m_plotPages
Definition: sch_plotter.h:84
wxString m_theme
Definition: sch_plotter.h:94
bool m_PDFPropertyPopups
Definition: sch_plotter.h:91
wxString m_outputDirectory
Definition: sch_plotter.h:96
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
Definition: sch_plotter.h:99
wxString m_outputFile
Definition: sch_plotter.h:97
int m_pageSizeSelect
Definition: sch_plotter.h:87
bool m_PDFMetadata
Definition: sch_plotter.h:93
bool m_blackAndWhite
Definition: sch_plotter.h:86
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
Definition: sch_plotter.h:90
double m_HPGLPenSize
Definition: sch_plotter.h:89
bool m_PDFHierarchicalLinks
Definition: sch_plotter.h:92
bool m_useBackgroundColor
Definition: sch_plotter.h:88
bool m_plotDrawingSheet
Definition: sch_plotter.h:83