KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_PLOTTER Class Reference

Schematic plotting class. More...

#include <sch_plotter.h>

Public Member Functions

 SCH_PLOTTER (SCH_EDIT_FRAME *aFrame)
 Constructor for usage with a frame having the schematic we want to print loaded.
 
 SCH_PLOTTER (SCHEMATIC *aSch)
 Constructor for usage with a schematic that can be headless.
 
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.
 
wxString GetLastOutputFilePath () const
 Get the last output file path, this is mainly intended for PDFs with the open after plot GUI option.
 

Protected Member Functions

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.
 
void createPDFFile (const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
 
void plotOneSheetPDF (PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_OPTS &aPlotOpts)
 
void setupPlotPagePDF (PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_OPTS &aPlotOpts)
 
void createDXFFiles (const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
 
bool plotOneSheetDXF (const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlotOffset, double aScale, const SCH_PLOT_OPTS &aPlotOpts)
 
void createHPGLFiles (const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
 
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 createPSFiles (const SCH_PLOT_OPTS &aPlotOpts, SCH_RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
 
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)
 
void createSVGFiles (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 restoreEnvironment (PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
 Everything done, close the plot and restore the environment.
 
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.
 

Private Attributes

SCHEMATICm_schematic
 
COLOR_SETTINGSm_colorSettings
 
wxString m_lastOutputFilePath
 

Detailed Description

Schematic plotting class.

Definition at line 125 of file sch_plotter.h.

Constructor & Destructor Documentation

◆ SCH_PLOTTER() [1/2]

SCH_PLOTTER::SCH_PLOTTER ( SCH_EDIT_FRAME aFrame)

Constructor for usage with a frame having the schematic we want to print loaded.

Definition at line 80 of file sch_plotter.cpp.

References m_colorSettings.

◆ SCH_PLOTTER() [2/2]

SCH_PLOTTER::SCH_PLOTTER ( SCHEMATIC aSch)

Constructor for usage with a schematic that can be headless.

Definition at line 73 of file sch_plotter.cpp.

References m_colorSettings.

Member Function Documentation

◆ createDXFFiles()

◆ createHPGLFiles()

◆ createPDFFile()

◆ createPlotFileName()

wxFileName SCH_PLOTTER::createPlotFileName ( const SCH_PLOT_OPTS aPlotOpts,
const wxString &  aPlotFileName,
const wxString &  aExtension,
REPORTER aReporter = nullptr 
)
protected

Create a file name with an absolute path name.

Parameters
aPlotFileNamethe name for the file to plot without a path.
aExtensionthe extension for the file to plot.
aReportera point to a REPORTER object use to show messages (can be NULL).
Returns
the created file name.
Exceptions
IO_ERRORon file I/O errors.

Definition at line 1016 of file sch_plotter.cpp.

References _, EnsureFileDirectoryExists(), SCH_PLOT_OPTS::m_outputDirectory, SCHEMATIC_SETTINGS::m_PlotDirectoryName, m_schematic, REPORTER::Report(), RPT_SEVERITY_ERROR, SCHEMATIC::Settings(), and tracePathsAndFiles.

Referenced by createDXFFiles(), createHPGLFiles(), createPSFiles(), createSVGFiles(), and getOutputFilenameSingle().

◆ createPSFiles()

◆ createSVGFiles()

◆ GetLastOutputFilePath()

wxString SCH_PLOTTER::GetLastOutputFilePath ( ) const
inline

Get the last output file path, this is mainly intended for PDFs with the open after plot GUI option.

Definition at line 152 of file sch_plotter.h.

References m_lastOutputFilePath.

◆ getOutputFilenameSingle()

wxFileName SCH_PLOTTER::getOutputFilenameSingle ( const SCH_PLOT_OPTS aPlotOpts,
REPORTER aReporter,
const wxString &  ext 
)
protected

Returns the output filename for formats where the output is a single file.

Definition at line 87 of file sch_plotter.cpp.

References createPlotFileName(), SCHEMATIC::GetUniqueFilenameForCurrentSheet(), SCH_PLOT_OPTS::m_outputFile, and m_schematic.

Referenced by createPDFFile().

◆ Plot()

void SCH_PLOTTER::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.

Parameters
aPlotFormatThe resulting output plot format (PDF, SVG, DXF, etc)
aPlotSettingsThe configuration for the plotting operation
aRenderSettingsMandatory object containing render settings for lower level classes
aReporterOptional reporter to print messages to

Definition at line 1057 of file sch_plotter.cpp.

References createDXFFiles(), createHPGLFiles(), createPDFFile(), createPSFiles(), createSVGFiles(), SETTINGS_MANAGER::GetColorSettings(), PGM_BASE::GetSettingsManager(), m_colorSettings, SCH_PLOT_OPTS::m_theme, and Pgm().

◆ plotOneSheetDXF()

◆ plotOneSheetHpgl()

◆ plotOneSheetPDF()

◆ plotOneSheetPS()

◆ plotOneSheetSVG()

bool SCH_PLOTTER::plotOneSheetSVG ( const wxString &  aFileName,
SCH_SCREEN aScreen,
RENDER_SETTINGS aRenderSettings,
const SCH_PLOT_OPTS aPlotOpts 
)
protected

◆ restoreEnvironment()

void SCH_PLOTTER::restoreEnvironment ( PDF_PLOTTER aPlotter,
SCH_SHEET_PATH aOldsheetpath 
)
protected

Everything done, close the plot and restore the environment.

Parameters
aPlotterthe plotter to close and destroy (can be null if no current active plotter)
aOldsheetpaththe stored old sheet path for the current sheet before the plot started

Definition at line 1001 of file sch_plotter.cpp.

References SCHEMATIC::CurrentSheet(), PDF_PLOTTER::EndPlot(), m_schematic, SCHEMATIC::SetCurrentSheet(), SCHEMATIC::SetSheetNumberAndCount(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

Referenced by createDXFFiles(), createHPGLFiles(), createPDFFile(), createPSFiles(), and createSVGFiles().

◆ setupPlotPagePDF()

Member Data Documentation

◆ m_colorSettings

COLOR_SETTINGS* SCH_PLOTTER::m_colorSettings
private

Definition at line 220 of file sch_plotter.h.

Referenced by Plot(), plotOneSheetDXF(), plotOneSheetHpgl(), and SCH_PLOTTER().

◆ m_lastOutputFilePath

wxString SCH_PLOTTER::m_lastOutputFilePath
private

◆ m_schematic


The documentation for this class was generated from the following files: