Make sure unfilled zones get an MD5 hash.

Fixes https://gitlab.com/kicad/code/kicad/issues/6515
This commit is contained in:
Jeff Young 2020-11-26 20:21:15 +00:00
parent 13c63e3a50
commit 6f3b0c452f
2 changed files with 28 additions and 19 deletions

View File

@ -373,6 +373,27 @@ bool ZONE::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const
}
static SHAPE_POLY_SET g_nullPoly;
MD5_HASH ZONE::GetHashValue( PCB_LAYER_ID aLayer )
{
if( !m_filledPolysHash.count( aLayer ) )
return g_nullPoly.GetHash();
else
return m_filledPolysHash.at( aLayer );
}
void ZONE::BuildHashValue( PCB_LAYER_ID aLayer )
{
if( !m_FilledPolysList.count( aLayer ) )
m_filledPolysHash[aLayer] = g_nullPoly.GetHash();
else
m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
}
bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
// Normally accuracy is zoom-relative, but for the generic HitTest we just use

View File

@ -817,28 +817,16 @@ 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
/**
* 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.
*/
MD5_HASH GetHashValue( PCB_LAYER_ID aLayer )
{
if( !m_filledPolysHash.count( aLayer ) )
return MD5_HASH();
void BuildHashValue( PCB_LAYER_ID aLayer );
return m_filledPolysHash.at( aLayer );
}
/** 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.
/**
* @return the hash value previously calculated by BuildHashValue().
*/
void BuildHashValue( PCB_LAYER_ID aLayer )
{
if( !m_FilledPolysList.count( aLayer ) )
return;
m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
}
MD5_HASH GetHashValue( PCB_LAYER_ID aLayer );
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }