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

Protected Member Functions

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

Private Attributes

SCHEMATICm_schematic
 
COLOR_SETTINGSm_colorSettings
 
wxString m_lastOutputFilePath
 

Detailed Description

Schematic plotting class.

Definition at line 122 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_SETTINGS aPlotSettings,
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 1009 of file sch_plotter.cpp.

References _, EnsureFileDirectoryExists(), SCH_PLOT_SETTINGS::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 149 of file sch_plotter.h.

References m_lastOutputFilePath.

◆ getOutputFilenameSingle()

wxFileName SCH_PLOTTER::getOutputFilenameSingle ( const SCH_PLOT_SETTINGS aPlotSettings,
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_SETTINGS::m_outputFile, and m_schematic.

Referenced by createPDFFile().

◆ Plot()

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

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 1050 of file sch_plotter.cpp.

References createDXFFiles(), createHPGLFiles(), createPDFFile(), createPSFiles(), createSVGFiles(), SETTINGS_MANAGER::GetColorSettings(), PGM_BASE::GetSettingsManager(), m_colorSettings, SCH_PLOT_SETTINGS::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_SETTINGS aPlotSettings 
)
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 994 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 221 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: