Use position of isolotaed spoke when reporting it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16058
This commit is contained in:
Jeff Young 2023-11-10 12:48:14 +00:00
parent 6417c9888f
commit e6081cf31a
1 changed files with 17 additions and 5 deletions

View File

@ -147,6 +147,7 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
BOX2I padBBox( item_bbox ); BOX2I padBBox( item_bbox );
int spokes = 0; int spokes = 0;
int ignoredSpokes = 0; int ignoredSpokes = 0;
VECTOR2I ignoredSpokePos;
for( int jj = 0; jj < zoneFill->OutlineCount(); ++jj ) for( int jj = 0; jj < zoneFill->OutlineCount(); ++jj )
{ {
@ -157,10 +158,18 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
// If we connect to an island that only connects to a single item then we *are* // If we connect to an island that only connects to a single item then we *are*
// that item. Thermal spokes to this (otherwise isolated) island don't provide // that item. Thermal spokes to this (otherwise isolated) island don't provide
// electrical connectivity to anything, so we don't count them. // electrical connectivity to anything, so we don't count them.
if( alg::contains( isolatedIslands.m_SingleConnectionOutlines, jj ) ) if( intersections.size() >= 2 )
ignoredSpokes += (int) intersections.size() / 2; {
else if( alg::contains( isolatedIslands.m_SingleConnectionOutlines, jj ) )
spokes += (int) intersections.size() / 2; {
ignoredSpokes += (int) intersections.size() / 2;
ignoredSpokePos = ( intersections[0].p + intersections[1].p ) / 2;
}
else
{
spokes += (int) intersections.size() / 2;
}
}
} }
if( spokes == 0 && ignoredSpokes == 0 ) // Not connected at all if( spokes == 0 && ignoredSpokes == 0 ) // Not connected at all
@ -194,12 +203,14 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
if( spokes < minCount ) if( spokes < minCount )
{ {
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_STARVED_THERMAL ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_STARVED_THERMAL );
VECTOR2I pos;
if( ignoredSpokes ) if( ignoredSpokes )
{ {
msg = wxString::Format( _( "(layer %s; %d spokes connected to isolated island)" ), msg = wxString::Format( _( "(layer %s; %d spokes connected to isolated island)" ),
board->GetLayerName( aLayer ), board->GetLayerName( aLayer ),
ignoredSpokes ); ignoredSpokes );
pos = ignoredSpokePos;
} }
else else
{ {
@ -208,13 +219,14 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
constraint.GetName(), constraint.GetName(),
minCount, minCount,
spokes ); spokes );
pos = pad->GetPosition();
} }
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg ); drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
drce->SetItems( aZone, pad ); drce->SetItems( aZone, pad );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, pad->GetPosition(), aLayer ); reportViolation( drce, pos, aLayer );
} }
} }
} }