Don't go through a middle man when reading pad shape primitives.
They're both PCB_SHAPEs. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15073
This commit is contained in:
parent
0315adc646
commit
9f5a268f15
|
@ -4571,62 +4571,22 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
if( token == T_LEFT )
|
if( token == T_LEFT )
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
// Currently, I am using parsePCB_SHAPE() to read basic shapes parameters,
|
|
||||||
// because they are the same as a PCB_SHAPE.
|
|
||||||
// However it could be better to write a specific parser, to avoid possible issues
|
|
||||||
// if the PCB_SHAPE parser is modified.
|
|
||||||
PCB_SHAPE* dummyShape = nullptr;
|
|
||||||
|
|
||||||
switch( token )
|
switch( token )
|
||||||
{
|
{
|
||||||
case T_gr_arc:
|
case T_gr_arc:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitiveArc( dummyShape->GetCenter(), dummyShape->GetStart(),
|
|
||||||
dummyShape->GetArcAngle(), dummyShape->GetWidth() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_line:
|
case T_gr_line:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitiveSegment( dummyShape->GetStart(), dummyShape->GetEnd(),
|
|
||||||
dummyShape->GetWidth() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_circle:
|
case T_gr_circle:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitiveCircle( dummyShape->GetCenter(), dummyShape->GetRadius(),
|
|
||||||
dummyShape->GetWidth(), dummyShape->IsFilled() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_rect:
|
case T_gr_rect:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitiveRect( dummyShape->GetStart(), dummyShape->GetEnd(),
|
|
||||||
dummyShape->GetWidth(), dummyShape->IsFilled() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_bbox:
|
case T_gr_bbox:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitiveAnnotationBox( dummyShape->GetStart(), dummyShape->GetEnd() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_poly:
|
case T_gr_poly:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
|
||||||
pad->AddPrimitivePoly( dummyShape->GetPolyShape(), dummyShape->GetWidth(),
|
|
||||||
dummyShape->IsFilled() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_gr_curve:
|
case T_gr_curve:
|
||||||
dummyShape = parsePCB_SHAPE( nullptr );
|
pad->AddPrimitive( parsePCB_SHAPE( nullptr ) );
|
||||||
pad->AddPrimitiveCurve( dummyShape->GetStart(), dummyShape->GetEnd(),
|
|
||||||
dummyShape->GetBezierC1(), dummyShape->GetBezierC2(),
|
|
||||||
dummyShape->GetWidth() );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Expecting( "gr_line, gr_arc, gr_circle, gr_curve, gr_rect, gr_bbox or gr_poly" );
|
Expecting( "gr_line, gr_arc, gr_circle, gr_curve, gr_rect, gr_bbox or gr_poly" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dummyShape;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue