Patch Altium import of oddly constructed line segments.
Fixes https://gitlab.com/kicad/code/kicad/issues/8974
This commit is contained in:
parent
3316f3998a
commit
c736bd3fd0
|
@ -1063,18 +1063,39 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
|
||||||
|
|
||||||
line->SetWidth( elem.lineWidth );
|
line->SetWidth( elem.lineWidth );
|
||||||
}
|
}
|
||||||
|
else if( i + 3 == elem.points.size() )
|
||||||
|
{
|
||||||
|
// TODO: special case of a single line with an extra point?
|
||||||
|
// I haven't a clue what this is all about, but the sample document we have in
|
||||||
|
// https://gitlab.com/kicad/code/kicad/-/issues/8974 responds best by treating it
|
||||||
|
// as another single line special case.
|
||||||
|
LIB_POLYLINE* line = new LIB_POLYLINE( libSymbolIt->second );
|
||||||
|
libSymbolIt->second->AddDrawItem( line );
|
||||||
|
|
||||||
|
line->SetUnit( elem.ownerpartid );
|
||||||
|
|
||||||
|
for( size_t j = i; j < elem.points.size() && j < i + 2; j++ )
|
||||||
|
{
|
||||||
|
line->AddPoint( GetRelativePosition( elem.points.at( j ) + m_sheetOffset,
|
||||||
|
symbol ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
line->SetWidth( elem.lineWidth );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Bezier always has maximum of 4 control points
|
// Bezier must have exactly 4 control points
|
||||||
LIB_BEZIER* bezier = new LIB_BEZIER( libSymbolIt->second );
|
LIB_BEZIER* bezier = new LIB_BEZIER( libSymbolIt->second );
|
||||||
libSymbolIt->second->AddDrawItem( bezier );
|
libSymbolIt->second->AddDrawItem( bezier );
|
||||||
|
|
||||||
bezier->SetUnit( elem.ownerpartid );
|
bezier->SetUnit( elem.ownerpartid );
|
||||||
|
|
||||||
|
std::vector<wxPoint> pts;
|
||||||
|
|
||||||
for( size_t j = i; j < elem.points.size() && j < i + 4; j++ )
|
for( size_t j = i; j < elem.points.size() && j < i + 4; j++ )
|
||||||
{
|
{
|
||||||
bezier->AddPoint( GetRelativePosition( elem.points.at( j ) + m_sheetOffset,
|
pts.push_back( GetRelativePosition( elem.points.at( j ) + m_sheetOffset,
|
||||||
symbol ) );
|
symbol ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bezier->SetWidth( elem.lineWidth );
|
bezier->SetWidth( elem.lineWidth );
|
||||||
|
|
Loading…
Reference in New Issue