Honour pad falshing when colliding with DRC RTree.
Fixes https://gitlab.com/kicad/code/kicad/issues/6443
This commit is contained in:
parent
3ff22fc882
commit
533d344e3f
|
@ -232,16 +232,13 @@ public:
|
|||
* It checks all items in the bbox overlap to find the minimal actual distance and
|
||||
* position.
|
||||
*/
|
||||
bool QueryColliding( BOARD_ITEM* aRefItem, PCB_LAYER_ID aLayer,
|
||||
int aClearance, int* aActual, VECTOR2I* aPos ) const
|
||||
bool QueryColliding( EDA_RECT aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int* aActual, VECTOR2I* aPos ) const
|
||||
{
|
||||
EDA_RECT box = aRefItem->GetBoundingBox();
|
||||
box.Inflate( aClearance );
|
||||
aBox.Inflate( aClearance );
|
||||
|
||||
int min[2] = { box.GetX(), box.GetY() };
|
||||
int max[2] = { box.GetRight(), box.GetBottom() };
|
||||
|
||||
std::shared_ptr<SHAPE> refShape = aRefItem->GetEffectiveShape( aLayer );
|
||||
int min[2] = { aBox.GetX(), aBox.GetY() };
|
||||
int max[2] = { aBox.GetRight(), aBox.GetBottom() };
|
||||
|
||||
bool collision = false;
|
||||
int actual = INT_MAX;
|
||||
|
@ -253,7 +250,7 @@ public:
|
|||
int curActual;
|
||||
VECTOR2I curPos;
|
||||
|
||||
if( refShape->Collide( aItem->shape, aClearance, &curActual, &curPos ) )
|
||||
if( aRefShape->Collide( aItem->shape, aClearance, &curActual, &curPos ) )
|
||||
{
|
||||
collision = true;
|
||||
|
||||
|
|
|
@ -341,7 +341,33 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem
|
|||
VECTOR2I pos;
|
||||
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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue