Reporting "actual" incompatible with exiting after first hit.

But we're currently using this only as a rough collision check
anyway as it doesn't know the specific item-to-item clearance.
This commit is contained in:
Jeff Young 2020-10-28 13:52:30 +00:00
parent 788a1e3bce
commit 1a1aef756e
5 changed files with 12 additions and 14 deletions

View File

@ -171,8 +171,8 @@ public:
int QueryColliding( BOARD_ITEM* aRefItem, int QueryColliding( BOARD_ITEM* aRefItem,
PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aRefLayer,
PCB_LAYER_ID aTargetLayer, PCB_LAYER_ID aTargetLayer,
std::function<bool( BOARD_ITEM*)> aFilter = nullptr, std::function<bool( BOARD_ITEM* )> aFilter = nullptr,
std::function<bool( BOARD_ITEM*, int)> aVisitor = nullptr, std::function<bool( BOARD_ITEM* )> aVisitor = nullptr,
int aClearance = 0 ) const int aClearance = 0 ) const
{ {
// keep track of BOARD_ITEMs that have been already found to collide (some items // keep track of BOARD_ITEMs that have been already found to collide (some items
@ -201,15 +201,13 @@ public:
if( !aFilter || aFilter( aItem->parent ) ) if( !aFilter || aFilter( aItem->parent ) )
{ {
int actual; if( refShape->Collide( aItem->shape, aClearance ) )
if( refShape->Collide( aItem->shape, aClearance, &actual ) )
{ {
collidingCompounds.insert( aItem->parent ); collidingCompounds.insert( aItem->parent );
count++; count++;
if( aVisitor ) if( aVisitor )
return aVisitor( aItem->parent, actual ); return aVisitor( aItem->parent );
} }
} }

View File

@ -404,7 +404,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
return true; return true;
}, },
[&]( BOARD_ITEM* other, int ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {
return testTrackAgainstItem( track, trackShape.get(), layer, other ); return testTrackAgainstItem( track, trackShape.get(), layer, other );
}, },
@ -562,7 +562,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( )
return true; return true;
}, },
[&]( BOARD_ITEM* other, int ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {
return testPadAgainstItem( pad, padShape.get(), layer, other ); return testPadAgainstItem( pad, padShape.get(), layer, other );
}, },

View File

@ -223,7 +223,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
if( testCopper && item->IsOnCopperLayer() ) if( testCopper && item->IsOnCopperLayer() )
{ {
edgesTree.QueryColliding( item, UNDEFINED_LAYER, Edge_Cuts, nullptr, edgesTree.QueryColliding( item, UNDEFINED_LAYER, Edge_Cuts, nullptr,
[&]( BOARD_ITEM* edge, int ) -> bool [&]( BOARD_ITEM* edge ) -> bool
{ {
return testAgainstEdge( item, itemShape.get(), edge, return testAgainstEdge( item, itemShape.get(), edge,
DRC_CONSTRAINT_TYPE_EDGE_CLEARANCE, DRC_CONSTRAINT_TYPE_EDGE_CLEARANCE,
@ -235,7 +235,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
if( testSilk && ( item->GetLayer() == F_SilkS || item->GetLayer() == B_SilkS ) ) if( testSilk && ( item->GetLayer() == F_SilkS || item->GetLayer() == B_SilkS ) )
{ {
edgesTree.QueryColliding( item, UNDEFINED_LAYER, Edge_Cuts, nullptr, edgesTree.QueryColliding( item, UNDEFINED_LAYER, Edge_Cuts, nullptr,
[&]( BOARD_ITEM* edge, int ) -> bool [&]( BOARD_ITEM* edge ) -> bool
{ {
return testAgainstEdge( item, itemShape.get(), edge, return testAgainstEdge( item, itemShape.get(), edge,
DRC_CONSTRAINT_TYPE_SILK_CLEARANCE, DRC_CONSTRAINT_TYPE_SILK_CLEARANCE,

View File

@ -185,7 +185,7 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run()
return true; return true;
}, },
[&]( BOARD_ITEM* other, int ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {
return testHoleAgainstHole( via, holeShape.get(), other ); return testHoleAgainstHole( via, holeShape.get(), other );
}, },
@ -211,7 +211,7 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run()
return true; return true;
}, },
[&]( BOARD_ITEM* other, int ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {
return testHoleAgainstHole( pad, holeShape.get(), other ); return testHoleAgainstHole( pad, holeShape.get(), other );
}, },

View File

@ -281,7 +281,7 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
via->SetEnd( via->GetStart() ); via->SetEnd( via->GetStart() );
rtree.QueryColliding( via, via->GetLayer(), via->GetLayer(), nullptr, rtree.QueryColliding( via, via->GetLayer(), via->GetLayer(), nullptr,
[&]( BOARD_ITEM* aItem, int ) -> bool [&]( BOARD_ITEM* aItem ) -> bool
{ {
if( aItem->Type() != PCB_VIA_T ) if( aItem->Type() != PCB_VIA_T )
return true; return true;
@ -343,7 +343,7 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
if( aDeleteDuplicateSegments && track->Type() == PCB_TRACE_T ) if( aDeleteDuplicateSegments && track->Type() == PCB_TRACE_T )
{ {
rtree.QueryColliding( track, track->GetLayer(), track->GetLayer(), nullptr, rtree.QueryColliding( track, track->GetLayer(), track->GetLayer(), nullptr,
[&]( BOARD_ITEM* aItem, int ) -> bool [&]( BOARD_ITEM* aItem ) -> bool
{ {
if( aItem->Type() != PCB_TRACE_T ) if( aItem->Type() != PCB_TRACE_T )
return true; return true;