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 The 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCH_PLOTTER_H
24#define SCH_PLOTTER_H
25
26#include <wx/filename.h>
27#include <wx/string.h>
28#include <wx/gdicmn.h>
29#include <page_info.h>
30#include <sch_render_settings.h>
31#include <sch_sheet_path.h>
32#include <plotters/plotter.h>
34
35class SCH_EDIT_FRAME;
36class PLOTTER;
37class SCHEMATIC;
38class SCH_SCREEN;
40class PDF_PLOTTER;
41class REPORTER;
42
49
50
52{
55 std::vector<wxString> m_plotPages;
56
64 wxString m_theme;
65
67 wxString m_outputFile;
68 wxString m_variant;
69
70 // has meaning only with DXF plotter: set DXF units in DXF file
72
75
77 m_plotAll( true ),
78 m_plotDrawingSheet( true ),
79 m_plotHopOver( false ),
80 m_blackAndWhite( false ),
83 m_PDFPropertyPopups( false ),
85 m_PDFMetadata( false ),
86 m_theme(),
91 m_pngAntialias( true )
92 {
93
94 }
95};
96
97
102{
103public:
107 SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
108
112 SCH_PLOTTER( SCHEMATIC* aSch );
113
122 void Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS& aPlotOpts,
123 SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
124
129 wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
130
134 const std::vector<wxString>& GetOutputFilePaths() const { return m_outputFilePaths; }
135
136protected:
140 wxFileName getOutputFilenameSingle( const SCH_PLOT_OPTS& aPlotOpts, REPORTER* aReporter,
141 const wxString& ext );
142
143 // PDF
144 void createPDFFile( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
145 REPORTER* aReporter );
146 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
147 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
148
149 // DXF
150 void createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
151 REPORTER* aReporter );
152 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
153 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
154 double aScale, const SCH_PLOT_OPTS& aPlotOpts );
155
156
157 // PS
158 void createPSFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
159 REPORTER* aReporter );
160 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
161 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
162 const VECTOR2I& aPlot0ffset, double aScale,
163 const SCH_PLOT_OPTS& aPlotOpts );
164
165 // SVG
166 void createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
167 REPORTER* aReporter );
168 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
169 RENDER_SETTINGS* aRenderSettings, const SCH_PLOT_OPTS& aPlotOpts );
170
171 // PNG
172 void createPNGFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
173 REPORTER* aReporter );
174 bool plotOneSheetPNG( const wxString& aFileName, SCH_SCREEN* aScreen,
175 RENDER_SETTINGS* aRenderSettings, const SCH_PLOT_OPTS& aPlotOpts );
176
183 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
184
185
195 wxFileName createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts, const wxString& aPlotFileName,
196 const wxString& aExtension, REPORTER* aReporter = nullptr );
197
198private:
202 std::vector<wxString> m_outputFilePaths;
203};
204
205#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:75
Base plotter engine class.
Definition plotter.h:133
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:90
Schematic editor (Eeschema) main window.
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 a\ aPlotSettings.
wxFileName getOutputFilenameSingle(const SCH_PLOT_OPTS &aPlotOpts, REPORTER *aReporter, const wxString &ext)
Return the output filename for formats where the output is a single file.
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.
SCH_PLOTTER(SCH_EDIT_FRAME *aFrame)
Constructor for usage with a frame having the schematic we want to print loaded.
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)
const std::vector< wxString > & GetOutputFilePaths() const
Get all output file paths generated by the last Plot() call.
wxString m_lastOutputFilePath
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
std::vector< wxString > m_outputFilePaths
void createPNGFiles(const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
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 plotOneSheetPNG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, 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.
COLOR_SETTINGS * m_colorSettings
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
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
DXF_UNITS
Definition plotter.h:48
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:60
constexpr int DEFAULT_PNG_DPI
Definition plotter_png.h:28
@ INCH
Definition rs274x.cpp:58
PageFormatReq
Definition sch_plotter.h:44
@ PAGE_SIZE_AUTO
Definition sch_plotter.h:45
@ PAGE_SIZE_A
Definition sch_plotter.h:47
@ PAGE_SIZE_A4
Definition sch_plotter.h:46
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< wxString > m_plotPages
Definition sch_plotter.h:55
wxString m_theme
Definition sch_plotter.h:64
DXF_UNITS m_DXF_File_Unit
Definition sch_plotter.h:71
bool m_PDFPropertyPopups
Definition sch_plotter.h:61
wxString m_outputDirectory
Definition sch_plotter.h:66
bool m_pngAntialias
Definition sch_plotter.h:74
wxString m_outputFile
Definition sch_plotter.h:67
bool m_blackAndWhite
Definition sch_plotter.h:58
wxString m_variant
Definition sch_plotter.h:68
bool m_PDFHierarchicalLinks
Definition sch_plotter.h:62
bool m_useBackgroundColor
Definition sch_plotter.h:60
bool m_plotDrawingSheet
Definition sch_plotter.h:54
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683