37 wxString key = !libName.empty() ? ( libName +
":" + libReference ) : libReference;
40 libId.
Parse( key,
true );
49 bool inOverbar =
false;
51 for( wxString::const_iterator chIt = aString.begin(); chIt != aString.end(); ++chIt )
53 wxString::const_iterator lookahead = chIt + 1;
55 if( lookahead != aString.end() && *lookahead ==
'\\' )
87 const std::map<wxString, wxString>& aOverrides )
89 if( aString.IsEmpty() || aString.at( 0 ) !=
'=' )
98 size_t escaping_start = 0;
101 delimiter = aString.find(
"+", start );
102 escaping_start = aString.find(
"'", start );
104 if( escaping_start < delimiter )
106 size_t text_start = escaping_start + 1;
107 size_t escaping_end = aString.find(
"'", text_start );
109 if( escaping_end == wxString::npos )
111 escaping_end = aString.size();
114 result += aString.substr( text_start, escaping_end - text_start );
116 start = escaping_end + 1;
120 wxString specialString = aString.substr( start, delimiter - start ).Trim().Trim(
false );
122 if( specialString.StartsWith(
"\"" ) && specialString.EndsWith(
"\"" ) )
123 specialString = specialString.Mid( 1, specialString.Length() - 2 );
125 if( !specialString.IsEmpty() )
129 specialString.UpperCase();
131 auto overrideIt = aOverrides.find( specialString );
133 if( overrideIt != aOverrides.end() )
134 specialString = overrideIt->second;
136 result += wxString::Format( wxT(
"${%s}" ), specialString );
139 start = delimiter + 1;
141 }
while( delimiter != wxString::npos );
148 const std::map<wxString, wxString>& aOverrides )
150 if( aString.IsEmpty() )
156 if( aString.at( 0 ) ==
'.' )
158 wxString specialString = aString.substr( 1 );
160 specialString.UpperCase();
162 auto overrideIt = aOverrides.find( specialString );
164 if( overrideIt != aOverrides.end() )
165 specialString = overrideIt->second;
167 return wxString::Format( wxT(
"${%s}" ), specialString );
179 bool hasPrev =
false;
183 for( wxString::const_iterator it = aString.begin(); it != aString.end(); ++it )
187 if( (*it).GetAsChar( &ch ) )
203 if( !tempString.empty() )
205 output +=
"~{" + tempString +
"}";
217 if( !tempString.IsEmpty() )
219 output +=
"~{" + tempString +
"}";
232 if( aMajor == 0 || aMinor == 0 )
235 double numerator = aMajor * aMinor;
236 double majorTerm = aMajor * sin( aAngleRadians );
237 double minorTerm = aMinor * cos( aAngleRadians );
238 double denominator = sqrt( majorTerm * majorTerm + minorTerm * minorTerm );
240 double radius = numerator / denominator;
wxString AltiumSchSpecialStringsToKiCadVariables(const wxString &aString, const std::map< wxString, wxString > &aOverrides)
wxString AltiumPropertyToKiCadString(const wxString &aString)
wxString AltiumPinNamesToKiCad(wxString &aString)
VECTOR2I AltiumGetEllipticalPos(double aMajor, double aMinor, double aAngleRadians)
LIB_ID AltiumToKiCadLibID(const wxString &aLibName, const wxString &aLibReference)
wxString AltiumPcbSpecialStringsToKiCadStrings(const wxString &aString, const std::map< wxString, wxString > &aOverrides)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
VECTOR2< int32_t > VECTOR2I