22#include <schematic_lexer.h>
27using namespace TSCHEMATIC_T;
48 aFormatter->
Print(
"(fill (type %s) (color %d %d %d %s))",
57 aFormatter->
Print(
"(fill (type %s))",
68 return SCHEMATIC_LEXER::TokenName( T_input );
71 return SCHEMATIC_LEXER::TokenName( T_output );
74 return SCHEMATIC_LEXER::TokenName( T_bidirectional );
77 return SCHEMATIC_LEXER::TokenName( T_tri_state );
80 return SCHEMATIC_LEXER::TokenName( T_passive );
83 return SCHEMATIC_LEXER::TokenName( T_free );
86 return SCHEMATIC_LEXER::TokenName( T_unspecified );
89 return SCHEMATIC_LEXER::TokenName( T_power_in );
92 return SCHEMATIC_LEXER::TokenName( T_power_out );
95 return SCHEMATIC_LEXER::TokenName( T_open_collector );
98 return SCHEMATIC_LEXER::TokenName( T_open_emitter );
101 return SCHEMATIC_LEXER::TokenName( T_no_connect );
104 wxFAIL_MSG(
"Missing symbol library pin connection type" );
116 return SCHEMATIC_LEXER::TokenName( T_line );
119 return SCHEMATIC_LEXER::TokenName( T_inverted );
122 return SCHEMATIC_LEXER::TokenName( T_clock );
125 return SCHEMATIC_LEXER::TokenName( T_inverted_clock );
128 return SCHEMATIC_LEXER::TokenName( T_input_low );
131 return SCHEMATIC_LEXER::TokenName( T_clock_low );
134 return SCHEMATIC_LEXER::TokenName( T_output_low );
137 return SCHEMATIC_LEXER::TokenName( T_edge_clock_high );
140 return SCHEMATIC_LEXER::TokenName( T_non_logic );
143 wxFAIL_MSG(
"Missing symbol library pin shape type" );
152 switch( aOrientation )
158 default: wxFAIL_MSG(
"Missing symbol library pin orientation type" );
return ANGLE_0;
176 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_passive );
190 default: wxFAIL;
return ANGLE_0;
199 case SCH_TEXT_T:
return SCHEMATIC_LEXER::TokenName( T_text );
200 case SCH_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_label );
202 case SCH_HIER_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_hierarchical_label );
204 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_text );
224 bool aInvertY,
const KIID& aUuid )
226 aFormatter->
Print(
"(arc %s (start %s) (mid %s) (end %s)",
227 aIsPrivate ?
"private" :
"",
233 formatFill( aFormatter, aFillMode, aFillColor );
238 aFormatter->
Print(
")" );
244 bool aInvertY,
const KIID& aUuid )
246 aFormatter->
Print(
"(circle %s (center %s) (radius %s)",
247 aIsPrivate ?
"private" :
"",
252 formatFill( aFormatter, aFillMode, aFillColor );
257 aFormatter->
Print(
")" );
263 bool aInvertY,
const KIID& aUuid )
265 aFormatter->
Print(
"(rectangle %s (start %s) (end %s)",
266 aIsPrivate ?
"private" :
"",
270 formatFill( aFormatter, aFillMode, aFillColor );
275 aFormatter->
Print(
")" );
281 bool aInvertY,
const KIID& aUuid )
283 aFormatter->
Print(
"(bezier %s (pts ",
284 aIsPrivate ?
"private" :
"" );
289 aFormatter->
Print(
"(xy %s)",
formatIU( pt, aInvertY ).c_str() );
292 aFormatter->
Print(
")" );
295 formatFill( aFormatter, aFillMode, aFillColor );
300 aFormatter->
Print(
")" );
306 bool aInvertY,
const KIID& aUuid )
308 aFormatter->
Print(
"(polyline %s (pts ",
309 aIsPrivate ?
"private" :
"" );
317 wxFAIL_MSG(
"Polyline has no outlines" );
322 aFormatter->
Print(
"(xy %s)",
formatIU( pt, aInvertY ).c_str() );
325 aFormatter->
Print(
")" );
328 formatFill( aFormatter, aFillMode, aFillColor );
333 aFormatter->
Print(
")" );
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
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
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
Simple container to manage line stroke parameters.
void Format(OUTPUTFORMATTER *out, const EDA_IU_SCALE &aIuScale) 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
@ FILLED_SHAPE
Fill with object color.
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)
void formatArc(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aArc, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
const char * getSheetPinShapeToken(LABEL_FLAG_SHAPE aShape)
void formatCircle(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aCircle, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
const char * getPinElectricalTypeToken(ELECTRICAL_PINTYPE aType)
const char * getTextTypeToken(KICAD_T aType)
void formatBezier(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aBezier, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid)
void formatRect(OUTPUTFORMATTER *aFormatter, 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, 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)
void formatFill(OUTPUTFORMATTER *aFormatter, FILL_T aFillMode, const COLOR4D &aFillColor)
Fill token formatting helper.
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.