From 82820d4b1c4ed96f6634b71c035e77400465f71e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 9 Apr 2022 20:39:35 +0100 Subject: [PATCH] Cleanup. --- .../drc_test_provider_copper_clearance.cpp | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index ff30c800de..962dc1a990 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -404,12 +404,17 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem, int clearance = -1; int actual; VECTOR2I pos; + PCB_VIA* via = nullptr; PAD* pad = nullptr; bool flashed = false; bool hasHole = false; bool platedHole = false; - if( aItem->Type() == PCB_PAD_T ) + if( aItem->Type() == PCB_VIA_T ) + { + via = static_cast( aItem ); + } + else if( aItem->Type() == PCB_PAD_T ) { pad = static_cast( aItem ); flashed = pad->FlashLayer( aLayer ); @@ -466,24 +471,18 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem, } } - if( zoneTree && testHoles && ( aItem->Type() == PCB_VIA_T || aItem->Type() == PCB_PAD_T ) ) + if( zoneTree && testHoles && ( pad || via ) ) { std::unique_ptr holeShape; - if( aItem->Type() == PCB_VIA_T ) + if( via && via->GetLayerSet().Contains( aLayer ) ) { - PCB_VIA* via = static_cast( aItem ); - pos = via->GetPosition(); - - if( via->GetLayerSet().Contains( aLayer ) ) - holeShape.reset( new SHAPE_SEGMENT( pos, pos, via->GetDrill() ) ); + holeShape.reset( new SHAPE_SEGMENT( via->GetPosition(), via->GetPosition(), + via->GetDrill() ) ); } - else if( aItem->Type() == PCB_PAD_T ) + else if( pad && pad->GetDrillSize().x ) { - PAD* pad = static_cast( aItem ); - - if( pad->GetDrillSize().x ) - holeShape.reset( new SHAPE_SEGMENT( *pad->GetEffectiveHoleShape() ) ); + holeShape.reset( new SHAPE_SEGMENT( *pad->GetEffectiveHoleShape() ) ); } if( holeShape )