From 17143fd53fa284d7bce224d0e72881f9ba565d3a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 28 Jun 2019 15:12:19 +0200 Subject: [PATCH] Pcbnew, connectivity: fix incorrect detection of dangling track ends when a end is inside a zone. This end was not detected as connected by the IsDangling method --- pcbnew/connectivity/connectivity_items.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index a39d2adfd6..96d88c9665 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2016-2018 CERN - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @@ -265,12 +265,20 @@ bool CN_ANCHOR::IsDangling() const if( m_item->AnchorCount() == 1 ) return connected_count < minimal_count; - // Only items with multiple anchors might have additional items connected that we - // should ignore for this calculation. + // Items with multiple anchors have usually items connected to each anchor. + // We want only the item count of this anchor point + connected_count = 0; for( auto item : m_item->ConnectedItems() ) { - if( !item->Parent()->HitTest( wxPoint( Pos().x, Pos().y ) ) ) - connected_count--; + if( item->Parent()->Type() == PCB_ZONE_AREA_T ) + { + ZONE_CONTAINER* zone = static_cast( item->Parent() ); + + if( zone->HitTestFilledArea( wxPoint( Pos().x, Pos().y ) ) ) + connected_count++; + } + else if( item->Parent()->HitTest( wxPoint( Pos().x, Pos().y ) ) ) + connected_count++; } return connected_count < minimal_count;