26#include <unordered_map> 
   48    constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
 
   50    double dbase = 10 * 
schIUScale.MilsToIU( val );
 
   51    double dfrac = 
schIUScale.MilsToIU( frac ) / 10000.0;
 
   53    return KiROUND( std::clamp( ( dbase + dfrac ) / 10.0, -int_limit, int_limit ) ) * 10;
 
 
   89T ReadEnum( 
const std::map<wxString, wxString>& aProps, 
const wxString& aKey, 
int aLower,
 
   90            int aUpper, 
T aDefault )
 
   94    if( value < aLower || value > aUpper )
 
   97        return static_cast<T>( value );
 
 
  107    const size_t charCount = hexData.size();
 
  109    if( charCount != dataSize * 2 )
 
  111        THROW_IO_ERROR( wxString::Format( 
"Invalid binary file hex data size. Chars expected: %d, " 
  112                                          "hex string length: %d",
 
  113                                          int( dataSize * 2 ), 
int( hexData.size() ) ) );
 
  116    data.resize( dataSize );
 
  122    for( 
size_t inputId = 1; inputId < charCount; inputId += 2 )
 
  124        str[0] = (char) hexData[inputId - 1];
 
  125        str[1] = (char) hexData[inputId];
 
  127        std::from_chars( str, str + 2, b, 16 );
 
 
  139    uint32_t dataSize = aReader.
Read<uint32_t>();
 
 
  151    uint32_t dataSize = aReader.
Read<uint32_t>();
 
 
  184    if( displayModeStr.ToCLong( &v ) )
 
 
  227    hidden         = ( pinconglomerate & 0x04 ) != 0;
 
  231    locked         = ( pinconglomerate & 0x40 ) != 0;
 
  246    int kicadXfrac = xfrac;
 
  248    int kicadYfrac = yfrac;
 
  251    int offsetYfrac = pfrac;
 
  257        kicadXfrac += offsetYfrac;
 
  262        kicadYfrac += offsetYfrac;
 
  267        kicadXfrac -= offsetYfrac;
 
  272        kicadYfrac -= offsetYfrac;
 
  276        wxLogWarning( 
"Pin has unexpected orientation" );
 
 
  355    Text.Replace( 
"~1", 
"\n", 
true );
 
 
  391    for( 
int i = 1; i <= locationCount; i++ )
 
  393        const wxString si = std::to_string( i );
 
 
  408    for( 
int i = 1; i <= locationCount; i++ )
 
  410        const wxString si = std::to_string( i );
 
 
  429    for( 
int i = 1; i <= locationCount; i++ )
 
  431        const wxString si = std::to_string( i );
 
 
  522    for( 
int i = 1; i <= locationCount; i++ )
 
  524        const wxString si = std::to_string( i );
 
 
  734    for( 
int i = 1; i <= locationcount; i++ )
 
  736        const wxString si = std::to_string( i );
 
 
  752    for( 
int i = 1; i <= locationcount; i++ )
 
  754        const wxString si = std::to_string( i );
 
 
  797    const wxString sid = std::to_string( aId );
 
 
  847    for( 
int i = 1; i <= fontidcount; i++ )
 
  848        fonts.emplace_back( aProps, i );
 
 
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)
 
const int ALTIUM_COMPONENT_NONE
 
constexpr EDA_IU_SCALE schIUScale
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
void Skip(size_t aLength)
 
std::vector< char > ReadVector(size_t aSize)
 
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
 
static bool ReadBool(const std::map< wxString, wxString > &aProps, const wxString &aKey, bool aDefault)
 
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
 
static double ReadDouble(const std::map< wxString, wxString > &aProps, const wxString &aKey, double aDefault)
 
static PTYPE FromInt(int aInt)
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
ASCH_ADDITIONAL_FILE(ALTIUM_BINARY_PARSER &aReader)
 
ASCH_ARC(const std::map< wxString, wxString > &aProps)
 
ASCH_BEZIER(const std::map< wxString, wxString > &aProps)
 
std::vector< VECTOR2I > points
 
ASCH_BORDER_INTERFACE(const std::map< wxString, wxString > &aProps)
 
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_FILL_INTERFACE(const std::map< wxString, wxString > &aProps)
 
ASCH_HARNESS_CONNECTOR(const std::map< wxString, wxString > &aProps)
 
int m_primaryConnectionPosition
 
ASCH_SHEET_ENTRY_SIDE m_harnessConnectorSide
 
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_HYPERLINK(const std::map< wxString, wxString > &aProps)
 
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_POLYLINE_LINESTYLE LineStyle
 
ASCH_LINE(const std::map< wxString, wxString > &aProps)
 
ASCH_LABEL_JUSTIFICATION justification
 
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_OWNER_INTERFACE(const std::map< wxString, wxString > &aProps)
 
ASCH_PARAMETER(const std::map< wxString, wxString > &aProps)
 
ASCH_RECORD_ORIENTATION orientation
 
ASCH_LABEL_JUSTIFICATION justification
 
ASCH_PIECHART(const std::map< wxString, wxString > &aProps)
 
ASCH_PIN_SYMBOL::PTYPE symbolOuterEdge
 
ASCH_PIN_SYMBOL::PTYPE symbolOuter
 
ASCH_PIN_ELECTRICAL electrical
 
ASCH_PIN_SYMBOL::PTYPE symbolInner
 
ASCH_PIN_SYMBOL::PTYPE symbolInnerEdge
 
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_PORT(const std::map< wxString, wxString > &aProps)
 
ASCH_PORT_ALIGNMENT m_align
 
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
 
std::vector< VECTOR2I > points
 
ASCH_SIGNAL_HARNESS(const std::map< wxString, wxString > &aProps)
 
ASCH_STORAGE_FILE(const std::map< wxString, wxString > &aProps)
 
wxString componentdescription
 
ASCH_SYMBOL(const std::map< wxString, wxString > &aProps)
 
wxString sourcelibraryname
 
ASCH_TEMPLATE(const std::map< wxString, wxString > &aProps)
 
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
 
VECTOR2< int32_t > VECTOR2I