From b4b8e31177315bb550f59a75b04125be8fd33042 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Fri, 9 Oct 2020 17:21:27 +0200 Subject: [PATCH] altium: add support for junction --- eeschema/sch_plugins/altium/altium_parser_sch.cpp | 14 ++++++++++++++ eeschema/sch_plugins/altium/altium_parser_sch.h | 10 ++++++++++ eeschema/sch_plugins/altium/sch_altium_plugin.cpp | 12 ++++++++++++ eeschema/sch_plugins/altium/sch_altium_plugin.h | 1 + 4 files changed, 37 insertions(+) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index 4c07e65eae..1fb8316ace 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -205,6 +205,20 @@ ASCH_WIRE::ASCH_WIRE( const std::map& aProperties ) } +ASCH_JUNCTION::ASCH_JUNCTION( const std::map& aProperties ) +{ + wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::JUNCTION ); + + ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", -1 ); + + int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 ); + int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 ); + int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 ); + int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 ); + location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) ); +} + + ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map& aProperties ) { wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::DESIGNATOR ); diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index ccf66cf9f7..3e93bd46d4 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -242,6 +242,16 @@ struct ASCH_WIRE }; +struct ASCH_JUNCTION +{ + int ownerpartid; + + wxPoint location; + + explicit ASCH_JUNCTION( const std::map& aProperties ); +}; + + struct ASCH_DESIGNATOR { int ownerindex; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 5e424a5ac0..6ac32aa98a 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -350,6 +350,7 @@ void SCH_ALTIUM_PLUGIN::Parse( const CFB::CompoundFileReader& aReader ) case ALTIUM_SCH_RECORD::TEXT_FRAME: break; case ALTIUM_SCH_RECORD::JUNCTION: + ParseJunction( properties ); break; case ALTIUM_SCH_RECORD::IMAGE: break; @@ -683,6 +684,17 @@ void SCH_ALTIUM_PLUGIN::ParseWire( const std::map& aProperti } +void SCH_ALTIUM_PLUGIN::ParseJunction( const std::map& aProperties ) +{ + ASCH_JUNCTION elem( aProperties ); + + SCH_JUNCTION* junction = new SCH_JUNCTION( elem.location ); + + junction->SetFlags( IS_NEW ); + m_currentSheet->GetScreen()->Append( junction ); +} + + void SCH_ALTIUM_PLUGIN::ParseDesignator( const std::map& aProperties ) { ASCH_DESIGNATOR elem( aProperties ); diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.h b/eeschema/sch_plugins/altium/sch_altium_plugin.h index ba6d9d7e9f..fad66a3659 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.h +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.h @@ -104,6 +104,7 @@ private: void ParseNetLabel( const std::map& aProperties ); void ParseBus( const std::map& aProperties ); void ParseWire( const std::map& aProperties ); + void ParseJunction( const std::map& aProperties ); void ParseDesignator( const std::map& aProperties ); private: