diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index a7dfeeebfd..cbf58aad46 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -363,13 +363,8 @@ ASCH_POLYLINE::ASCH_POLYLINE( const std::map& aProps ) : -ReadKiCadUnitFrac( aProps, "Y" + si ) ); } - int linestyleVar = ALTIUM_PARSER::ReadInt( aProps, "LINESTYLEEXT", 0 ); - - // overwrite if present. - linestyleVar = ALTIUM_PARSER::ReadInt( aProps, "LINESTYLE", linestyleVar ); - LineStyle = linestyleVar >= 0 && linestyleVar <= 3 ? - static_cast( linestyleVar ) : - ASCH_POLYLINE_LINESTYLE::SOLID; + auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID ); + LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present. } @@ -455,6 +450,9 @@ ASCH_LINE::ASCH_LINE( const std::map& aProps ) : -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) ); point2 = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ), -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) ); + + auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID ); + LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present. } @@ -473,8 +471,6 @@ ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map& aP -ReadKiCadUnitFrac( aProps, "Y" + si ) ); } - indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); - Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" ); } @@ -509,8 +505,6 @@ ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map& aPro // ownerindex = ReadOwnerIndex( aProps ); - indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); - DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" ); Side = ReadEnum( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT ); @@ -542,7 +536,6 @@ ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map& aProps IsHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false ); OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true ); - indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 ); FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 ); } @@ -680,8 +673,6 @@ ASCH_BUS::ASCH_BUS( const std::map& aProps ) : { wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS ); - indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); - int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 ); for( int i = 1; i <= locationcount; i++ ) @@ -700,8 +691,6 @@ ASCH_WIRE::ASCH_WIRE( const std::map& aProps ) : { wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::WIRE ); - indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 ); - int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 ); for( int i = 1; i <= locationcount; i++ ) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index bc98f4cf96..3fb5cd056b 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -502,6 +502,8 @@ struct ASCH_LINE : ASCH_OWNER_INTERFACE, ASCH_BORDER_INTERFACE VECTOR2I point1; VECTOR2I point2; + ASCH_POLYLINE_LINESTYLE LineStyle; + explicit ASCH_LINE( 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 ab5f94979e..0fe523aa09 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -153,6 +153,9 @@ static void SetLibShapeLine( const ASCH_BORDER_INTERFACE& elem, LIB_SHAPE* shape case ALTIUM_SCH_RECORD::ELLIPTICAL_ARC: default_color = COLOR4D( PUREBLUE ); break; + case ALTIUM_SCH_RECORD::LINE: + default_color = COLOR4D( PUREBLUE ); + break; case ALTIUM_SCH_RECORD::POLYGON: default_color = COLOR4D( PUREBLUE ); break; @@ -2281,7 +2284,8 @@ void SCH_ALTIUM_PLUGIN::ParseLine( const std::map& aProperti // close polygon SCH_LINE* line = new SCH_LINE( elem.point1 + m_sheetOffset, SCH_LAYER_ID::LAYER_NOTES ); line->SetEndPoint( elem.point2 + m_sheetOffset ); - line->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) ); // TODO? + line->SetStroke( STROKE_PARAMS( elem.LineWidth, GetPlotDashType( elem.LineStyle ), + GetColorFromInt( elem.Color ) ) ); line->SetFlags( IS_NEW ); screen->Append( line ); @@ -2329,7 +2333,8 @@ void SCH_ALTIUM_PLUGIN::ParseLine( const std::map& aProperti line->AddPoint( GetRelativePosition( elem.point2 + m_sheetOffset, schsym ) ); } - line->SetStroke( STROKE_PARAMS( elem.LineWidth, PLOT_DASH_TYPE::SOLID ) ); + SetLibShapeLine( elem, line, ALTIUM_SCH_RECORD::LINE ); + line->SetLineStyle( GetPlotDashType( elem.LineStyle ) ); } }