36 printf(
"&&&& %zu obstacles: \n", obstacles.size() );
38 for(
const auto& obs : obstacles )
40 printf(
"%p [%s] - %p [%s], clearance %d\n",
41 obs.m_head, obs.m_head->KindStr().c_str(),
42 obs.m_item, obs.m_item->KindStr().c_str(),
59 if( !parentH || !parentI )
62 const VIA* parentViaI = dyn_cast<const VIA*>( parentI );
63 const VIA* parentViaH = dyn_cast<const VIA*>( parentH );
76 if( parentViaI && parentViaH && parentViaI->
Pos() == parentViaH->
Pos()
78 && parentViaI->
Net() == parentViaH->
Net()
79 && parentViaI->
Drill() == parentViaH->
Drill() )
82 return parentI != parentH;
106 std::set<int> relevantLayers;
108 std::set_union( myLayers.begin(), myLayers.end(), otherLayers.begin(), otherLayers.end(),
109 std::inserter( relevantLayers, relevantLayers.begin() ) );
111 return relevantLayers;
126 bool collisionsFound =
false;
138 if(
const auto line = dyn_cast<const LINE*>(
this ) )
140 if( line->EndsWithVia() )
141 collisionsFound |= line->Via().
collideSimple( aHead, aNode, aLayer, aCtx );
144 if(
const auto line = dyn_cast<const LINE*>( aHead ) )
146 if( line->EndsWithVia() )
147 collisionsFound |= line->Via().collideSimple(
this, aNode, aLayer, aCtx );
154 collisionsFound =
true;
160 lineWidthI =
static_cast<const LINE*
>( this )->Width() / 2;
163 lineWidthH =
static_cast<const LINE*
>( aHead )->Width() / 2;
172 bool differentNetsOnly =
true;
173 bool enforce =
false;
181 differentNetsOnly =
false;
183 if( differentNetsOnly &&
Net() == aHead->
Net() && aHead->
Net() )
231 if( checkCastellation || checkNetTie )
240 if( shapeH->
Collide( shapeI, clearance + lineWidthH + lineWidthI - 1, &actual, &pos ) )
250 collisionsFound =
true;
271 if( shapeH->
Collide( shapeI, clearance + lineWidthH + lineWidthI - 1 ) )
275 collisionsFound =
true;
292 return collisionsFound;
310 case ARC_T:
return "arc";
311 case LINE_T:
return "line";
313 case VIA_T:
return "via";
317 case HOLE_T:
return "hole";
319 default:
return "unknown";
334 std::stringstream ss;
350 return static_cast<const NODE*
>(
Owner() );
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual NET_HANDLE Net() const override
ITEM * ParentPadVia() const override
Base class for PNS router board items.
virtual bool HasUniqueShapeLayers() const
virtual const std::string Format() const
virtual ITEM * ParentPadVia() const
virtual std::vector< int > UniqueShapeLayers() const
Return a list of layers that have unique (potentially different) shapes.
virtual const SHAPE * Shape(int aLayer) const
Return the geometrical shape of the item.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
std::set< int > RelevantShapeLayers(const ITEM *aOther) const
Returns the set of layers on which either this or the other item can have a unique shape.
bool Collide(const ITEM *aHead, const NODE *aNode, int aLayer, COLLISION_SEARCH_CONTEXT *aCtx=nullptr) const
Check for a collision (clearance violation) with between us and item aOther.
bool collideSimple(const ITEM *aHead, const NODE *aNode, int aLayer, COLLISION_SEARCH_CONTEXT *aCtx) const
virtual const NODE * OwningNode() const
bool OfKind(int aKindMask) const
std::string KindStr() const
virtual HOLE * Hole() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
static UNIQ_ID genNextUid()
Keep the router "world" - i.e.
int GetClearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true) const
Return the pre-set worst case clearance between any pair of items.
bool QueryEdgeExclusions(const VECTOR2I &aPos) const
RULE_RESOLVER * GetRuleResolver() const
Return the number of joints.
std::set< OBSTACLE > OBSTACLES
const ITEM_OWNER * Owner() const
Return the owner of this item, or NULL if there's none.
virtual wxString GetNetName(PNS::NET_HANDLE aNet) const =0
virtual bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const =0
ROUTER_IFACE * GetInterface() const
static ROUTER * GetInstance()
virtual bool IsNonPlatedSlot(const PNS::ITEM *aItem)=0
virtual bool IsNetTieExclusion(const ITEM *aItem, const VECTOR2I &aCollisionPos, const ITEM *aCollidingItem)=0
virtual bool IsKeepout(const ITEM *aObstacle, const ITEM *aItem, bool *aEnforce)=0
virtual bool IsInNetTie(const ITEM *aA)=0
const VECTOR2I & Pos() const
bool PadstackMatches(const VIA &aOther) const
bool Overlaps(const PNS_LAYER_RANGE &aOther) const
An abstract shape on 2D plane.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
VECTOR2_TRAITS< int32_t >::extended_type extended_type
Push and Shove diff pair dimensions (gap) settings dialog.
static void dumpObstacles(const PNS::NODE::OBSTACLES &obstacles)
static bool shouldWeConsiderHoleCollisions(const ITEM *aItem, const ITEM *aHead)
VECTOR2I::extended_type ecoord
const COLLISION_SEARCH_OPTIONS options
std::set< OBSTACLE > & obstacles
bool m_useClearanceEpsilon
Hold an object colliding with another object, along with some useful data about the collision.
int m_distFirst
... and the distance thereof
int m_maxFanoutWidth
worst case (largest) width of the tracks connected to the item
ITEM * m_head
Line we search collisions against.
ITEM * m_item
Item found to be colliding with m_head.