KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_plotter.cpp File Reference
#include "core/typeinfo.h"
#include <wx/log.h>
#include <common.h>
#include <sch_plotter.h>
#include <plotters/plotter_dxf.h>
#include <plotters/plotter_png.h>
#include <plotters/plotters_pslike.h>
#include <pgm_base.h>
#include <trace_helpers.h>
#include <lib_symbol.h>
#include <locale_io.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <sch_shape.h>
#include <schematic.h>
#include <sch_screen.h>
#include <settings/settings_manager.h>
#include <algorithm>

Go to the source code of this file.

Functions

BOX2I GetSymbolPlotBBox (const LIB_SYMBOL &aSymbol, int aUnit, int aBodyStyle, bool aIncludeHiddenFields)
 Compute the bounding box used to size a symbol SVG plot.
 
bool PlotSymbolToSVG (LIB_SYMBOL &aDrawSymbol, LIB_SYMBOL &aFieldsSymbol, int aUnit, int aBodyStyle, const BOX2I &aBBox, SCH_RENDER_SETTINGS &aRenderSettings, bool aBlackAndWhite, const wxString &aFileName, REPORTER *aReporter)
 Plot a single symbol variant (unit and body style) to an SVG file.
 

Function Documentation

◆ GetSymbolPlotBBox()

BOX2I GetSymbolPlotBBox ( const LIB_SYMBOL & aSymbol,
int aUnit,
int aBodyStyle,
bool aIncludeHiddenFields )

Compute the bounding box used to size a symbol SVG plot.

The symbol's unit bounding box, is inflated by a small margin so the drawing does not touch the page edges.

Parameters
aSymbolis the symbol to measure (may be a derived symbol).
aUnitis the unit to measure (1-based).
aBodyStyleis the body style to measure (1-based).
aIncludeHiddenFieldswhen true, hidden fields are included in the bounding box.

Definition at line 1153 of file sch_plotter.cpp.

References LIB_SYMBOL::Flatten(), BOX2< Vec >::Inflate(), and schIUScale.

Referenced by EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SYMBOL_SVG_EXPORT_FIXTURE::PlotToSvgString(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ PlotSymbolToSVG()

bool PlotSymbolToSVG ( LIB_SYMBOL & aDrawSymbol,
LIB_SYMBOL & aFieldsSymbol,
int aUnit,
int aBodyStyle,
const BOX2I & aBBox,
SCH_RENDER_SETTINGS & aRenderSettings,
bool aBlackAndWhite,
const wxString & aFileName,
REPORTER * aReporter = nullptr )

Plot a single symbol variant (unit and body style) to an SVG file.

The page is sized to aBBox and the symbol is plotted with its origin at the SVG origin; the SVG viewBox covers the whole bounding box, which may extend to negative coordinates.

Parameters
aDrawSymbolis the symbol whose draw items are plotted. For derived (alias) symbols this is the root symbol, which holds the draw items.
aFieldsSymbolis the symbol whose fields are plotted. For aliases this is the derived symbol.
aUnitis the unit to plot (1-based).
aBodyStyleis the body style to plot (1-based).
aBBoxis the bounding box used to size the page and the SVG viewBox this may be computed using GetSymbolPlotBBox, or by some other means.
aRenderSettingsthe render settings used for the plot.
aBlackAndWhitewhen true, plot without color.
aFileNamethe full path of the SVG file to create.
aReporteroptional reporter for error messages.
Returns
true when the file was written, false on error.

Definition at line 1172 of file sch_plotter.cpp.

References _, BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), LIB_SYMBOL::Plot(), LIB_SYMBOL::PlotFields(), REPORTER::Report(), RPT_SEVERITY_ERROR, schIUScale, PAGE_INFO::SetHeightMils(), PAGE_INFO::SetWidthMils(), and User.

Referenced by EESCHEMA_JOBS_HANDLER::doSymExportSvg(), SYMBOL_SVG_EXPORT_FIXTURE::PlotToSvgString(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().