router: enable Hole Clearance rule only in Mark Obstacles mode
(it will be brought back to Walk/Shove modes as soon as all the underlying issues are fixed)
This commit is contained in:
parent
41bf397d24
commit
b08280d00c
|
@ -88,7 +88,7 @@ bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferent
|
|||
if( zoneB && Parent() && !checkKeepout( zoneB, Parent() ) )
|
||||
return false;
|
||||
|
||||
if( holeA || holeB )
|
||||
if( aNode->GetCollisionQueryScope() == NODE::CQS_ALL_RULES && (holeA || holeB ) )
|
||||
{
|
||||
int holeClearance = aNode->GetHoleClearance( this, aOther );
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ NODE::NODE()
|
|||
m_maxClearance = 800000; // fixme: depends on how thick traces are.
|
||||
m_ruleResolver = nullptr;
|
||||
m_index = new INDEX;
|
||||
m_collisionQueryScope = CQS_ALL_RULES;
|
||||
|
||||
#ifdef DEBUG
|
||||
allocNodes.insert( this );
|
||||
|
@ -146,6 +147,7 @@ NODE* NODE::Branch()
|
|||
child->m_ruleResolver = m_ruleResolver;
|
||||
child->m_root = isRoot() ? this : m_root;
|
||||
child->m_maxClearance = m_maxClearance;
|
||||
child->m_collisionQueryScope = m_collisionQueryScope;
|
||||
|
||||
// Immediate offspring of the root branch needs not copy anything. For the rest, deep-copy
|
||||
// joints, overridden item maps and pointers to stored items.
|
||||
|
@ -385,7 +387,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
|
|||
updateNearest( ip, obstacle.m_item, obstacleHull, false );
|
||||
}
|
||||
|
||||
if( obstacle.m_item->Hole() )
|
||||
if( m_collisionQueryScope == CQS_ALL_RULES && obstacle.m_item->Hole() )
|
||||
{
|
||||
clearance = GetHoleClearance( obstacle.m_item, aLine ) + aLine->Width() / 2;
|
||||
obstacleHull = obstacle.m_item->HoleHull( clearance + PNS_HULL_MARGIN, 0, layer );
|
||||
|
@ -428,8 +430,6 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
|
|||
if( nearest.m_distFirst == INT_MAX )
|
||||
nearest.m_item = obstacleList[0].m_item;
|
||||
|
||||
// debugDecorator->AddLine( nearest.m_hull, YELLOW, 60000, "obstacle-nearest-hull" );
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,6 +146,14 @@ protected:
|
|||
class NODE
|
||||
{
|
||||
public:
|
||||
|
||||
///< Supported item types
|
||||
enum COLLISION_QUERY_SCOPE
|
||||
{
|
||||
CQS_ALL_RULES = 1, ///< check all rules
|
||||
CQS_IGNORE_HOLE_CLEARANCE = 2 ///< check everything except hole2hole / hole2copper
|
||||
};
|
||||
|
||||
typedef OPT<OBSTACLE> OPT_OBSTACLE;
|
||||
typedef std::vector<ITEM*> ITEM_VECTOR;
|
||||
typedef std::vector<OBSTACLE> OBSTACLES;
|
||||
|
@ -388,6 +396,16 @@ public:
|
|||
|
||||
void FixupVirtualVias();
|
||||
|
||||
void SetCollisionQueryScope( COLLISION_QUERY_SCOPE aScope )
|
||||
{
|
||||
m_collisionQueryScope = aScope;
|
||||
}
|
||||
|
||||
COLLISION_QUERY_SCOPE GetCollisionQueryScope() const
|
||||
{
|
||||
return m_collisionQueryScope;
|
||||
}
|
||||
|
||||
private:
|
||||
void Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant = false );
|
||||
|
||||
|
@ -460,6 +478,8 @@ private:
|
|||
///< inheritance chain)
|
||||
|
||||
std::unordered_set<ITEM*> m_garbageItems;
|
||||
|
||||
COLLISION_QUERY_SCOPE m_collisionQueryScope;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -157,6 +157,15 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
|||
if( aStartItems.Empty() )
|
||||
return false;
|
||||
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_ALL_RULES );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||
}
|
||||
|
||||
if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
|
||||
{
|
||||
m_dragger = std::make_unique<COMPONENT_DRAGGER>( this );
|
||||
|
@ -372,6 +381,15 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem,
|
|||
|
||||
bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
|
||||
{
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_ALL_RULES );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||
}
|
||||
|
||||
if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -32,23 +32,29 @@ namespace PNS {
|
|||
bool VIA::PushoutForce( NODE* aNode, const ITEM* aOther, VECTOR2I& aForce )
|
||||
{
|
||||
int clearance = aNode->GetClearance( this, aOther );
|
||||
int holeClearance = aNode->GetHoleClearance( this, aOther );
|
||||
int hole2holeClearance = aNode->GetHoleToHoleClearance( this, aOther );
|
||||
VECTOR2I f[4], force;
|
||||
VECTOR2I elementForces[4], force;
|
||||
size_t nf = 0;
|
||||
|
||||
if( aOther->Hole() )
|
||||
if( aNode->GetCollisionQueryScope() == NODE::CQS_ALL_RULES )
|
||||
{
|
||||
aOther->Hole()->Collide( Shape(), holeClearance, &f[0] );
|
||||
aOther->Hole()->Collide( Hole(), hole2holeClearance, &f[1] );
|
||||
int holeClearance = aNode->GetHoleClearance( this, aOther );
|
||||
int hole2holeClearance = aNode->GetHoleToHoleClearance( this, aOther );
|
||||
|
||||
if( aOther->Hole() )
|
||||
{
|
||||
aOther->Hole()->Collide( Shape(), holeClearance, &elementForces[nf++] );
|
||||
aOther->Hole()->Collide( Hole(), hole2holeClearance, &elementForces[nf++] );
|
||||
}
|
||||
|
||||
aOther->Shape()->Collide( Hole(), holeClearance, &elementForces[nf++] );
|
||||
}
|
||||
|
||||
aOther->Shape()->Collide( Shape(), clearance, &f[2] );
|
||||
aOther->Shape()->Collide( Hole(), holeClearance, &f[3] );
|
||||
aOther->Shape()->Collide( Shape(), clearance, &elementForces[nf++] );
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
for( size_t i = 0; i < nf; i++ )
|
||||
{
|
||||
if( f[i].SquaredEuclideanNorm() > force.SquaredEuclideanNorm() )
|
||||
force = f[i];
|
||||
if( elementForces[i].SquaredEuclideanNorm() > force.SquaredEuclideanNorm() )
|
||||
force = elementForces[i];
|
||||
}
|
||||
|
||||
aForce = force;
|
||||
|
|
Loading…
Reference in New Issue