Fix incorrect detection of filled zones changes in DRC check.
Commit 6006703798
fixed a crash but broke the filled zones changes detection.
Filled zones were always seen as not up to date due to the fact the filled areas were cleared too early.
The up to date detection is also optimized: the old filled polygons are no longer stored.
Instead of, the MD5_HASH is calculated and stored before clearing the filled polygons.
This commit is contained in:
parent
ecb168f7a7
commit
fdfe5eabfb
|
@ -696,6 +696,19 @@ public:
|
|||
bool GetHV45() const { return m_hv45; }
|
||||
void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
|
||||
|
||||
/** @return the hash value previously calculated by BuildHashValue().
|
||||
* used in zone filling calculations
|
||||
*/
|
||||
MD5_HASH GetHashValue() { return m_filledPolysHash; }
|
||||
|
||||
/** Build the hash value of m_FilledPolysList, and store it internally
|
||||
* in m_filledPolysHash.
|
||||
* Used in zone filling calculations, to know if m_FilledPolysList is up to date.
|
||||
*/
|
||||
void BuildHashValue() { m_filledPolysHash = m_FilledPolysList.GetHash(); }
|
||||
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
@ -776,6 +789,8 @@ private:
|
|||
*/
|
||||
SHAPE_POLY_SET m_FilledPolysList;
|
||||
SHAPE_POLY_SET m_RawPolysList;
|
||||
MD5_HASH m_filledPolysHash; // A hash value used in zone filling calculations
|
||||
// to see if the filled areas are up to date
|
||||
|
||||
HATCH_STYLE m_hatchStyle; // hatch style, see enum above
|
||||
int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
|
||||
|
|
|
@ -61,12 +61,10 @@ struct CN_DISJOINT_NET_ENTRY
|
|||
struct CN_ZONE_ISOLATED_ISLAND_LIST
|
||||
{
|
||||
CN_ZONE_ISOLATED_ISLAND_LIST( ZONE_CONTAINER* aZone ) :
|
||||
m_zone( aZone ),
|
||||
m_lastPolys( aZone->GetFilledPolysList() )
|
||||
m_zone( aZone )
|
||||
{}
|
||||
|
||||
ZONE_CONTAINER* m_zone;
|
||||
const SHAPE_POLY_SET m_lastPolys;
|
||||
std::vector<int> m_islands;
|
||||
};
|
||||
|
||||
|
|
|
@ -99,9 +99,16 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
|
|||
if( m_commit )
|
||||
m_commit->Modify( zone );
|
||||
|
||||
// Remove existing fill first to prevent drawing invalid polygons
|
||||
zone->UnFill();
|
||||
// calculate the hash value for filled areas. it will be used later
|
||||
// to know if the current filled areas are up to date
|
||||
zone->BuildHashValue();
|
||||
|
||||
// Add the zone to the list of zones to test or refill
|
||||
toFill.emplace_back( CN_ZONE_ISOLATED_ISLAND_LIST(zone) );
|
||||
|
||||
// Remove existing fill first to prevent drawing invalid polygons
|
||||
// on some platforms
|
||||
zone->UnFill();
|
||||
}
|
||||
|
||||
if( m_progressReporter )
|
||||
|
@ -202,7 +209,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
|
|||
|
||||
zone.m_zone->SetFilledPolysList( poly );
|
||||
|
||||
if( aCheck && zone.m_lastPolys.GetHash() != poly.GetHash() )
|
||||
if( aCheck && zone.m_zone->GetHashValue() != poly.GetHash() )
|
||||
outOfDate = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue