mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 19:09:17 +00:00
Don't generate -1 width non-filled splines.
They serve no purpose, and will get replaced with default-line-width non-filled splines. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20138
This commit is contained in:
parent
8d096590dc
commit
1a10b5fb64
common/import_gfx
eeschema/import_gfx
pcbnew
@ -201,7 +201,9 @@ public:
|
||||
IMPORTED_POLYGON( const std::vector<VECTOR2D>& aVertices, const IMPORTED_STROKE& aStroke,
|
||||
bool aFilled, const COLOR4D& aFillColor ) :
|
||||
m_vertices( aVertices ),
|
||||
m_stroke( aStroke ), m_filled( aFilled ), m_fillColor( aFillColor )
|
||||
m_stroke( aStroke ),
|
||||
m_filled( aFilled ),
|
||||
m_fillColor( aFillColor )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,12 @@ bool SVG_IMPORT_PLUGIN::Import()
|
||||
// *not* closed so create a filled, closed shape for the fill, and an unfilled,
|
||||
// open shape for the outline
|
||||
static IMPORTED_STROKE noStroke( -1, LINE_STYLE::SOLID, COLOR4D::UNSPECIFIED );
|
||||
DrawPath( path->pts, path->npts, true, noStroke, true, fillColor );
|
||||
DrawPath( path->pts, path->npts, false, stroke, false, COLOR4D::UNSPECIFIED );
|
||||
const bool closed = true;
|
||||
|
||||
DrawPath( path->pts, path->npts, closed, noStroke, true, fillColor );
|
||||
|
||||
if( stroke.GetWidth() > 0 )
|
||||
DrawPath( path->pts, path->npts, !closed, stroke, false, COLOR4D::UNSPECIFIED );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -64,10 +64,10 @@ int GRAPHICS_IMPORTER_LIB_SYMBOL::MapLineWidth( double aLineWidth )
|
||||
|
||||
STROKE_PARAMS GRAPHICS_IMPORTER_LIB_SYMBOL::MapStrokeParams( const IMPORTED_STROKE& aStroke )
|
||||
{
|
||||
double width = aStroke.GetWidth();
|
||||
// Historicaly -1 meant no-stroke in Eeschema.
|
||||
int width = ( aStroke.GetWidth() == -1 ) ? -1 : MapLineWidth( aStroke.GetWidth() );
|
||||
|
||||
return STROKE_PARAMS( width != -1 ? MapLineWidth( width ) : -1, aStroke.GetPlotStyle(),
|
||||
aStroke.GetColor() );
|
||||
return STROKE_PARAMS( width, aStroke.GetPlotStyle(), aStroke.GetColor() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,10 +65,10 @@ int GRAPHICS_IMPORTER_SCH::MapLineWidth( double aLineWidth )
|
||||
|
||||
STROKE_PARAMS GRAPHICS_IMPORTER_SCH::MapStrokeParams( const IMPORTED_STROKE& aStroke )
|
||||
{
|
||||
double width = aStroke.GetWidth();
|
||||
// Historicaly -1 meant no-stroke in Eeschema.
|
||||
int width = ( aStroke.GetWidth() == -1 ) ? -1 : MapLineWidth( aStroke.GetWidth() );
|
||||
|
||||
return STROKE_PARAMS( width != -1 ? MapLineWidth( width ) : -1, aStroke.GetPlotStyle(),
|
||||
aStroke.GetColor() );
|
||||
return STROKE_PARAMS( width, aStroke.GetPlotStyle(), aStroke.GetColor() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,10 +67,12 @@ int GRAPHICS_IMPORTER_PCBNEW::MapLineWidth( double aLineWidth )
|
||||
|
||||
STROKE_PARAMS GRAPHICS_IMPORTER_PCBNEW::MapStrokeParams( const IMPORTED_STROKE& aStroke )
|
||||
{
|
||||
double width = aStroke.GetWidth();
|
||||
// Historicaly -1 meant no-stroke in Eeschema, but this has never been the case for
|
||||
// PCBNew. (The importer, which doesn't know which program it's creating content for,
|
||||
// also uses -1 for no-stroke.)
|
||||
int width = ( aStroke.GetWidth() == -1 ) ? 0 : MapLineWidth( aStroke.GetWidth() );
|
||||
|
||||
return STROKE_PARAMS( width != -1 ? MapLineWidth( width ) : -1, aStroke.GetPlotStyle(),
|
||||
aStroke.GetColor() );
|
||||
return STROKE_PARAMS( width, aStroke.GetPlotStyle(), aStroke.GetColor() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -3030,7 +3030,7 @@ PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
||||
case T_gr_vector:
|
||||
case T_gr_line:
|
||||
case T_fp_line:
|
||||
// Default PCB_SHAPE type is S_SEGMENT.
|
||||
shape->SetShape( SHAPE_T::SEGMENT );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_locked )
|
||||
@ -3094,7 +3094,15 @@ PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
||||
}
|
||||
|
||||
default:
|
||||
Expecting( "gr_arc, gr_circle, gr_curve, gr_line, gr_poly, gr_rect or gr_bbox" );
|
||||
if( aParent && aParent->Type() == PCB_FOOTPRINT_T )
|
||||
{
|
||||
Expecting( "fp_arc, fp_circle, fp_curve, fp_line, fp_poly or fp_rect" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Expecting( "gr_arc, gr_circle, gr_curve, gr_vector, gr_line, gr_poly, gr_rect or "
|
||||
"gr_bbox" );
|
||||
}
|
||||
}
|
||||
|
||||
bool foundFill = false;
|
||||
@ -3159,8 +3167,8 @@ PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
||||
|
||||
switch( token )
|
||||
{
|
||||
// T_yes was used to indicate filling when first introduced,
|
||||
// so treat it like a solid fill since that was the only fill available
|
||||
// T_yes was used to indicate filling when first introduced, so treat it like a
|
||||
// solid fill since that was the only fill available at the time.
|
||||
case T_yes:
|
||||
case T_solid: shape->SetFillMode( FILL_T::FILLED_SHAPE ); break;
|
||||
|
||||
@ -3177,19 +3185,15 @@ PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
||||
|
||||
break;
|
||||
|
||||
// We continue to parse the status field but it is no longer written
|
||||
case T_status:
|
||||
case T_status: // legacy token; ignore value
|
||||
parseHex();
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
// Handle (locked) from 5.99 development, and (locked yes) from modern times
|
||||
// Handle "(locked)" from 5.99 development, and "(locked yes)" from modern times
|
||||
case T_locked:
|
||||
{
|
||||
bool locked = parseMaybeAbsentBool( true );
|
||||
shape->SetLocked( locked );
|
||||
shape->SetLocked( parseMaybeAbsentBool( true ) );
|
||||
break;
|
||||
}
|
||||
|
||||
case T_net:
|
||||
if( !shape->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
|
||||
@ -3197,6 +3201,7 @@ PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
||||
wxLogError( _( "Invalid net ID in\nfile: '%s'\nline: %d\noffset: %d." ),
|
||||
CurSource(), CurLineNumber(), CurOffset() );
|
||||
}
|
||||
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user