router: NODE|ITEM::QueryColliding() now can override clearance
Needed for clustering algorithm (to be committed later... ;-)
This commit is contained in:
parent
aca9cce5d5
commit
54f4f765b9
|
@ -29,7 +29,7 @@ typedef VECTOR2I::extended_type ecoord;
|
||||||
|
|
||||||
namespace PNS {
|
namespace PNS {
|
||||||
|
|
||||||
bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly ) const
|
bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly, int aOverrideClearance ) const
|
||||||
{
|
{
|
||||||
const ROUTER_IFACE* iface = ROUTER::GetInstance()->GetInterface();
|
const ROUTER_IFACE* iface = ROUTER::GetInstance()->GetInterface();
|
||||||
const SHAPE* shapeA = Shape();
|
const SHAPE* shapeA = Shape();
|
||||||
|
@ -123,14 +123,14 @@ bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferent
|
||||||
if( !Layers().IsMultilayer() && !iface->IsFlashedOnLayer( aOther, Layer()) )
|
if( !Layers().IsMultilayer() && !iface->IsFlashedOnLayer( aOther, Layer()) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int clearance = aNode->GetClearance( this, aOther );
|
int clearance = aOverrideClearance >= 0 ? aOverrideClearance : aNode->GetClearance( this, aOther );
|
||||||
return shapeA->Collide( shapeB, clearance + lineWidthA + lineWidthB );
|
return shapeA->Collide( shapeB, clearance + lineWidthA + lineWidthB );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ITEM::Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly ) const
|
bool ITEM::Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly, int aOverrideClearance ) const
|
||||||
{
|
{
|
||||||
if( collideSimple( aOther, aNode, aDifferentNetsOnly ) )
|
if( collideSimple( aOther, aNode, aDifferentNetsOnly, aOverrideClearance ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Special cases for "head" lines with vias attached at the end. Note that this does not
|
// Special cases for "head" lines with vias attached at the end. Note that this does not
|
||||||
|
@ -141,7 +141,7 @@ bool ITEM::Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOn
|
||||||
{
|
{
|
||||||
const LINE* line = static_cast<const LINE*>( this );
|
const LINE* line = static_cast<const LINE*>( this );
|
||||||
|
|
||||||
if( line->EndsWithVia() && line->Via().collideSimple( aOther, aNode, aDifferentNetsOnly ) )
|
if( line->EndsWithVia() && line->Via().collideSimple( aOther, aNode, aDifferentNetsOnly, aOverrideClearance ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ bool ITEM::Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOn
|
||||||
{
|
{
|
||||||
const LINE* line = static_cast<const LINE*>( aOther );
|
const LINE* line = static_cast<const LINE*>( aOther );
|
||||||
|
|
||||||
if( line->EndsWithVia() && line->Via().collideSimple( this, aNode, aDifferentNetsOnly ) )
|
if( line->EndsWithVia() && line->Via().collideSimple( this, aNode, aDifferentNetsOnly, aOverrideClearance ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ public:
|
||||||
* @param aOther is the item to check collision against.
|
* @param aOther is the item to check collision against.
|
||||||
* @return true, if a collision was found.
|
* @return true, if a collision was found.
|
||||||
*/
|
*/
|
||||||
bool Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly = true ) const;
|
bool Collide( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly = true, int aOverrideClearance = -1 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the geometrical shape of the item. Used for collision detection and spatial indexing.
|
* Return the geometrical shape of the item. Used for collision detection and spatial indexing.
|
||||||
|
@ -241,7 +241,7 @@ public:
|
||||||
bool IsCompoundShapePrimitive() const { return m_isCompoundShapePrimitive; }
|
bool IsCompoundShapePrimitive() const { return m_isCompoundShapePrimitive; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly ) const;
|
bool collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly, int aOverrideClearance ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PnsKind m_kind;
|
PnsKind m_kind;
|
||||||
|
|
|
@ -217,15 +217,17 @@ struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
|
||||||
int m_limitCount;
|
int m_limitCount;
|
||||||
int m_matchCount;
|
int m_matchCount;
|
||||||
bool m_differentNetsOnly;
|
bool m_differentNetsOnly;
|
||||||
|
int m_overrideClearance;
|
||||||
|
|
||||||
DEFAULT_OBSTACLE_VISITOR( NODE::OBSTACLES& aTab, const ITEM* aItem, int aKindMask,
|
DEFAULT_OBSTACLE_VISITOR( NODE::OBSTACLES& aTab, const ITEM* aItem, int aKindMask,
|
||||||
bool aDifferentNetsOnly ) :
|
bool aDifferentNetsOnly, int aOverrideClearance ) :
|
||||||
OBSTACLE_VISITOR( aItem ),
|
OBSTACLE_VISITOR( aItem ),
|
||||||
m_tab( aTab ),
|
m_tab( aTab ),
|
||||||
m_kindMask( aKindMask ),
|
m_kindMask( aKindMask ),
|
||||||
m_limitCount( -1 ),
|
m_limitCount( -1 ),
|
||||||
m_matchCount( 0 ),
|
m_matchCount( 0 ),
|
||||||
m_differentNetsOnly( aDifferentNetsOnly )
|
m_differentNetsOnly( aDifferentNetsOnly ),
|
||||||
|
m_overrideClearance( aOverrideClearance )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +248,7 @@ struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
|
||||||
if( visit( aCandidate ) )
|
if( visit( aCandidate ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( !aCandidate->Collide( m_item, m_node, m_differentNetsOnly ) )
|
if( !aCandidate->Collide( m_item, m_node, m_differentNetsOnly, m_overrideClearance ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
OBSTACLE obs;
|
OBSTACLE obs;
|
||||||
|
@ -267,13 +269,13 @@ struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
|
||||||
|
|
||||||
|
|
||||||
int NODE::QueryColliding( const ITEM* aItem, NODE::OBSTACLES& aObstacles, int aKindMask,
|
int NODE::QueryColliding( const ITEM* aItem, NODE::OBSTACLES& aObstacles, int aKindMask,
|
||||||
int aLimitCount, bool aDifferentNetsOnly )
|
int aLimitCount, bool aDifferentNetsOnly, int aOverrideClearance )
|
||||||
{
|
{
|
||||||
/// By default, virtual items cannot collide
|
/// By default, virtual items cannot collide
|
||||||
if( aItem->IsVirtual() )
|
if( aItem->IsVirtual() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly );
|
DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly, aOverrideClearance );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert( allocNodes.find( this ) != allocNodes.end() );
|
assert( allocNodes.find( this ) != allocNodes.end() );
|
||||||
|
|
|
@ -212,7 +212,7 @@ public:
|
||||||
* @return number of obstacles found
|
* @return number of obstacles found
|
||||||
*/
|
*/
|
||||||
int QueryColliding( const ITEM* aItem, OBSTACLES& aObstacles, int aKindMask = ITEM::ANY_T,
|
int QueryColliding( const ITEM* aItem, OBSTACLES& aObstacles, int aKindMask = ITEM::ANY_T,
|
||||||
int aLimitCount = -1, bool aDifferentNetsOnly = true );
|
int aLimitCount = -1, bool aDifferentNetsOnly = true, int aOverrideClearance = -1 );
|
||||||
|
|
||||||
int QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints,
|
int QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints,
|
||||||
LAYER_RANGE aLayerMask = LAYER_RANGE::All(), int aKindMask = ITEM::ANY_T );
|
LAYER_RANGE aLayerMask = LAYER_RANGE::All(), int aKindMask = ITEM::ANY_T );
|
||||||
|
|
Loading…
Reference in New Issue