Move zone out-of-date check to the right place.

Fixes: lp:1760097
* https://bugs.launchpad.net/kicad/+bug/1760097
This commit is contained in:
Jeff Young 2018-04-09 15:07:53 +01:00
parent 4b0d477c76
commit 05dae96275
3 changed files with 18 additions and 12 deletions

View File

@ -34,6 +34,8 @@
#include <memory>
#include <math/vector2d.h>
#include <geometry/shape_poly_set.h>
#include <class_zone.h>
class CN_CLUSTER;
class CN_CONNECTIVITY_ALGO;
@ -57,8 +59,14 @@ struct CN_DISJOINT_NET_ENTRY
struct CN_ZONE_ISOLATED_ISLAND_LIST
{
ZONE_CONTAINER *m_zone;
std::vector<int> m_islands;
CN_ZONE_ISOLATED_ISLAND_LIST( ZONE_CONTAINER* aZone ) :
m_zone( aZone ),
m_lastPolys( aZone->GetFilledPolysList() )
{}
ZONE_CONTAINER* m_zone;
const SHAPE_POLY_SET m_lastPolys;
std::vector<int> m_islands;
};
struct RN_DYNAMIC_LINE

View File

@ -97,9 +97,7 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
if( zone->GetIsKeepout() )
continue;
CN_ZONE_ISOLATED_ISLAND_LIST l;
l.m_zone = zone;
toFill.push_back( l );
toFill.emplace_back( CN_ZONE_ISOLATED_ISLAND_LIST(zone) );
}
for( unsigned i = 0; i < toFill.size(); i++ )
@ -117,7 +115,6 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
}
m_next = 0;
m_out_of_date = false;
m_count_done = 0;
std::vector<std::thread> fillWorkers;
@ -132,9 +129,6 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
ZONE_CONTAINER* zone = toFill[i].m_zone;
fillSingleZone( zone, rawPolys, finalPolys );
if( aCheck && zone->GetFilledPolysList().GetHash() != finalPolys.GetHash() )
m_out_of_date.store( true );
zone->SetRawPolysList( rawPolys );
zone->SetFilledPolysList( finalPolys );
zone->SetIsFilled( true );
@ -170,6 +164,8 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
connectivity->SetProgressReporter( m_progressReporter );
connectivity->FindIsolatedCopperIslands( toFill );
bool outOfDate = false;
for( auto& zone : toFill )
{
std::sort( zone.m_islands.begin(), zone.m_islands.end(), std::greater<int>() );
@ -181,11 +177,14 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
}
zone.m_zone->SetFilledPolysList( poly );
if( aCheck && zone.m_lastPolys.GetHash() != poly.GetHash() )
outOfDate = true;
}
if( aCheck && m_out_of_date )
if( aCheck && outOfDate )
{
bool cancel = !IsOK( nullptr, _( "Zone fills may be out-of-date. Re-fill all zones?" ) );
bool cancel = !IsOK( nullptr, _( "Zone fills are out-of-date. Re-fill?" ) );
if( m_progressReporter )
{

View File

@ -122,7 +122,6 @@ private:
std::atomic_size_t m_next; // An index into the vector of zones to fill.
// Used by the variuos parallel thread sets during
// fill operations.
std::atomic_bool m_out_of_date;
std::atomic_size_t m_count_done;
};