From 6f384c880203dac7363ca59888aa3ca10320eda1 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. (cherry picked from commit 37772ac29ef553e25ca8c2c17212803105105e56) --- .../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 b41ebe25ba..b9321de47e 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 1239e1c493..6325ec6b57 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -663,6 +663,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 3596bbc620..c35756ab07 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -2639,27 +2639,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 );