23#include <schematic_lexer.h>
28using namespace TSCHEMATIC_T;
50 aFormatter->
Print( aNestLevel,
"(fill (type %s) (color %d %d %d %s))",
59 aFormatter->
Print( aNestLevel,
"(fill (type %s))",
70 return SCHEMATIC_LEXER::TokenName( T_input );
73 return SCHEMATIC_LEXER::TokenName( T_output );
76 return SCHEMATIC_LEXER::TokenName( T_bidirectional );
79 return SCHEMATIC_LEXER::TokenName( T_tri_state );
82 return SCHEMATIC_LEXER::TokenName( T_passive );
85 return SCHEMATIC_LEXER::TokenName( T_free );
88 return SCHEMATIC_LEXER::TokenName( T_unspecified );
91 return SCHEMATIC_LEXER::TokenName( T_power_in );
94 return SCHEMATIC_LEXER::TokenName( T_power_out );
97 return SCHEMATIC_LEXER::TokenName( T_open_collector );
100 return SCHEMATIC_LEXER::TokenName( T_open_emitter );
103 return SCHEMATIC_LEXER::TokenName( T_no_connect );
106 wxFAIL_MSG(
"Missing symbol library pin connection type" );
118 return SCHEMATIC_LEXER::TokenName( T_line );
121 return SCHEMATIC_LEXER::TokenName( T_inverted );
124 return SCHEMATIC_LEXER::TokenName( T_clock );
127 return SCHEMATIC_LEXER::TokenName( T_inverted_clock );
130 return SCHEMATIC_LEXER::TokenName( T_input_low );
133 return SCHEMATIC_LEXER::TokenName( T_clock_low );
136 return SCHEMATIC_LEXER::TokenName( T_output_low );
139 return SCHEMATIC_LEXER::TokenName( T_edge_clock_high );
142 return SCHEMATIC_LEXER::TokenName( T_non_logic );
145 wxFAIL_MSG(
"Missing symbol library pin shape type" );
154 switch( aOrientation )
160 default: wxFAIL_MSG(
"Missing symbol library pin orientation type" );
return ANGLE_0;
178 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_passive );
192 default: wxFAIL;
return ANGLE_0;
201 case SCH_TEXT_T:
return SCHEMATIC_LEXER::TokenName( T_text );
202 case SCH_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_label );
204 case SCH_HIER_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_hierarchical_label );
206 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_text );
226 const COLOR4D& aFillColor,
bool aInvertY,
const KIID& aUuid )
228 aFormatter->
Print( aNestLevel,
"(arc%s (start %s) (mid %s) (end %s)\n",
229 aIsPrivate ?
" private" :
"",
235 aFormatter->
Print( 0,
"\n" );
236 formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
237 aFormatter->
Print( 0,
"\n" );
242 aFormatter->
Print( aNestLevel,
")\n" );
248 const COLOR4D& aFillColor,
bool aInvertY,
const KIID& aUuid )
250 aFormatter->
Print( aNestLevel,
"(circle%s (center %s) (radius %s)\n",
251 aIsPrivate ?
" private" :
"",
256 aFormatter->
Print( 0,
"\n" );
257 formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
258 aFormatter->
Print( 0,
"\n" );
263 aFormatter->
Print( aNestLevel,
")\n" );
269 const COLOR4D& aFillColor,
bool aInvertY,
const KIID& aUuid )
271 aFormatter->
Print( aNestLevel,
"(rectangle%s (start %s) (end %s)\n",
272 aIsPrivate ?
" private" :
"",
276 aFormatter->
Print( 0,
"\n" );
277 formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
278 aFormatter->
Print( 0,
"\n" );
283 aFormatter->
Print( aNestLevel,
")\n" );
289 const COLOR4D& aFillColor,
bool aInvertY,
const KIID& aUuid )
291 aFormatter->
Print( aNestLevel,
"(bezier%s (pts ",
292 aIsPrivate ?
" private" :
"" );
297 aFormatter->
Print( 0,
" (xy %s)",
301 aFormatter->
Print( 0,
")\n" );
304 aFormatter->
Print( 0,
"\n" );
305 formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
306 aFormatter->
Print( 0,
"\n" );
311 aFormatter->
Print( aNestLevel,
")\n" );
317 const COLOR4D& aFillColor,
bool aInvertY,
const KIID& aUuid )
321 aFormatter->
Print( aNestLevel,
"(polyline%s\n", aIsPrivate ?
" private" :
"" );
322 aFormatter->
Print( aNestLevel + 1,
"(pts" );
328 aFormatter->
Print( 0,
"\n" );
329 aFormatter->
Print( aNestLevel + 2,
"(xy %s)",
formatIU( pt, aInvertY ).c_str() );
335 aFormatter->
Print( 0,
" (xy %s)",
formatIU( pt, aInvertY ).c_str() );
343 aFormatter->
Print( 0,
")\n" );
347 aFormatter->
Print( 0,
"\n" );
348 aFormatter->
Print( aNestLevel + 1,
")\n" );
352 aFormatter->
Print( 0,
"\n" );
353 formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
354 aFormatter->
Print( 0,
"\n" );
359 aFormatter->
Print( aNestLevel,
")\n" );
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
const VECTOR2I & GetBezierC2() const
SHAPE_POLY_SET & GetPolyShape()
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
const VECTOR2I & GetBezierC1() const
VECTOR2I GetArcMid() const
A color representation with 4 components: red, green, blue, alpha.
wxString AsString() const
const std::vector< VECTOR2I > & CPoints() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
Simple container to manage line stroke parameters.
void Format(OUTPUTFORMATTER *out, const EDA_IU_SCALE &aIuScale, int nestLevel) const
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
@ FILLED_WITH_BG_BODYCOLOR
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API std::string FormatInternalUnits(const EDA_IU_SCALE &aIuScale, int aValue)
Converts aValue from internal units to a string appropriate for writing to file.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_TRISTATE
tris state bus pin
@ PT_NIC
not internally connected (may be connected to anything)
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
EDA_ANGLE getPinAngle(PIN_ORIENTATION aOrientation)
const char * getSheetPinShapeToken(LABEL_FLAG_SHAPE aShape)
void formatArc(OUTPUTFORMATTER *aFormatter, int aNestLevel, EDA_SHAPE *aArc, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
const char * getPinElectricalTypeToken(ELECTRICAL_PINTYPE aType)
void formatFill(OUTPUTFORMATTER *aFormatter, int aNestLevel, FILL_T aFillMode, const COLOR4D &aFillColor)
Fill token formatting helper.
const char * getTextTypeToken(KICAD_T aType)
void formatCircle(OUTPUTFORMATTER *aFormatter, int aNestLevel, EDA_SHAPE *aCircle, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
void formatBezier(OUTPUTFORMATTER *aFormatter, int aNestLevel, EDA_SHAPE *aBezier, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
void formatRect(OUTPUTFORMATTER *aFormatter, int aNestLevel, EDA_SHAPE *aRect, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
std::string formatIU(const int &aValue)
void formatPoly(OUTPUTFORMATTER *aFormatter, int aNestLevel, EDA_SHAPE *aPolyLine, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
EDA_ANGLE getSheetPinAngle(SHEET_SIDE aSide)
const char * getPinShapeToken(GRAPHIC_PINSHAPE aShape)
static const char * emptyString
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.