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
This commit is contained in:
jean-pierre charras 2019-06-28 15:12:19 +02:00
parent b8fff99e68
commit 17143fd53f
1 changed files with 13 additions and 5 deletions

View File

@ -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 <tomasz.wlostowski@cern.ch>
*
@ -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<ZONE_CONTAINER*>( 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;