From b9d7a0565f358c43ea3f00062d7d354614ce52a0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 15 Mar 2022 13:19:12 +0000 Subject: [PATCH] Hand cherry-pick fixes from master. https://gitlab.com/kicad/code/kicad/-/commit/0a8718cd1d62a40ea9094b773fb6caf56a695a05 https://gitlab.com/kicad/code/kicad/-/commit/7fb4a2c0a53089439ef3c31800bc310bc7c8a6ba --- pcbnew/connectivity/connectivity_data.cpp | 46 +++++++++++++---------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 277d56a070..62deaeb30c 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -416,20 +416,23 @@ bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, i } else if( CN_ZONE_LAYER* zoneLayer = dynamic_cast( connected ) ) { - ZONE* zone = static_cast( zoneLayer->Parent() ); - int islandIdx = zoneLayer->SubpolyIndex(); - const SHAPE_POLY_SET& fill = zone->GetFilledPolysList( layer ); - const SHAPE_LINE_CHAIN& island = fill.COutline( islandIdx ); - std::shared_ptr flashing = pad->GetEffectiveShape(); + ZONE* zone = static_cast( zoneLayer->Parent() ); + int islandIdx = zoneLayer->SubpolyIndex(); - for( const VECTOR2I& pt : island.CPoints() ) + if( zone->IsFilled() ) { - if( !flashing->Collide( pt ) ) - return true; + const auto& fill = zone->GetFilledPolysList( layer ); + const auto& padOutline = pad->GetEffectivePolygon()->Outline( 0 ); + + for( const VECTOR2I& pt : fill.COutline( islandIdx ).CPoints() ) + { + if( !padOutline.PointInside( pt ) ) + return true; + } } - // If the entire island is inside the pad's flashing then the pad won't - // *actually* connect to anything *else* so don't consider it connected. + // If the zone isn't filled, or the entire island is inside the pad's + // flashing then the pad won't _actually_ connect to anything else. return false; } } @@ -447,20 +450,23 @@ bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, i } else if( CN_ZONE_LAYER* zoneLayer = dynamic_cast( connected ) ) { - ZONE* zone = static_cast( zoneLayer->Parent() ); - int islandIdx = zoneLayer->SubpolyIndex(); - const SHAPE_POLY_SET& fill = zone->GetFilledPolysList( layer ); - const SHAPE_LINE_CHAIN& island = fill.COutline( islandIdx ); - SHAPE_CIRCLE flashing( via->GetCenter(), via->GetWidth() / 2 ); + ZONE* zone = static_cast( zoneLayer->Parent() ); + int islandIdx = zoneLayer->SubpolyIndex(); - for( const VECTOR2I& pt : island.CPoints() ) + if( zone->IsFilled() ) { - if( !flashing.SHAPE::Collide( pt ) ) - return true; + const auto& fill = zone->GetFilledPolysList( layer ); + SHAPE_CIRCLE viaCircle( via->GetCenter(), via->GetWidth() / 2 ); + + for( const VECTOR2I& pt : fill.COutline( islandIdx ).CPoints() ) + { + if( !viaCircle.SHAPE::Collide( pt ) ) + return true; + } } - // If the entire island is inside the via's flashing then the via won't - // *actually* connect to anything *else* so don't consider it connected. + // If the zone isn't filled, or the entire island is inside the pad's + // flashing then the pad won't _actually_ connect to anything else. return false; } }