Altium schematic: support Line dash styles and colors.

This commit is contained in:
Alex Shvartzkop 2023-09-11 17:52:13 +03:00
parent 79d750e883
commit a2b7bf97b9
3 changed files with 14 additions and 18 deletions

View File

@ -363,13 +363,8 @@ ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& 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<ASCH_POLYLINE_LINESTYLE>( 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<wxString, wxString>& 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<wxString, wxString>& 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<wxString, wxString>& aPro
// ownerindex = ReadOwnerIndex( aProps );
indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
Side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
@ -542,7 +536,6 @@ ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& 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<wxString, wxString>& 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<wxString, wxString>& 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++ )

View File

@ -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<wxString, wxString>& aProps );
};

View File

@ -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<wxString, wxString>& 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<wxString, wxString>& 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 ) );
}
}