Honour pad falshing when colliding with DRC RTree.

Fixes https://gitlab.com/kicad/code/kicad/issues/6443
This commit is contained in:
Jeff Young 2020-11-19 23:51:48 +00:00
parent 3ff22fc882
commit 533d344e3f
2 changed files with 33 additions and 10 deletions

View File

@ -232,16 +232,13 @@ public:
* It checks all items in the bbox overlap to find the minimal actual distance and * It checks all items in the bbox overlap to find the minimal actual distance and
* position. * position.
*/ */
bool QueryColliding( BOARD_ITEM* aRefItem, PCB_LAYER_ID aLayer, bool QueryColliding( EDA_RECT aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer, int aClearance,
int aClearance, int* aActual, VECTOR2I* aPos ) const int* aActual, VECTOR2I* aPos ) const
{ {
EDA_RECT box = aRefItem->GetBoundingBox(); aBox.Inflate( aClearance );
box.Inflate( aClearance );
int min[2] = { box.GetX(), box.GetY() }; int min[2] = { aBox.GetX(), aBox.GetY() };
int max[2] = { box.GetRight(), box.GetBottom() }; int max[2] = { aBox.GetRight(), aBox.GetBottom() };
std::shared_ptr<SHAPE> refShape = aRefItem->GetEffectiveShape( aLayer );
bool collision = false; bool collision = false;
int actual = INT_MAX; int actual = INT_MAX;
@ -253,7 +250,7 @@ public:
int curActual; int curActual;
VECTOR2I curPos; VECTOR2I curPos;
if( refShape->Collide( aItem->shape, aClearance, &curActual, &curPos ) ) if( aRefShape->Collide( aItem->shape, aClearance, &curActual, &curPos ) )
{ {
collision = true; collision = true;

View File

@ -341,7 +341,33 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem
VECTOR2I pos; VECTOR2I pos;
DRC_RTREE* zoneTree = m_zoneTrees[ zone ].get(); DRC_RTREE* zoneTree = m_zoneTrees[ zone ].get();
if( zoneTree->QueryColliding( aItem, aLayer, clearance - m_drcEpsilon, &actual, &pos ) ) EDA_RECT itemBBox = aItem->GetBoundingBox();
std::shared_ptr<SHAPE> itemShape = aItem->GetEffectiveShape( aLayer );
if( aItem->Type() == PCB_PAD_T )
{
PAD* pad = static_cast<PAD*>( aItem );
if( !pad->FlashLayer( aLayer ) )
{
if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
continue;
const SHAPE_SEGMENT* hole = pad->GetEffectiveHoleShape();
int size = hole->GetWidth();
// Note: drill size represents finish size, which means the actual hole
// size is the plating thickness larger.
if( pad->GetAttribute() == PAD_ATTRIB_PTH )
size += m_board->GetDesignSettings().GetHolePlatingThickness();
itemShape = std::make_shared<SHAPE_SEGMENT>( hole->GetSeg(), size );
}
}
if( zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer,
clearance - m_drcEpsilon,
&actual, &pos ) )
{ {
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE );