Prevent re-testing DRC on zones
We only need to test zone connections once, so we skip the double-check from the nested loop unless we are only checking a single zone. Then the second loop needs to iterate over the full list of zones.
This commit is contained in:
parent
b1d44ed415
commit
686f1b878b
|
@ -216,13 +216,19 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||||
BOARD_COMMIT commit( m_pcbEditorFrame );
|
BOARD_COMMIT commit( m_pcbEditorFrame );
|
||||||
int nerrors = 0;
|
int nerrors = 0;
|
||||||
|
|
||||||
|
std::vector<SHAPE_POLY_SET> smoothed_polys;
|
||||||
|
smoothed_polys.resize( board->GetAreaCount() );
|
||||||
|
|
||||||
|
for( int ia = 0; ia < board->GetAreaCount(); ia++ )
|
||||||
|
{
|
||||||
|
ZONE_CONTAINER* zoneRef = board->GetArea( ia );
|
||||||
|
zoneRef->BuildSmoothedPoly( smoothed_polys[ia] );
|
||||||
|
}
|
||||||
|
|
||||||
// iterate through all areas
|
// iterate through all areas
|
||||||
for( int ia = 0; ia < board->GetAreaCount(); ia++ )
|
for( int ia = 0; ia < board->GetAreaCount(); ia++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zoneRef = board->GetArea( ia );
|
ZONE_CONTAINER* zoneRef = board->GetArea( ia );
|
||||||
SHAPE_POLY_SET refSmoothedPoly;
|
|
||||||
|
|
||||||
zoneRef->BuildSmoothedPoly( refSmoothedPoly );
|
|
||||||
|
|
||||||
if( !zoneRef->IsOnCopperLayer() )
|
if( !zoneRef->IsOnCopperLayer() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -231,12 +237,11 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||||
if( aZone && ( aZone != zoneRef) )
|
if( aZone && ( aZone != zoneRef) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( int ia2 = 0; ia2 < board->GetAreaCount(); ia2++ )
|
// If we are testing a single zone, then iterate through all other zones
|
||||||
|
// Otherwise, we have already tested the zone combination
|
||||||
|
for( int ia2 = ( aZone ? 0 : ia + 1 ); ia2 < board->GetAreaCount(); ia2++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zoneToTest = board->GetArea( ia2 );
|
ZONE_CONTAINER* zoneToTest = board->GetArea( ia2 );
|
||||||
SHAPE_POLY_SET testSmoothedPoly;
|
|
||||||
|
|
||||||
zoneToTest->BuildSmoothedPoly( testSmoothedPoly );
|
|
||||||
|
|
||||||
if( zoneRef == zoneToTest )
|
if( zoneRef == zoneToTest )
|
||||||
continue;
|
continue;
|
||||||
|
@ -270,12 +275,12 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||||
zone2zoneClearance = 1;
|
zone2zoneClearance = 1;
|
||||||
|
|
||||||
// test for some corners of zoneRef inside zoneToTest
|
// test for some corners of zoneRef inside zoneToTest
|
||||||
for( auto iterator = refSmoothedPoly.IterateWithHoles(); iterator; iterator++ )
|
for( auto iterator = smoothed_polys[ia].IterateWithHoles(); iterator; iterator++ )
|
||||||
{
|
{
|
||||||
VECTOR2I currentVertex = *iterator;
|
VECTOR2I currentVertex = *iterator;
|
||||||
wxPoint pt( currentVertex.x, currentVertex.y );
|
wxPoint pt( currentVertex.x, currentVertex.y );
|
||||||
|
|
||||||
if( testSmoothedPoly.Contains( currentVertex ) )
|
if( smoothed_polys[ia2].Contains( currentVertex ) )
|
||||||
{
|
{
|
||||||
if( aCreateMarkers )
|
if( aCreateMarkers )
|
||||||
commit.Add( newMarker( pt, zoneRef, zoneToTest, DRCE_ZONES_INTERSECT ) );
|
commit.Add( newMarker( pt, zoneRef, zoneToTest, DRCE_ZONES_INTERSECT ) );
|
||||||
|
@ -285,12 +290,12 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for some corners of zoneToTest inside zoneRef
|
// test for some corners of zoneToTest inside zoneRef
|
||||||
for( auto iterator = testSmoothedPoly.IterateWithHoles(); iterator; iterator++ )
|
for( auto iterator = smoothed_polys[ia2].IterateWithHoles(); iterator; iterator++ )
|
||||||
{
|
{
|
||||||
VECTOR2I currentVertex = *iterator;
|
VECTOR2I currentVertex = *iterator;
|
||||||
wxPoint pt( currentVertex.x, currentVertex.y );
|
wxPoint pt( currentVertex.x, currentVertex.y );
|
||||||
|
|
||||||
if( refSmoothedPoly.Contains( currentVertex ) )
|
if( smoothed_polys[ia].Contains( currentVertex ) )
|
||||||
{
|
{
|
||||||
if( aCreateMarkers )
|
if( aCreateMarkers )
|
||||||
commit.Add( newMarker( pt, zoneToTest, zoneRef, DRCE_ZONES_INTERSECT ) );
|
commit.Add( newMarker( pt, zoneToTest, zoneRef, DRCE_ZONES_INTERSECT ) );
|
||||||
|
@ -302,13 +307,13 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||||
// Iterate through all the segments of refSmoothedPoly
|
// Iterate through all the segments of refSmoothedPoly
|
||||||
std::set<wxPoint> conflictPoints;
|
std::set<wxPoint> conflictPoints;
|
||||||
|
|
||||||
for( auto refIt = refSmoothedPoly.IterateSegmentsWithHoles(); refIt; refIt++ )
|
for( auto refIt = smoothed_polys[ia].IterateSegmentsWithHoles(); refIt; refIt++ )
|
||||||
{
|
{
|
||||||
// Build ref segment
|
// Build ref segment
|
||||||
SEG refSegment = *refIt;
|
SEG refSegment = *refIt;
|
||||||
|
|
||||||
// Iterate through all the segments in testSmoothedPoly
|
// Iterate through all the segments in smoothed_polys[ia2]
|
||||||
for( auto testIt = testSmoothedPoly.IterateSegmentsWithHoles(); testIt; testIt++ )
|
for( auto testIt = smoothed_polys[ia2].IterateSegmentsWithHoles(); testIt; testIt++ )
|
||||||
{
|
{
|
||||||
// Build test segment
|
// Build test segment
|
||||||
SEG testSegment = *testIt;
|
SEG testSegment = *testIt;
|
||||||
|
|
Loading…
Reference in New Issue