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, 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
52
53
55{
58 std::vector<wxString> m_plotPages;
59
67 wxString m_theme;
68
70 wxString m_outputFile;
71 wxString m_variant;
72
73 // has meaning only with DXF plotter: set DXF units in DXF file
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(),
90 {
91
92 }
93};
94
95
100{
101public:
105 SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
106
110 SCH_PLOTTER( SCHEMATIC* aSch );
111
120 void Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS& aPlotOpts,
121 SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
122
127 wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
128
132 const std::vector<wxString>& GetOutputFilePaths() const { return m_outputFilePaths; }
133
134protected:
138 wxFileName getOutputFilenameSingle( const SCH_PLOT_OPTS& aPlotOpts, REPORTER* aReporter,
139 const wxString& ext );
140
141 // PDF
142 void createPDFFile( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
143 REPORTER* aReporter );
144 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
145 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, const SCH_PLOT_OPTS& aPlotOpts );
146
147 // DXF
148 void createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
149 REPORTER* aReporter );
150 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
151 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
152 double aScale, const SCH_PLOT_OPTS& aPlotOpts );
153
154
155 // PS
156 void createPSFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
157 REPORTER* aReporter );
158 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
159 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
160 const VECTOR2I& aPlot0ffset, double aScale,
161 const SCH_PLOT_OPTS& aPlotOpts );
162
163 // SVG
164 void createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts, SCH_RENDER_SETTINGS* aRenderSettings,
165 REPORTER* aReporter );
166 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
167 RENDER_SETTINGS* aRenderSettings, const SCH_PLOT_OPTS& aPlotOpts );
168
175 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
176
177
187 wxFileName createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts, const wxString& aPlotFileName,
188 const wxString& aExtension, REPORTER* aReporter = nullptr );
189
190private:
194 std::vector<wxString> m_outputFilePaths;
195};
196
197#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:79
Base plotter engine class.
Definition plotter.h:136
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
Holds all the data relating to one schematic.
Definition schematic.h:89
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
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)
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:52
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:64
@ INCH
Definition rs274x.cpp:62
PageFormatReq
Definition sch_plotter.h:47
@ PAGE_SIZE_AUTO
Definition sch_plotter.h:48
@ PAGE_SIZE_A
Definition sch_plotter.h:50
@ PAGE_SIZE_A4
Definition sch_plotter.h:49
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< wxString > m_plotPages
Definition sch_plotter.h:58
wxString m_theme
Definition sch_plotter.h:67
DXF_UNITS m_DXF_File_Unit
Definition sch_plotter.h:74
bool m_PDFPropertyPopups
Definition sch_plotter.h:64
wxString m_outputDirectory
Definition sch_plotter.h:69
wxString m_outputFile
Definition sch_plotter.h:70
bool m_blackAndWhite
Definition sch_plotter.h:61
wxString m_variant
Definition sch_plotter.h:71
bool m_PDFHierarchicalLinks
Definition sch_plotter.h:65
bool m_useBackgroundColor
Definition sch_plotter.h:63
bool m_plotDrawingSheet
Definition sch_plotter.h:57
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687