26#include <unordered_map>
46 constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
51 return KiROUND( Clamp<double>( -int_limit, ( dbase + dfrac ) / 10.0, int_limit ) ) * 10;
87T
ReadEnum(
const std::map<wxString, wxString>& aProps,
const wxString& aKey,
int aLower,
88 int aUpper, T aDefault )
92 if( value < aLower || value > aUpper )
95 return static_cast<T
>( value );
103 uint32_t dataSize = aReader.
Read<uint32_t>();
115 uint32_t dataSize = aReader.
Read<uint32_t>();
164 || symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
169 symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
172 electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps,
"ELECTRICAL", 0, 7,
193 int kicadXfrac = xfrac;
195 int kicadYfrac = yfrac;
220 wxLogWarning(
"Pin has unexpected orientation" );
244 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps,
"JUSTIFICATION", 0, 8,
247 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
268 Text.Replace(
"~1",
"\n",
true );
279 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps,
"ALIGNMENT", 1, 3,
303 for(
int i = 1; i <= locationCount; i++ )
305 const wxString si = std::to_string( i );
324 for(
int i = 1; i <= locationCount; i++ )
326 const wxString si = std::to_string( i );
338 LineStyle = linestyleVar >= 0 && linestyleVar <= 3 ?
354 for(
int i = 1; i <= locationCount; i++ )
356 const wxString si = std::to_string( i );
462 for(
int i = 1; i <= locationCount; i++ )
464 const wxString si = std::to_string( i );
610 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
616 style = ReadEnum<ASCH_POWER_PORT_STYLE>( aProps,
"STYLE", 0, 10,
644 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps,
"ALIGNMENT", 1, 3,
670 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
683 for(
int i = 1; i <= locationcount; i++ )
685 const wxString si = std::to_string( i );
702 for(
int i = 1; i <= locationcount; i++ )
704 const wxString si = std::to_string( i );
748 const wxString sid = std::to_string( aId );
797 for(
int i = 1; i <= fontidcount; i++ )
798 fonts.emplace_back( aProps, i );
815 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
834 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
854 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps,
"JUSTIFICATION", 0, 8,
857 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
906 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps,
"JUSTIFICATION", 0, 8,
909 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps,
"ORIENTATION", 0, 3,
int ReadOwnerPartId(const std::map< wxString, wxString > &aProperties)
int ReadOwnerIndex(const std::map< wxString, wxString > &aProperties)
T ReadEnum(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aLower, int aUpper, T aDefault)
constexpr int Altium2KiCadUnit(const int val, const int frac)
VECTOR2I ASchSheetGetSize(ASCH_SHEET_SIZE aSheetSize)
int ReadKiCadUnitFrac1(const std::map< wxString, wxString > &aProps, const wxString &aKey)
int ReadKiCadUnitFrac(const std::map< wxString, wxString > &aProps, const wxString &aKey)
ALTIUM_SCH_RECORD ReadRecord(const std::map< wxString, wxString > &aProps)
ASCH_PIN_SYMBOL_INNEREDGE
const int ALTIUM_COMPONENT_NONE
ASCH_PIN_SYMBOL_OUTEREDGE
constexpr EDA_IU_SCALE schIUScale
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
std::vector< char > ReadVector(size_t aSize)
static double ReadDouble(const std::map< wxString, wxString > &aProps, const wxString &aKey, double aDefault)
static bool ReadBool(const std::map< wxString, wxString > &aProps, const wxString &aKey, bool aDefault)
void Skip(size_t aLength)
#define THROW_IO_ERROR(msg)
ASCH_ADDITIONAL_FILE(ALTIUM_PARSER &aReader)
ASCH_ARC(const std::map< wxString, wxString > &aProps)
ASCH_BEZIER(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_BUS_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_BUS(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_LABEL_JUSTIFICATION justification
ASCH_DESIGNATOR(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_ELLIPSE(const std::map< wxString, wxString > &aProps)
ASCH_FILE_NAME(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_HARNESS_CONNECTOR(const std::map< wxString, wxString > &aProps)
int LocationPrimaryConnectionPosition
ASCH_HARNESS_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_ENTRY_SIDE Side
bool OwnerIndexAdditionalList
ASCH_HARNESS_TYPE(const std::map< wxString, wxString > &aProps)
bool OwnerIndexAdditionalList
ASCH_IMAGE(const std::map< wxString, wxString > &aProps)
ASCH_IMPLEMENTATION_LIST(const std::map< wxString, wxString > &aProps)
ASCH_IMPLEMENTATION(const std::map< wxString, wxString > &aProps)
ASCH_JUNCTION(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL(const std::map< wxString, wxString > &aProps)
ASCH_LABEL_JUSTIFICATION justification
ASCH_LINE(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_NET_LABEL(const std::map< wxString, wxString > &aProps)
ASCH_NOTE(const std::map< wxString, wxString > &aProperties)
ASCH_NO_ERC(const std::map< wxString, wxString > &aProps)
ASCH_PARAMETER(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_SYMBOL_OUTER symbolOuter
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_POLYGON(const std::map< wxString, wxString > &aProps)
ASCH_POLYLINE(const std::map< wxString, wxString > &aProps)
ASCH_POLYLINE_LINESTYLE LineStyle
std::vector< VECTOR2I > Points
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_PORT(const std::map< wxString, wxString > &aProps)
ASCH_POWER_PORT(const std::map< wxString, wxString > &aProps)
ASCH_POWER_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
ASCH_RECTANGLE(const std::map< wxString, wxString > &aProps)
ASCH_ROUND_RECTANGLE(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_ENTRY_SIDE side
ASCH_SHEET_FONT(const std::map< wxString, wxString > &aProps, int aId)
ASCH_SHEET_NAME(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_SYMBOL(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_SIZE sheetSize
ASCH_SHEET_WORKSPACEORIENTATION sheetOrientation
ASCH_SHEET(const std::map< wxString, wxString > &aProps)
std::vector< ASCH_SHEET_FONT > fonts
ASCH_SIGNAL_HARNESS(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > Points
ASCH_STORAGE_FILE(ALTIUM_PARSER &aReader)
wxString componentdescription
ASCH_SYMBOL(const std::map< wxString, wxString > &aProps)
wxString sourcelibraryname
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_TEXT_FRAME(const std::map< wxString, wxString > &aProps)
ASCH_WIRE(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
constexpr int MilsToIU(int mils) const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".