From 9f5a268f15232a02eba44acfe8fe4fe0072ae88c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 11 Sep 2023 21:52:02 +0100 Subject: [PATCH] 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 --- pcbnew/plugins/kicad/pcb_parser.cpp | 42 +---------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 0dbb195192..793c4ef021 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -4571,62 +4571,22 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) if( token == T_LEFT ) 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 ) { case T_gr_arc: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveArc( dummyShape->GetCenter(), dummyShape->GetStart(), - dummyShape->GetArcAngle(), dummyShape->GetWidth() ); - break; - case T_gr_line: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveSegment( dummyShape->GetStart(), dummyShape->GetEnd(), - dummyShape->GetWidth() ); - break; - case T_gr_circle: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveCircle( dummyShape->GetCenter(), dummyShape->GetRadius(), - dummyShape->GetWidth(), dummyShape->IsFilled() ); - break; - case T_gr_rect: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveRect( dummyShape->GetStart(), dummyShape->GetEnd(), - dummyShape->GetWidth(), dummyShape->IsFilled() ); - break; - case T_gr_bbox: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveAnnotationBox( dummyShape->GetStart(), dummyShape->GetEnd() ); - break; - case T_gr_poly: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitivePoly( dummyShape->GetPolyShape(), dummyShape->GetWidth(), - dummyShape->IsFilled() ); - break; - case T_gr_curve: - dummyShape = parsePCB_SHAPE( nullptr ); - pad->AddPrimitiveCurve( dummyShape->GetStart(), dummyShape->GetEnd(), - dummyShape->GetBezierC1(), dummyShape->GetBezierC2(), - dummyShape->GetWidth() ); + pad->AddPrimitive( parsePCB_SHAPE( nullptr ) ); break; default: Expecting( "gr_line, gr_arc, gr_circle, gr_curve, gr_rect, gr_bbox or gr_poly" ); break; } - - delete dummyShape; } break;