From 37772ac29ef553e25ca8c2c17212803105105e56 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Tue, 4 Jul 2023 10:27:43 +0300 Subject: [PATCH] Altium schematic: import net label justification. --- .../sch_plugins/altium/altium_parser_sch.cpp | 3 +++ .../sch_plugins/altium/altium_parser_sch.h | 1 + .../sch_plugins/altium/sch_altium_plugin.cpp | 22 +------------------ 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index 4048bc463b..8824753be3 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -667,6 +667,9 @@ ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map& aProps ) location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ), -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); + justification = ReadEnum( aProps, "JUSTIFICATION", 0, 8, + ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT ); + orientation = ReadEnum( aProps, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS ); } diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index 36350fcef5..8a20544192 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -664,6 +664,7 @@ struct ASCH_NET_LABEL VECTOR2I location; + ASCH_LABEL_JUSTIFICATION justification; ASCH_RECORD_ORIENTATION orientation; explicit ASCH_NET_LABEL( const std::map& aProps ); diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index b0d6fd7eaa..c5ae132231 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -2640,27 +2640,7 @@ void SCH_ALTIUM_PLUGIN::ParseNetLabel( const std::map& aProp SCH_SCREEN* screen = getCurrentScreen(); wxCHECK( screen, /* void */ ); - switch( elem.orientation ) - { - case ASCH_RECORD_ORIENTATION::RIGHTWARDS: - label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); - break; - - case ASCH_RECORD_ORIENTATION::UPWARDS: - label->SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); - break; - - case ASCH_RECORD_ORIENTATION::LEFTWARDS: - label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); - break; - - case ASCH_RECORD_ORIENTATION::DOWNWARDS: - label->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); - break; - - default: - break; - } + SetTextPositioning( label, elem.justification, elem.orientation ); label->SetFlags( IS_NEW ); screen->Append( label );