altium: Import POLY shape instead of line approximation (#8741)

This commit is contained in:
Thomas Pointhuber 2021-12-27 17:22:28 +01:00
parent 82ab04c1d6
commit 9ba733f23f
1 changed files with 14 additions and 26 deletions

View File

@ -1162,17 +1162,15 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map<wxString, wxString>& aProp
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
{ {
for( size_t i = 0; i + 1 < elem.points.size(); i++ ) SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
{
SCH_LINE* line = new SCH_LINE( elem.points.at( i ) + m_sheetOffset,
SCH_LAYER_ID::LAYER_NOTES );
line->SetEndPoint( elem.points.at( i + 1 ) + m_sheetOffset ); for( wxPoint& point : elem.points )
line->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) ); poly->AddPoint( point + m_sheetOffset );
line->SetFlags( IS_NEW ); poly->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) );
m_currentSheet->GetScreen()->Append( line ); poly->SetFlags( IS_NEW );
}
m_currentSheet->GetScreen()->Append( poly );
} }
else else
{ {
@ -1210,26 +1208,16 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
{ {
// TODO: we cannot fill this polygon, only draw it for now SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
for( size_t i = 0; i + 1 < elem.points.size(); i++ )
{
SCH_LINE* line = new SCH_LINE( elem.points.at( i ) + m_sheetOffset,
SCH_LAYER_ID::LAYER_NOTES );
line->SetEndPoint( elem.points.at( i + 1 ) + m_sheetOffset );
line->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) );
line->SetFlags( IS_NEW ); for( wxPoint& point : elem.points )
m_currentSheet->GetScreen()->Append( line ); poly->AddPoint( point + m_sheetOffset );
} poly->AddPoint( elem.points.front() + m_sheetOffset );
// close polygon SetSchShapeFillAndColor( elem, poly );
SCH_LINE* line = new SCH_LINE( elem.points.front() + m_sheetOffset, poly->SetFlags( IS_NEW );
SCH_LAYER_ID::LAYER_NOTES );
line->SetEndPoint( elem.points.back() + m_sheetOffset );
line->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) );
line->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( poly );
m_currentSheet->GetScreen()->Append( line );
} }
else else
{ {