Handle issue with alternate SHAPE_LINE_CHAIN

SHAPE_LINE_CHAIN_BASE can include things that are not SHAPE_LINE_CHAIN
like the triangle SHAPE_LINE primitive.  To check arcs, we need to avoid
these elements as they do not have the full SHAPE_LINE_CHAIN class
available.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17327

(cherry picked from commit 347c50b26d)
This commit is contained in:
Seth Hillbrand 2024-03-11 17:19:30 -07:00
parent 9be4bf0d14
commit 01590385c7
1 changed files with 8 additions and 3 deletions

View File

@ -360,14 +360,19 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_LINE_CH
if( closest_dist > 0 && aActual )
{
std::vector<const SHAPE_LINE_CHAIN*> chains = {
static_cast<const SHAPE_LINE_CHAIN*>( &aA ),
static_cast<const SHAPE_LINE_CHAIN*>( &aB )
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aA ),
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aB )
};
std::vector<const SHAPE*> shapes = { &aA, &aB };
for( int ii = 0; ii < 2; ii++ )
{
const SHAPE_LINE_CHAIN* chain = chains[ii];
const SHAPE_LINE_CHAIN* other = chains[( ii + 1 ) % 2];
const SHAPE* other = shapes[( ii + 1 ) % 2];
if( !chain )
continue;
for( size_t jj = 0; jj < chain->ArcCount(); jj++ )
{