Double opening speed of PCBs with ground and/or power planes.

(Or any other boards with complicated zones.)
This commit is contained in:
Jeff Young 2018-08-07 12:13:23 +01:00
parent 20bf6827e7
commit 7c04d8be1c
2 changed files with 10 additions and 5 deletions

View File

@ -2134,20 +2134,20 @@ bool SHAPE_POLY_SET::HasTouchingHoles() const
bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const
{
std::vector< VECTOR2I > pts;
std::set< long long > ptHashes;
for( const auto& lc : aPoly )
{
for( int i = 0; i < lc.PointCount(); i++ )
for( const VECTOR2I& pt : lc.CPoints() )
{
const auto p = lc.CPoint( i );
const long long ptHash = (long long) pt.x << 32 | pt.y;
if( std::find( pts.begin(), pts.end(), p ) != pts.end() )
if( ptHashes.count( ptHash ) > 0 )
{
return true;
}
pts.push_back( p );
ptHashes.insert( ptHash );
}
}

View File

@ -260,6 +260,11 @@ public:
return m_points[aIndex];
}
const std::vector<VECTOR2I>& CPoints() const
{
return m_points;
}
/**
* Returns the last point in the line chain.
*/