KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_editor_plotter.cpp
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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20
21#include <sch_painter.h>
22#include <symbol_edit_frame.h>
23#include <sch_plotter.h>
24
25void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
26{
27 if( !m_symbol )
28 return;
29
30 SCH_RENDER_SETTINGS renderSettings;
31 renderSettings.LoadColors( GetColorSettings() );
32 renderSettings.SetDefaultPenWidth( GetRenderSettings()->GetDefaultPenWidth() );
33
34 // The symbol is exported in color with its origin at the SVG origin; the page and viewBox
35 // are sized to the symbol's bounding box, with hidden fields excluded from the box (they
36 // are still plotted).
37 BOX2I symbolBB = GetSymbolPlotBBox( *m_symbol, GetUnit(), GetBodyStyle(), false );
38
39 PlotSymbolToSVG( *m_symbol, *m_symbol, GetUnit(), GetBodyStyle(), symbolBB, renderSettings, false, aFullFileName );
40}
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
void SetDefaultPenWidth(int aWidth)
SCH_RENDER_SETTINGS * GetRenderSettings()
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SVGPlotSymbol(const wxString &aFullFileName)
Create the SVG print file for the current edited symbol.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
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.
BOX2I GetSymbolPlotBBox(const LIB_SYMBOL &aSymbol, int aUnit, int aBodyStyle, bool aIncludeHiddenFields)
Compute the bounding box used to size a symbol SVG plot.