2020-08-23 19:01:08 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
2024-01-30 23:06:58 +00:00
|
|
|
* Copyright (C) 2022-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-08-23 19:01:08 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <unordered_map>
|
2024-02-04 17:14:19 +00:00
|
|
|
#include <charconv>
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2022-09-17 01:07:36 +00:00
|
|
|
#include <base_units.h>
|
2020-08-23 19:01:08 +00:00
|
|
|
#include <ki_exception.h>
|
|
|
|
|
2021-06-01 05:17:57 +00:00
|
|
|
#include <wx/log.h>
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
#include "sch_io/altium/altium_parser_sch.h"
|
2024-02-04 17:14:19 +00:00
|
|
|
#include "io/altium/altium_binary_parser.h"
|
|
|
|
#include "io/altium/altium_props_utils.h"
|
2020-08-23 19:01:08 +00:00
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
ALTIUM_SCH_RECORD ReadRecord( const std::map<wxString, wxString>& aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2024-02-04 17:14:19 +00:00
|
|
|
int recordId = ALTIUM_PROPS_UTILS::ReadInt( aProps, "RECORD", -1 );
|
2020-08-23 19:01:08 +00:00
|
|
|
return static_cast<ALTIUM_SCH_RECORD>( recordId );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constexpr int Altium2KiCadUnit( const int val, const int frac )
|
|
|
|
{
|
2022-07-07 17:53:06 +00:00
|
|
|
constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
|
|
|
|
|
2022-09-16 23:42:20 +00:00
|
|
|
double dbase = 10 * schIUScale.MilsToIU( val );
|
|
|
|
double dfrac = schIUScale.MilsToIU( frac ) / 10000.0;
|
2022-07-07 17:53:06 +00:00
|
|
|
|
|
|
|
return KiROUND( Clamp<double>( -int_limit, ( dbase + dfrac ) / 10.0, int_limit ) ) * 10;
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
int ReadKiCadUnitFrac( const std::map<wxString, wxString>& aProps, const wxString& aKey )
|
2020-10-10 14:22:53 +00:00
|
|
|
{
|
|
|
|
// a unit is stored using two fields, denoting the size in mils and a fraction size
|
2024-02-04 17:14:19 +00:00
|
|
|
int key = ALTIUM_PROPS_UTILS::ReadInt( aProps, aKey, 0 );
|
|
|
|
int keyFrac = ALTIUM_PROPS_UTILS::ReadInt( aProps, aKey + "_FRAC", 0 );
|
2020-10-10 14:22:53 +00:00
|
|
|
return Altium2KiCadUnit( key, keyFrac );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
int ReadKiCadUnitFrac1( const std::map<wxString, wxString>& aProps, const wxString& aKey )
|
2020-10-27 14:51:19 +00:00
|
|
|
{
|
|
|
|
// a unit is stored using two fields, denoting the size in mils and a fraction size
|
|
|
|
// Dunno why Altium invents different units for the same purpose
|
2024-02-04 17:14:19 +00:00
|
|
|
int key = ALTIUM_PROPS_UTILS::ReadInt( aProps, aKey, 0 );
|
|
|
|
int keyFrac = ALTIUM_PROPS_UTILS::ReadInt( aProps, aKey + "_FRAC1", 0 );
|
2020-10-27 14:51:19 +00:00
|
|
|
return Altium2KiCadUnit( key * 10, keyFrac );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
int ReadOwnerIndex( const std::map<wxString, wxString>& aProperties )
|
2021-07-06 18:44:06 +00:00
|
|
|
{
|
2024-02-04 17:14:19 +00:00
|
|
|
return ALTIUM_PROPS_UTILS::ReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
2021-07-06 18:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
int ReadOwnerPartId( const std::map<wxString, wxString>& aProperties )
|
2021-07-06 18:44:06 +00:00
|
|
|
{
|
2024-02-04 17:14:19 +00:00
|
|
|
return ALTIUM_PROPS_UTILS::ReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2021-07-06 18:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
template <typename T>
|
2021-07-23 20:46:04 +00:00
|
|
|
T ReadEnum( const std::map<wxString, wxString>& aProps, const wxString& aKey, int aLower,
|
|
|
|
int aUpper, T aDefault )
|
2020-10-17 11:52:47 +00:00
|
|
|
{
|
2024-02-04 17:14:19 +00:00
|
|
|
int value = ALTIUM_PROPS_UTILS::ReadInt( aProps, aKey, static_cast<int>( aDefault ) );
|
2021-07-05 22:57:58 +00:00
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
if( value < aLower || value > aUpper )
|
|
|
|
return aDefault;
|
|
|
|
else
|
|
|
|
return static_cast<T>( value );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
ASCH_STORAGE_FILE::ASCH_STORAGE_FILE( const std::map<wxString, wxString>& aProps )
|
|
|
|
{
|
|
|
|
filename = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
|
|
|
size_t dataSize = ALTIUM_PROPS_UTILS::ReadInt( aProps, "DATA_LEN", 0 );
|
|
|
|
|
|
|
|
wxString hexData = ALTIUM_PROPS_UTILS::ReadString( aProps, "DATA", "" );
|
|
|
|
const size_t charCount = hexData.size();
|
|
|
|
|
|
|
|
if( charCount != dataSize * 2 )
|
|
|
|
{
|
|
|
|
THROW_IO_ERROR( wxString::Format( "Invalid binary file hex data size. Chars expected: %d, "
|
|
|
|
"hex string length: %d",
|
|
|
|
int( dataSize * 2 ), int( hexData.size() ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
data.resize( dataSize );
|
|
|
|
|
|
|
|
char str[3] = { 0 };
|
|
|
|
uint8_t b = 0;
|
|
|
|
size_t outputId = 0;
|
|
|
|
|
|
|
|
for( size_t inputId = 1; inputId < charCount; inputId += 2 )
|
|
|
|
{
|
|
|
|
str[0] = (char) hexData[inputId - 1];
|
|
|
|
str[1] = (char) hexData[inputId];
|
|
|
|
|
|
|
|
std::from_chars( str, str + 2, b, 16 );
|
|
|
|
data[outputId] = b;
|
|
|
|
|
|
|
|
outputId++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_STORAGE_FILE::ASCH_STORAGE_FILE( ALTIUM_BINARY_PARSER& aReader )
|
2021-04-10 19:45:36 +00:00
|
|
|
{
|
|
|
|
aReader.Skip( 5 );
|
|
|
|
filename = aReader.ReadWxString();
|
|
|
|
uint32_t dataSize = aReader.Read<uint32_t>();
|
|
|
|
data = aReader.ReadVector( dataSize );
|
|
|
|
|
|
|
|
if( aReader.HasParsingError() )
|
|
|
|
THROW_IO_ERROR( "Storage stream was not parsed correctly" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
ASCH_ADDITIONAL_FILE::ASCH_ADDITIONAL_FILE( ALTIUM_BINARY_PARSER& aReader )
|
2022-08-09 11:39:13 +00:00
|
|
|
{
|
|
|
|
aReader.Skip( 5 );
|
2022-08-10 08:00:41 +00:00
|
|
|
FileName = aReader.ReadWxString();
|
2022-08-09 11:39:13 +00:00
|
|
|
uint32_t dataSize = aReader.Read<uint32_t>();
|
2022-08-10 08:00:41 +00:00
|
|
|
Data = aReader.ReadVector( dataSize );
|
2022-08-09 11:39:13 +00:00
|
|
|
|
|
|
|
if( aReader.HasParsingError() )
|
|
|
|
THROW_IO_ERROR( "Additional stream was not parsed correctly" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
ASCH_SYMBOL::ASCH_SYMBOL( const std::map<wxString, wxString>& aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::COMPONENT );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
currentpartid = ALTIUM_PROPS_UTILS::ReadInt( aProps, "CURRENTPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
libreference = ALTIUM_PROPS_UTILS::ReadString( aProps, "LIBREFERENCE", "" );
|
|
|
|
sourcelibraryname = ALTIUM_PROPS_UTILS::ReadString( aProps, "SOURCELIBRARYNAME", "" );
|
|
|
|
componentdescription = ALTIUM_PROPS_UTILS::ReadString( aProps, "COMPONENTDESCRIPTION", "" );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
orientation = ALTIUM_PROPS_UTILS::ReadInt( aProps, "ORIENTATION", 0 );
|
|
|
|
isMirrored = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISMIRRORED", false );
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-23 14:22:56 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
partcount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "PARTCOUNT", 0 );
|
|
|
|
displaymodecount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "DISPLAYMODECOUNT", 0 );
|
|
|
|
m_indexInSheet = ALTIUM_PROPS_UTILS::ReadInt( aProps, "INDEXINSHEET", -1 );
|
2024-02-05 19:10:26 +00:00
|
|
|
|
|
|
|
// DISPLAYMODE may be a string. Leave displaymode at 0 in this case.
|
|
|
|
displaymode = 0;
|
2024-02-04 17:14:19 +00:00
|
|
|
wxString displayModeStr = ALTIUM_PROPS_UTILS::ReadString( aProps, "DISPLAYMODE", "" );
|
2024-02-05 19:10:26 +00:00
|
|
|
|
|
|
|
long v = 0;
|
|
|
|
|
|
|
|
if( displayModeStr.ToCLong( &v ) )
|
|
|
|
displaymode = int( v );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-30 23:06:58 +00:00
|
|
|
ASCH_TEMPLATE::ASCH_TEMPLATE( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::TEMPLATE );
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
filename = ALTIUM_PROPS_UTILS::ReadString( aProps, "FILENAME", "" );
|
2024-01-30 23:06:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PIN );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
ownerpartdisplaymode = ALTIUM_PROPS_UTILS::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
|
|
|
designator = ALTIUM_PROPS_UTILS::ReadString( aProps, "DESIGNATOR", "" );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int symbolOuterInt = ALTIUM_PROPS_UTILS::ReadInt( aProps, "SYMBOL_OUTER", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
symbolOuter = ASCH_PIN_SYMBOL::FromInt( symbolOuterInt );
|
2020-10-09 15:13:18 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int symbolInnerInt = ALTIUM_PROPS_UTILS::ReadInt( aProps, "SYMBOL_INNER", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
symbolInner = ASCH_PIN_SYMBOL::FromInt( symbolInnerInt );
|
2020-10-09 15:13:18 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int symbolOuterEdgeInt = ALTIUM_PROPS_UTILS::ReadInt( aProps, "SYMBOL_OUTEREDGE", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
symbolOuterEdge = ASCH_PIN_SYMBOL::FromInt( symbolOuterEdgeInt );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int symbolInnerEdgeInt = ALTIUM_PROPS_UTILS::ReadInt( aProps, "SYMBOL_INNEREDGE", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
symbolInnerEdge = ASCH_PIN_SYMBOL::FromInt( symbolInnerEdgeInt );
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps, "ELECTRICAL", 0, 7,
|
|
|
|
ASCH_PIN_ELECTRICAL::INPUT );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int pinconglomerate = ALTIUM_PROPS_UTILS::ReadInt( aProps, "PINCONGLOMERATE", 0 );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2020-10-14 19:38:12 +00:00
|
|
|
orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
|
2023-08-28 21:50:56 +00:00
|
|
|
hidden = ( pinconglomerate & 0x04 ) != 0;
|
2020-10-09 14:23:07 +00:00
|
|
|
showPinName = ( pinconglomerate & 0x08 ) != 0;
|
|
|
|
showDesignator = ( pinconglomerate & 0x10 ) != 0;
|
2023-09-04 21:46:25 +00:00
|
|
|
// 0x20 is unknown
|
|
|
|
locked = ( pinconglomerate & 0x40 ) != 0;
|
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int x = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATION.X", 0 );
|
|
|
|
int xfrac = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATION.X_FRAC", 0 );
|
|
|
|
int y = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATION.Y", 0 );
|
|
|
|
int yfrac = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATION.Y_FRAC", 0 );
|
2024-05-04 10:16:29 +00:00
|
|
|
location = VECTOR2I( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int p = ALTIUM_PROPS_UTILS::ReadInt( aProps, "PINLENGTH", 0 );
|
|
|
|
int pfrac = ALTIUM_PROPS_UTILS::ReadInt( aProps, "PINLENGTH_FRAC", 0 );
|
2020-10-09 14:23:07 +00:00
|
|
|
pinlength = Altium2KiCadUnit( p, pfrac );
|
2020-10-10 14:43:33 +00:00
|
|
|
|
|
|
|
// this code calculates the location as required by KiCad without rounding error attached
|
|
|
|
int kicadX = x;
|
|
|
|
int kicadXfrac = xfrac;
|
|
|
|
int kicadY = y;
|
|
|
|
int kicadYfrac = yfrac;
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
int offsetY = p;
|
|
|
|
int offsetYfrac = pfrac;
|
|
|
|
|
2020-10-10 14:43:33 +00:00
|
|
|
switch( orientation )
|
|
|
|
{
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
|
2023-08-28 21:50:56 +00:00
|
|
|
kicadX += offsetY;
|
|
|
|
kicadXfrac += offsetYfrac;
|
2020-10-10 14:43:33 +00:00
|
|
|
break;
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::UPWARDS:
|
2023-08-28 21:50:56 +00:00
|
|
|
kicadY += offsetY;
|
|
|
|
kicadYfrac += offsetYfrac;
|
2020-10-10 14:43:33 +00:00
|
|
|
break;
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::LEFTWARDS:
|
2023-08-28 21:50:56 +00:00
|
|
|
kicadX -= offsetY;
|
|
|
|
kicadXfrac -= offsetYfrac;
|
2020-10-10 14:43:33 +00:00
|
|
|
break;
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::DOWNWARDS:
|
2023-08-28 21:50:56 +00:00
|
|
|
kicadY -= offsetY;
|
|
|
|
kicadYfrac -= offsetYfrac;
|
2020-10-10 14:43:33 +00:00
|
|
|
break;
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2020-10-10 14:43:33 +00:00
|
|
|
default:
|
|
|
|
wxLogWarning( "Pin has unexpected orientation" );
|
|
|
|
break;
|
|
|
|
}
|
2021-07-23 20:46:04 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
kicadLocation = VECTOR2I( Altium2KiCadUnit( kicadX, kicadXfrac ),
|
2024-05-04 10:16:29 +00:00
|
|
|
-Altium2KiCadUnit( kicadY, kicadYfrac ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE::ASCH_OWNER_INTERFACE( const std::map<wxString, wxString>& aProps )
|
|
|
|
{
|
|
|
|
ownerindex = ReadOwnerIndex( aProps );
|
|
|
|
ownerpartid = ReadOwnerPartId( aProps );
|
2024-02-04 17:14:19 +00:00
|
|
|
ownerpartdisplaymode = ALTIUM_PROPS_UTILS::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
|
|
|
|
indexinsheet = ALTIUM_PROPS_UTILS::ReadInt( aProps, "INDEXINSHEET", 0 );
|
|
|
|
IsNotAccesible = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISNOTACCESIBLE", false );
|
2023-09-04 21:46:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_FILL_INTERFACE::ASCH_FILL_INTERFACE( const std::map<wxString, wxString>& aProps )
|
|
|
|
{
|
2024-02-04 17:14:19 +00:00
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
|
|
|
IsSolid = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISSOLID", false );
|
|
|
|
IsTransparent = ALTIUM_PROPS_UTILS::ReadBool( aProps, "TRANSPARENT", false );
|
2023-08-28 21:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_BORDER_INTERFACE::ASCH_BORDER_INTERFACE( const std::map<wxString, wxString>& aProps )
|
|
|
|
{
|
|
|
|
LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
|
|
|
|
|
|
|
|
// Altium line width 0 means hairline. Since KiCad doesn't have a hairline, we
|
|
|
|
// represent it as a 1 mil line.
|
|
|
|
if( LineWidth == 0 )
|
2023-09-05 21:01:27 +00:00
|
|
|
LineWidth = schIUScale.MilsToIU( 1 );
|
2023-08-28 21:50:56 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-17 11:52:47 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LABEL );
|
2020-10-17 11:52:47 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-17 11:52:47 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
2023-09-18 16:15:02 +00:00
|
|
|
textColor = 0;
|
2024-02-04 17:14:19 +00:00
|
|
|
fontId = ALTIUM_PROPS_UTILS::ReadInt( aProps, "FONTID", 0 );
|
|
|
|
isMirrored = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISMIRRORED", false );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
|
|
|
|
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
2021-07-24 20:28:24 +00:00
|
|
|
|
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-10-17 11:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_TEXT_FRAME::ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2021-07-05 22:57:58 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NOTE
|
|
|
|
|| ReadRecord( aProps ) == ALTIUM_SCH_RECORD::TEXT_FRAME );
|
2021-07-05 22:57:58 +00:00
|
|
|
|
2022-08-16 14:45:11 +00:00
|
|
|
BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-10-31 14:03:35 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2022-08-16 14:45:11 +00:00
|
|
|
TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2021-07-05 22:57:58 +00:00
|
|
|
|
2022-08-16 14:45:11 +00:00
|
|
|
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2023-09-06 22:40:15 +00:00
|
|
|
Size = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ) - Location.x,
|
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) - Location.y );
|
2022-08-16 14:45:11 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2022-08-16 14:45:11 +00:00
|
|
|
Text.Replace( "~1", "\n", true );
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
FontID = ALTIUM_PROPS_UTILS::ReadInt( aProps, "FONTID", 0 );
|
|
|
|
IsWordWrapped = ALTIUM_PROPS_UTILS::ReadBool( aProps, "WORDWRAP", false );
|
|
|
|
ShowBorder = ALTIUM_PROPS_UTILS::ReadBool( aProps, "SHOWBORDER", false );
|
2022-08-16 14:45:11 +00:00
|
|
|
TextMargin = ReadKiCadUnitFrac( aProps, "TEXTMARGIN" );
|
2023-08-28 21:50:56 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
|
|
|
BorderColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
TextColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTCOLOR", 0 );
|
2023-08-28 21:50:56 +00:00
|
|
|
|
|
|
|
BorderWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
|
2024-02-04 17:14:19 +00:00
|
|
|
isSolid = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISSOLID", false );
|
2021-07-05 22:57:58 +00:00
|
|
|
|
2022-10-31 14:03:35 +00:00
|
|
|
Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
|
|
|
|
ASCH_TEXT_FRAME_ALIGNMENT::LEFT );
|
2021-07-06 19:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_NOTE::ASCH_NOTE( const std::map<wxString, wxString>& aProperties ) :
|
|
|
|
ASCH_TEXT_FRAME( aProperties )
|
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NOTE );
|
2021-07-06 19:26:22 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
author = ALTIUM_PROPS_UTILS::ReadString( aProperties, "AUTHOR", "" );
|
2021-07-05 22:57:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_BEZIER::ASCH_BEZIER( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-10-10 14:56:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BEZIER );
|
2020-10-10 14:56:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationCount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-10 14:56:19 +00:00
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
2021-07-23 20:46:04 +00:00
|
|
|
points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
2020-10-10 14:56:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-10-10 14:56:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYLINE );
|
2020-10-10 14:56:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationCount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-10 14:56:19 +00:00
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
2022-09-03 22:02:17 +00:00
|
|
|
Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
2021-07-23 20:46:04 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
2020-10-10 14:56:19 +00:00
|
|
|
}
|
|
|
|
|
2023-09-11 14:52:13 +00:00
|
|
|
auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID );
|
|
|
|
LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present.
|
2020-10-10 14:56:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_FILL_INTERFACE( aProps ),
|
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-10-10 14:22:53 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYGON );
|
2020-10-10 14:22:53 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationCount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
2021-07-23 20:46:04 +00:00
|
|
|
points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
2020-10-10 14:22:53 +00:00
|
|
|
}
|
2020-10-14 19:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_FILL_INTERFACE( aProps ),
|
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-10-14 19:15:09 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
|
2020-10-14 19:15:09 +00:00
|
|
|
|
2022-09-03 22:38:41 +00:00
|
|
|
BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-01-04 01:00:40 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2022-09-03 22:38:41 +00:00
|
|
|
TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
2024-05-04 13:18:56 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2020-10-14 19:15:09 +00:00
|
|
|
|
2023-09-06 22:40:15 +00:00
|
|
|
CornerRadius = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ),
|
2024-05-04 13:18:56 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) );
|
2020-10-10 14:22:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2024-05-05 15:39:02 +00:00
|
|
|
ASCH_BORDER_INTERFACE( aProps ),
|
|
|
|
ASCH_FILL_INTERFACE( aProps )
|
2020-10-10 16:41:19 +00:00
|
|
|
{
|
2022-11-24 18:42:41 +00:00
|
|
|
m_IsElliptical = ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ELLIPTICAL_ARC;
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ARC || m_IsElliptical );
|
2020-10-10 16:41:19 +00:00
|
|
|
|
2022-11-24 18:42:41 +00:00
|
|
|
m_Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2024-05-04 13:18:56 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2022-11-24 18:42:41 +00:00
|
|
|
m_Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
|
|
|
|
m_SecondaryRadius = m_Radius;
|
2020-10-10 16:41:19 +00:00
|
|
|
|
2022-11-24 18:42:41 +00:00
|
|
|
if( m_IsElliptical )
|
|
|
|
m_SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
|
2020-10-10 16:41:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
m_StartAngle = ALTIUM_PROPS_UTILS::ReadDouble( aProps, "STARTANGLE", 0 );
|
|
|
|
m_EndAngle = ALTIUM_PROPS_UTILS::ReadDouble( aProps, "ENDANGLE", 0 );
|
2020-10-10 16:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-05 15:39:02 +00:00
|
|
|
ASCH_PIECHART::ASCH_PIECHART( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_ARC( aProps )
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_ELLIPSE::ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_FILL_INTERFACE( aProps ),
|
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2022-09-04 00:58:03 +00:00
|
|
|
{
|
2024-06-08 18:23:33 +00:00
|
|
|
ALTIUM_SCH_RECORD record = ReadRecord( aProps );
|
|
|
|
|
|
|
|
wxASSERT( record == ALTIUM_SCH_RECORD::ELLIPSE || record == ALTIUM_SCH_RECORD::ELLIPTICAL_ARC );
|
2022-09-04 00:58:03 +00:00
|
|
|
|
|
|
|
Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
|
|
|
|
SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-10-10 16:41:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LINE );
|
2020-10-10 16:41:19 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
point1 = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
|
|
|
point2 = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2023-09-11 14:52:13 +00:00
|
|
|
|
|
|
|
auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID );
|
|
|
|
LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present.
|
2020-10-10 16:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2022-08-09 11:39:13 +00:00
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SIGNAL_HARNESS );
|
|
|
|
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationCount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2022-08-09 11:39:13 +00:00
|
|
|
|
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
2022-08-10 08:00:41 +00:00
|
|
|
Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
2022-08-09 11:39:13 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
|
|
|
}
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
2022-08-10 08:00:41 +00:00
|
|
|
LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
|
2022-08-09 11:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2022-08-09 12:00:45 +00:00
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR );
|
|
|
|
|
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-08-09 12:00:45 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2023-02-19 03:40:07 +00:00
|
|
|
Size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
|
2022-08-09 12:00:45 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
2022-08-16 16:54:20 +00:00
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
indexinsheet = 0;
|
2022-08-16 16:54:20 +00:00
|
|
|
LineWidth = 0;;
|
|
|
|
LocationPrimaryConnectionPosition = 0;
|
2022-08-09 12:00:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2022-08-09 12:15:42 +00:00
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_ENTRY );
|
|
|
|
|
2023-12-24 00:31:24 +00:00
|
|
|
// use SCH_IO_ALTIUM::m_harnessEntryParent instead, because this property sometimes
|
2022-10-31 14:03:35 +00:00
|
|
|
// does not exist in altium file!
|
|
|
|
// ownerindex = ReadOwnerIndex( aProps );
|
|
|
|
|
2022-08-09 12:15:42 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
|
2022-08-09 12:15:42 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
|
2022-08-09 12:15:42 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
2022-08-09 12:15:42 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
OwnerIndexAdditionalList = ALTIUM_PROPS_UTILS::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
|
2022-08-09 12:15:42 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
|
|
|
TextColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTCOLOR", 0 );
|
|
|
|
TextFontID = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTFONTID", 0 );
|
2022-08-16 16:54:20 +00:00
|
|
|
TextStyle = 0;
|
2022-08-09 12:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2022-08-09 12:32:41 +00:00
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE );
|
|
|
|
|
2023-12-24 00:31:24 +00:00
|
|
|
//ownerindex = ReadOwnerIndex( aProps ); // use SCH_IO_ALTIUM::m_harnessEntryParent instead!
|
2022-08-09 12:32:41 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2022-08-09 12:32:41 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-08-09 12:32:41 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
IsHidden = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISHIDDEN", false );
|
|
|
|
OwnerIndexAdditionalList = ALTIUM_PROPS_UTILS::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
|
2022-08-09 12:32:41 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
FontID = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTFONTID", 0 );
|
2022-08-09 12:32:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_FILL_INTERFACE( aProps ),
|
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2022-09-03 22:38:41 +00:00
|
|
|
BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-01-04 01:00:40 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2022-09-03 22:38:41 +00:00
|
|
|
TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
2022-10-31 14:03:35 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-27 14:51:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2023-02-19 03:40:07 +00:00
|
|
|
size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ),
|
2024-05-04 13:18:56 +00:00
|
|
|
ReadKiCadUnitFrac( aProps, "YSIZE" ) );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
isSolid = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISSOLID", false );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
areacolor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
2020-10-27 14:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SHEET_ENTRY::ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-27 14:51:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_ENTRY );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
|
|
|
// some magic, because it stores those infos in a different unit??
|
2021-07-23 20:46:04 +00:00
|
|
|
distanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
iotype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
|
|
|
|
style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
|
2020-10-27 14:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-24 16:40:16 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POWER_PORT );
|
2020-10-24 16:40:16 +00:00
|
|
|
|
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-10-24 16:40:16 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
|
|
|
showNetName = ALTIUM_PROPS_UTILS::ReadBool( aProps, "SHOWNETNAME", true );
|
2020-10-24 16:40:16 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
style = ReadEnum<ASCH_POWER_PORT_STYLE>( aProps, "STYLE", 0, 10,
|
|
|
|
ASCH_POWER_PORT_STYLE::CIRCLE );
|
2020-10-24 16:40:16 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-26 15:54:49 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PORT );
|
2020-10-26 15:54:49 +00:00
|
|
|
|
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
2022-01-04 01:00:40 +00:00
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-26 15:54:49 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
|
|
|
HarnessType = ALTIUM_PROPS_UTILS::ReadString( aProps, "HARNESSTYPE", "" );
|
2020-10-26 15:54:49 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Width = ReadKiCadUnitFrac( aProps, "WIDTH" );
|
|
|
|
Height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
|
2020-10-26 15:54:49 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
IOtype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
|
|
|
|
Style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
|
2022-08-09 19:21:36 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR", 0 );
|
|
|
|
Color = ALTIUM_PROPS_UTILS::ReadInt( aProps, "COLOR", 0 );
|
|
|
|
FontID = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTFONTID", 0 );
|
|
|
|
TextColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "TEXTCOLOR", 0 );
|
2022-08-09 19:21:36 +00:00
|
|
|
|
2022-10-31 14:03:35 +00:00
|
|
|
Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
|
|
|
|
ASCH_TEXT_FRAME_ALIGNMENT::LEFT );
|
2020-10-26 15:54:49 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 16:40:16 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
ASCH_NO_ERC::ASCH_NO_ERC( const std::map<wxString, wxString>& aProps )
|
2020-10-14 19:23:36 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NO_ERC );
|
2020-10-14 19:23:36 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-14 19:23:36 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
isActive = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISACTIVE", true );
|
|
|
|
suppressAll = ALTIUM_PROPS_UTILS::ReadInt( aProps, "SUPPRESSALL", true );
|
2020-10-14 19:23:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NET_LABEL );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-14 19:38:12 +00:00
|
|
|
|
2023-07-04 07:27:43 +00:00
|
|
|
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
|
|
|
|
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationcount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
for( int i = 1; i <= locationcount; i++ )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2020-10-10 14:22:53 +00:00
|
|
|
const wxString si = std::to_string( i );
|
2021-07-23 20:46:04 +00:00
|
|
|
points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
2020-10-10 14:22:53 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::WIRE );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int locationcount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "LOCATIONCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
for( int i = 1; i <= locationcount; i++ )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2020-10-10 14:22:53 +00:00
|
|
|
const wxString si = std::to_string( i );
|
2021-07-23 20:46:04 +00:00
|
|
|
points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "Y" + si ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
2020-10-10 14:22:53 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-09 15:21:27 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::JUNCTION );
|
2020-10-09 15:21:27 +00:00
|
|
|
|
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-09 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 19:45:36 +00:00
|
|
|
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProps ) :
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_OWNER_INTERFACE( aProps ),
|
2023-08-28 21:50:56 +00:00
|
|
|
ASCH_BORDER_INTERFACE( aProps )
|
2021-04-10 19:45:36 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMAGE );
|
2021-04-10 19:45:36 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
filename = ALTIUM_PROPS_UTILS::ReadString( aProps, "FILENAME", "" );
|
2021-04-10 19:45:36 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
|
|
|
corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2021-04-10 19:45:36 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
embedimage = ALTIUM_PROPS_UTILS::ReadBool( aProps, "EMBEDIMAGE", false );
|
|
|
|
keepaspect = ALTIUM_PROPS_UTILS::ReadBool( aProps, "KEEPASPECT", false );
|
2021-04-10 19:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-17 12:33:30 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
|
|
|
const wxString sid = std::to_string( aId );
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
FontName = ALTIUM_PROPS_UTILS::ReadString( aProps, "FONTNAME" + sid, "" );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
2022-08-10 08:00:41 +00:00
|
|
|
Size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
|
2024-02-04 17:14:19 +00:00
|
|
|
Rotation = ALTIUM_PROPS_UTILS::ReadInt( aProps, "ROTATION" + sid, 0 );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
Italic = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ITALIC" + sid, false );
|
|
|
|
Bold = ALTIUM_PROPS_UTILS::ReadBool( aProps, "BOLD" + sid, false );
|
|
|
|
Underline = ALTIUM_PROPS_UTILS::ReadBool( aProps, "UNDERLINE" + sid, false );
|
2022-08-16 16:54:20 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
AreaColor = ALTIUM_PROPS_UTILS::ReadInt( aProps, "AREACOLOR" + sid, 0 );
|
2020-10-17 12:33:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
|
2020-10-17 13:35:22 +00:00
|
|
|
{
|
|
|
|
// From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
|
|
|
|
switch( aSheetSize )
|
|
|
|
{
|
|
|
|
default:
|
2021-07-06 18:44:06 +00:00
|
|
|
case ASCH_SHEET_SIZE::A4: return { 1150, 760 };
|
|
|
|
case ASCH_SHEET_SIZE::A3: return { 1550, 1110 };
|
|
|
|
case ASCH_SHEET_SIZE::A2: return { 2230, 1570 };
|
|
|
|
case ASCH_SHEET_SIZE::A1: return { 3150, 2230 };
|
|
|
|
case ASCH_SHEET_SIZE::A0: return { 4460, 3150 };
|
|
|
|
case ASCH_SHEET_SIZE::A: return { 950, 750 };
|
|
|
|
case ASCH_SHEET_SIZE::B: return { 1500, 950 };
|
|
|
|
case ASCH_SHEET_SIZE::C: return { 2000, 1500 };
|
|
|
|
case ASCH_SHEET_SIZE::D: return { 3200, 2000 };
|
|
|
|
case ASCH_SHEET_SIZE::E: return { 4200, 3200 };
|
|
|
|
case ASCH_SHEET_SIZE::LETTER: return { 1100, 850 };
|
|
|
|
case ASCH_SHEET_SIZE::LEGAL: return { 1400, 850 };
|
|
|
|
case ASCH_SHEET_SIZE::TABLOID: return { 1700, 1100 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_A: return { 990, 790 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_B: return { 1540, 990 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_C: return { 2060, 1560 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_D: return { 3260, 2060 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_E: return { 4280, 3280 };
|
2020-10-17 13:35:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SHEET::ASCH_SHEET( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-17 12:33:30 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
|
2020-10-17 12:33:30 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
int fontidcount = ALTIUM_PROPS_UTILS::ReadInt( aProps, "FONTIDCOUNT", 0 );
|
2021-07-06 18:44:06 +00:00
|
|
|
|
2020-10-17 12:33:30 +00:00
|
|
|
for( int i = 1; i <= fontidcount; i++ )
|
2021-07-23 20:46:04 +00:00
|
|
|
fonts.emplace_back( aProps, i );
|
2020-10-17 13:35:22 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
useCustomSheet = ALTIUM_PROPS_UTILS::ReadBool( aProps, "USECUSTOMSHEET", false );
|
2023-09-11 07:02:59 +00:00
|
|
|
|
|
|
|
customSize = VECTOR2I( ReadKiCadUnitFrac( aProps, "CUSTOMX" ),
|
|
|
|
ReadKiCadUnitFrac( aProps, "CUSTOMY" ) );
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
sheetSize = ReadEnum<ASCH_SHEET_SIZE>( aProps, "SHEETSTYLE", 0, 17, ASCH_SHEET_SIZE::A4 );
|
|
|
|
sheetOrientation = ReadEnum<ASCH_SHEET_WORKSPACEORIENTATION>(
|
|
|
|
aProps, "WORKSPACEORIENTATION", 0, 1, ASCH_SHEET_WORKSPACEORIENTATION::LANDSCAPE );
|
2020-10-17 12:33:30 +00:00
|
|
|
}
|
2020-10-09 15:21:27 +00:00
|
|
|
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_SHEET_NAME::ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-27 14:51:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_NAME );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
isHidden = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISHIDDEN", false );
|
2020-10-27 14:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-27 14:51:19 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::FILE_NAME );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-27 14:51:19 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
isHidden = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISHIDDEN", false );
|
2020-10-27 14:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::DESIGNATOR );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
|
|
|
fontId = ALTIUM_PROPS_UTILS::ReadInt( aProps, "FONTID", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2021-07-24 20:28:24 +00:00
|
|
|
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
|
|
|
|
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-17 14:03:46 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2021-07-06 13:39:56 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION );
|
2021-07-06 13:39:56 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
ownerindex = ALTIUM_PROPS_UTILS::ReadInt( aProps, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
name = ALTIUM_PROPS_UTILS::ReadString( aProps, "MODELNAME", "" );
|
|
|
|
type = ALTIUM_PROPS_UTILS::ReadString( aProps, "MODELTYPE", "" );
|
|
|
|
libname = ALTIUM_PROPS_UTILS::ReadString( aProps, "MODELDATAFILE0", "" );
|
|
|
|
description = ALTIUM_PROPS_UTILS::ReadString( aProps, "DESCRIPTION", "" );
|
|
|
|
isCurrent = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISCURRENT", false );
|
2021-07-06 13:39:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_IMPLEMENTATION_LIST::ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2021-07-06 13:39:56 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST );
|
2021-07-06 13:39:56 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 14:03:35 +00:00
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-17 14:03:46 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS_ENTRY );
|
2020-10-17 14:03:46 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
|
|
|
corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
|
2020-10-26 17:26:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-04 21:46:25 +00:00
|
|
|
ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_OWNER_INTERFACE( aProps )
|
2020-10-26 17:26:49 +00:00
|
|
|
{
|
2021-07-23 20:46:04 +00:00
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PARAMETER );
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2022-01-04 01:00:40 +00:00
|
|
|
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
|
|
|
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2021-07-24 20:28:24 +00:00
|
|
|
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
|
|
|
|
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
|
|
|
|
2021-07-23 20:46:04 +00:00
|
|
|
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
|
|
|
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
name = ALTIUM_PROPS_UTILS::ReadString( aProps, "NAME", "" );
|
|
|
|
text = ALTIUM_PROPS_UTILS::ReadString( aProps, "TEXT", "" );
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
isHidden = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISHIDDEN", false );
|
|
|
|
isMirrored = ALTIUM_PROPS_UTILS::ReadBool( aProps, "ISMIRRORED", false );
|
|
|
|
isShowName = ALTIUM_PROPS_UTILS::ReadBool( aProps, "SHOWNAME", false );
|
2023-09-06 17:10:54 +00:00
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
fontId = ALTIUM_PROPS_UTILS::ReadInt( aProps, "FONTID", 0 );
|
2021-06-10 14:10:55 +00:00
|
|
|
}
|
2023-08-28 21:50:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
ASCH_HYPERLINK::ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps ) :
|
|
|
|
ASCH_LABEL( aProps )
|
|
|
|
{
|
|
|
|
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HYPERLINK );
|
|
|
|
|
2024-02-04 17:14:19 +00:00
|
|
|
url = ALTIUM_PROPS_UTILS::ReadString( aProps, "URL", "" );
|
2023-08-28 21:50:56 +00:00
|
|
|
}
|