router: Clear rule resolver caches on routing/dragging start.
Fixes https://gitlab.com/kicad/code/kicad/issues/12907
This commit is contained in:
parent
3f790d9dae
commit
3dea146488
|
@ -128,6 +128,7 @@ public:
|
||||||
int ClearanceEpsilon() const { return m_clearanceEpsilon; }
|
int ClearanceEpsilon() const { return m_clearanceEpsilon; }
|
||||||
|
|
||||||
void ClearCacheForItem( const PNS::ITEM* aItem ) override;
|
void ClearCacheForItem( const PNS::ITEM* aItem ) override;
|
||||||
|
void ClearCaches() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int holeRadius( const PNS::ITEM* aItem ) const;
|
int holeRadius( const PNS::ITEM* aItem ) const;
|
||||||
|
@ -377,6 +378,14 @@ void PNS_PCBNEW_RULE_RESOLVER::ClearCacheForItem( const PNS::ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PNS_PCBNEW_RULE_RESOLVER::ClearCaches()
|
||||||
|
{
|
||||||
|
m_clearanceCache.clear();
|
||||||
|
m_holeClearanceCache.clear();
|
||||||
|
m_holeToHoleClearanceCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB,
|
int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB,
|
||||||
bool aUseClearanceEpsilon )
|
bool aUseClearanceEpsilon )
|
||||||
{
|
{
|
||||||
|
|
|
@ -307,6 +307,10 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
|
||||||
|
|
||||||
for( int i = 0; i < aLine->CLine().SegmentCount(); i++ )
|
for( int i = 0; i < aLine->CLine().SegmentCount(); i++ )
|
||||||
{
|
{
|
||||||
|
// Note: Clearances between &s and other items are cached,
|
||||||
|
// which means they'll be the same for all segments in the line.
|
||||||
|
// Disabling the cache will lead to slowness.
|
||||||
|
|
||||||
const SEGMENT s( *aLine, aLine->CLine().CSegment( i ) );
|
const SEGMENT s( *aLine, aLine->CLine().CSegment( i ) );
|
||||||
QueryColliding( &s, obstacleList, aKindMask );
|
QueryColliding( &s, obstacleList, aKindMask );
|
||||||
}
|
}
|
||||||
|
@ -479,6 +483,10 @@ NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM* aItemA, int aKindMask )
|
||||||
|
|
||||||
for( int i = 0; i < l.SegmentCount(); i++ )
|
for( int i = 0; i < l.SegmentCount(); i++ )
|
||||||
{
|
{
|
||||||
|
// Note: Clearances between &s and other items are cached,
|
||||||
|
// which means they'll be the same for all segments in the line.
|
||||||
|
// Disabling the cache will lead to slowness.
|
||||||
|
|
||||||
const SEGMENT s( *line, l.CSegment( i ) );
|
const SEGMENT s( *line, l.CSegment( i ) );
|
||||||
n += QueryColliding( &s, obs, aKindMask, 1 );
|
n += QueryColliding( &s, obs, aKindMask, 1 );
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
virtual wxString NetName( int aNet ) = 0;
|
virtual wxString NetName( int aNet ) = 0;
|
||||||
|
|
||||||
virtual void ClearCacheForItem( const ITEM* aItem ) {}
|
virtual void ClearCacheForItem( const ITEM* aItem ) {}
|
||||||
|
virtual void ClearCaches() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -166,6 +166,8 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
||||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetRuleResolver()->ClearCaches();
|
||||||
|
|
||||||
if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
|
if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
|
||||||
{
|
{
|
||||||
m_dragger = std::make_unique<COMPONENT_DRAGGER>( this );
|
m_dragger = std::make_unique<COMPONENT_DRAGGER>( this );
|
||||||
|
@ -396,6 +398,8 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
|
||||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetRuleResolver()->ClearCaches();
|
||||||
|
|
||||||
if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
|
if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue