drc: Test all zone layers for intersection

Zones can span multiple layers so we need to test each explicitly.

Fixes https://gitlab.com/kicad/code/kicad/issues/5750
This commit is contained in:
Seth Hillbrand 2020-09-21 20:40:05 -07:00
parent 76e44c2f4b
commit 408cd20294
1 changed files with 155 additions and 146 deletions

View File

@ -671,14 +671,22 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones()
// Test copper areas for valid netcodes -> fixme, goes to connectivity checks
for( int layer_id = F_Cu; layer_id <= B_Cu; ++layer_id )
{
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( layer_id );
std::vector<SHAPE_POLY_SET> smoothed_polys;
smoothed_polys.resize( m_board->GetAreaCount() );
// Skip over layers not used on the current board
if( !m_board->IsLayerEnabled( layer ) )
continue;
for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zoneRef = m_board->GetArea( ii );
zoneRef->BuildSmoothedPoly( smoothed_polys[ii], zoneRef->GetLayer() );
if( zoneRef->IsOnLayer( layer ) )
zoneRef->BuildSmoothedPoly( smoothed_polys[ii], layer );
}
// iterate through all areas
@ -689,7 +697,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones()
ZONE_CONTAINER* zoneRef = m_board->GetArea( ia );
if( !zoneRef->IsOnCopperLayer() )
if( !zoneRef->IsOnLayer( layer ) )
continue;
// If we are testing a single zone, then iterate through all other zones
@ -702,7 +710,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones()
continue;
// test for same layer
if( zoneRef->GetLayer() != zoneToTest->GetLayer() )
if( !zoneToTest->IsOnLayer( layer ) )
continue;
// Test for same net
@ -836,6 +844,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones()
}
}
}
}
int DRC_TEST_PROVIDER_COPPER_CLEARANCE::GetNumPhases() const