pcbnew: Synchronize zone removal
After refilling zones, we need to unconditionally remove the filled polys from the map because their fills map have changed. Left-over filled polygons will not map to current polygons, creating "ghost" islands in the connectivity. Removing these can overflow the polygon count. Fixes: lp:1778454 * https://bugs.launchpad.net/kicad/+bug/1778454
This commit is contained in:
parent
246a9286a9
commit
0748c118dd
|
@ -303,7 +303,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
void CN_CONNECTIVITY_ALGO::searchConnections()
|
||||||
{
|
{
|
||||||
#ifdef CONNECTIVITY_DEBUG
|
#ifdef CONNECTIVITY_DEBUG
|
||||||
printf("Search start\n");
|
printf("Search start\n");
|
||||||
|
@ -341,10 +341,23 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
PROF_COUNTER search_basic( "search-basic" );
|
PROF_COUNTER search_basic( "search-basic" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( m_progressReporter )
|
||||||
|
{
|
||||||
|
m_progressReporter->SetMaxProgress(
|
||||||
|
m_zoneList.Size() + ( m_itemList.IsDirty() ? m_itemList.Size() : 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_OPENMP
|
||||||
|
#pragma omp parallel shared( m_itemList ) num_threads( std::max( omp_get_num_procs(), 2 ) )
|
||||||
|
{
|
||||||
|
if( omp_get_thread_num() == 0 && m_progressReporter )
|
||||||
|
m_progressReporter->KeepRefreshing( true );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( m_itemList.IsDirty() )
|
if( m_itemList.IsDirty() )
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENMP
|
#ifdef USE_OPENMP
|
||||||
#pragma omp parallel for schedule(dynamic)
|
#pragma omp parallel for
|
||||||
#endif
|
#endif
|
||||||
for( int i = 0; i < m_itemList.Size(); i++ )
|
for( int i = 0; i < m_itemList.Size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -353,10 +366,11 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
{
|
{
|
||||||
CN_VISITOR visitor( item, &m_listLock );
|
CN_VISITOR visitor( item, &m_listLock );
|
||||||
m_itemList.FindNearby( item, visitor );
|
m_itemList.FindNearby( item, visitor );
|
||||||
|
|
||||||
if( aIncludeZones )
|
|
||||||
m_zoneList.FindNearby( item, visitor );
|
m_zoneList.FindNearby( item, visitor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_progressReporter )
|
||||||
|
m_progressReporter->AdvanceProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,15 +378,8 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
search_basic.Show();
|
search_basic.Show();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( aIncludeZones )
|
|
||||||
{
|
|
||||||
if( m_progressReporter )
|
|
||||||
{
|
|
||||||
m_progressReporter->SetMaxProgress( m_zoneList.Size() );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_OPENMP
|
#ifdef USE_OPENMP
|
||||||
#pragma omp parallel for schedule(dynamic)
|
#pragma omp for
|
||||||
#endif
|
#endif
|
||||||
for( int i = 0; i < m_zoneList.Size(); i++ )
|
for( int i = 0; i < m_zoneList.Size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -385,12 +392,17 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
m_itemList.FindNearby( item, visitor );
|
m_itemList.FindNearby( item, visitor );
|
||||||
m_zoneList.FindNearby( item, visitor );
|
m_zoneList.FindNearby( item, visitor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_progressReporter )
|
||||||
|
m_progressReporter->AdvanceProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_OPENMP
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_zoneList.ClearDirtyFlags();
|
m_zoneList.ClearDirtyFlags();
|
||||||
m_itemList.ClearDirtyFlags();
|
m_itemList.ClearDirtyFlags();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONNECTIVITY_DEBUG
|
#ifdef CONNECTIVITY_DEBUG
|
||||||
printf("Search end\n");
|
printf("Search end\n");
|
||||||
|
@ -465,7 +477,7 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
|
||||||
CLUSTERS clusters;
|
CLUSTERS clusters;
|
||||||
|
|
||||||
if( isDirty() )
|
if( isDirty() )
|
||||||
searchConnections( includeZones );
|
searchConnections();
|
||||||
|
|
||||||
auto addToSearchList = [&head, withinAnyNet, aSingleNet, aTypes] ( CN_ITEM *aItem )
|
auto addToSearchList = [&head, withinAnyNet, aSingleNet, aTypes] ( CN_ITEM *aItem )
|
||||||
{
|
{
|
||||||
|
@ -703,11 +715,11 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std
|
||||||
void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
|
void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
|
||||||
{
|
{
|
||||||
for ( auto& z : aZones )
|
for ( auto& z : aZones )
|
||||||
{
|
|
||||||
if( z.m_zone->GetFilledPolysList().IsEmpty() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Remove( z.m_zone );
|
Remove( z.m_zone );
|
||||||
|
|
||||||
|
for ( auto& z : aZones )
|
||||||
|
{
|
||||||
|
if( !z.m_zone->GetFilledPolysList().IsEmpty() )
|
||||||
Add( z.m_zone );
|
Add( z.m_zone );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -692,7 +692,7 @@ public:
|
||||||
std::vector<bool> m_dirtyNets;
|
std::vector<bool> m_dirtyNets;
|
||||||
PROGRESS_REPORTER* m_progressReporter = nullptr;
|
PROGRESS_REPORTER* m_progressReporter = nullptr;
|
||||||
|
|
||||||
void searchConnections( bool aIncludeZones = false );
|
void searchConnections();
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void propagateConnections();
|
void propagateConnections();
|
||||||
|
@ -768,6 +768,13 @@ public:
|
||||||
|
|
||||||
void PropagateNets();
|
void PropagateNets();
|
||||||
void FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands );
|
void FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the copper islands that are not connected to a net. These are added to
|
||||||
|
* the m_islands vector.
|
||||||
|
* N.B. This must be called after aZones has been refreshed.
|
||||||
|
* @param: aZones The set of zones to search for islands
|
||||||
|
*/
|
||||||
void FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones );
|
void FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones );
|
||||||
|
|
||||||
bool CheckConnectivity( std::vector<CN_DISJOINT_NET_ENTRY>& aReport );
|
bool CheckConnectivity( std::vector<CN_DISJOINT_NET_ENTRY>& aReport );
|
||||||
|
|
Loading…
Reference in New Issue