Make sure RTree bounding box is at least as big as hole.
Fixes https://gitlab.com/kicad/code/kicad/issues/9526
This commit is contained in:
parent
b73793f9ef
commit
d66487c383
|
@ -49,6 +49,21 @@ static const SHAPE* shapeFunctor( T aItem )
|
|||
return aItem->Shape();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by #SHAPE_INDEX to get a SHAPE* for a hole from another type.
|
||||
*
|
||||
* By default relies on T::GetHole() method, should be specialized if the T object
|
||||
* doesn't allow that method.
|
||||
*
|
||||
* @param aItem generic T object.
|
||||
* @return a SHAPE* object equivalent to object.
|
||||
*/
|
||||
template <class T>
|
||||
static const SHAPE* holeFunctor( T aItem )
|
||||
{
|
||||
return aItem->Hole();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by #SHAPE_INDEX to get the bounding box of a generic T object.
|
||||
*
|
||||
|
@ -61,7 +76,12 @@ static const SHAPE* shapeFunctor( T aItem )
|
|||
template <class T>
|
||||
BOX2I boundingBox( T aObject )
|
||||
{
|
||||
return shapeFunctor( aObject )->BBox();
|
||||
BOX2I bbox = shapeFunctor( aObject )->BBox();
|
||||
|
||||
if( holeFunctor( aObject ) )
|
||||
bbox.Merge( holeFunctor( aObject )->BBox() );
|
||||
|
||||
return bbox;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue