153 const ITEM* aCollidingItem ) = 0;
359 bool Add( std::unique_ptr<SEGMENT> aSegment,
bool aAllowRedundant =
false );
360 void Add( std::unique_ptr<SOLID> aSolid );
361 void Add( std::unique_ptr<VIA> aVia );
362 bool Add( std::unique_ptr<ARC> aArc,
bool aAllowRedundant =
false );
364 void Add(
LINE& aLine,
bool aAllowRedundant =
false );
391 void Replace(
ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem );
416 bool aStopAtLockedJoints =
false,
417 bool aFollowLockedSegments =
false );
420 void Dump(
bool aLong =
false );
498 add( aItem, aAllowRedundant );
509 void add(
ITEM* aItem,
bool aAllowRedundant =
false );
560 bool& aGuardHit,
bool aStopAtLockedJoints,
bool aFollowLockedSegments );
563 struct DEFAULT_OBSTACLE_VISITOR;
564 typedef std::unordered_multimap<JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASH>
JOINT_MAP;
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Base class for PNS router board items.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
LAYER_CONTEXT_SETTER(OBSTACLE_VISITOR &aVisitor, int aLayer)
OBSTACLE_VISITOR & m_visitor
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Keep the router "world" - i.e.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
void RemoveByMarker(int aMarker)
NODE * m_root
root node of the whole hierarchy
int FindLinesBetweenJoints(const JOINT &aA, const JOINT &aB, std::vector< LINE > &aLines)
Find the joints corresponding to the ends of line aLine.
NODE * GetParent() const
Check if this branch contains an updated version of the m_item from the root branch.
std::vector< ITEM * > ITEM_VECTOR
int GetClearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true) const
Return the pre-set worst case clearance between any pair of items.
void followLine(LINKED_ITEM *aCurrent, bool aScanDirection, int &aPos, int aLimit, VECTOR2I *aCorners, LINKED_ITEM **aSegments, bool *aArcReversed, bool &aGuardHit, bool aStopAtLockedJoints, bool aFollowLockedSegments)
void addSolid(SOLID *aSeg)
void Replace(ITEM *aOldItem, std::unique_ptr< ITEM > aNewItem)
Replace an item with another one.
bool Overrides(ITEM *aItem) const
int GetMaxClearance() const
Set the worst-case clearance between any pair of items.
void removeSegmentIndex(SEGMENT *aSeg)
void SetMaxClearance(int aClearance)
Assign a clearance resolution function object.
COLLISION_QUERY_SCOPE
< Supported item types
@ CQS_IGNORE_HOLE_CLEARANCE
check everything except hole2hole / hole2copper
@ CQS_ALL_RULES
check all rules
void rebuildJoint(const JOINT *aJoint, const ITEM *aItem)
void GetUpdatedItems(ITEM_VECTOR &aRemoved, ITEM_VECTOR &aAdded)
Return the list of items removed and added in this branch with respect to the root branch.
void addSegment(SEGMENT *aSeg)
std::vector< std::unique_ptr< SHAPE > > m_edgeExclusions
ARC * findRedundantArc(const VECTOR2I &A, const VECTOR2I &B, const PNS_LAYER_RANGE &lr, NET_HANDLE aNet)
JOINT_MAP::value_type TagJointPair
bool QueryEdgeExclusions(const VECTOR2I &aPos) const
void doRemove(ITEM *aItem)
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
const JOINT * FindJoint(const VECTOR2I &aPos, int aLayer, NET_HANDLE aNet) const
Search for a joint at a given position, layer and belonging to given net.
void addHole(HOLE *aHole)
std::optional< OBSTACLE > OPT_OBSTACLE
void unlinkJoint(const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
Helpers for adding/removing items.
std::unordered_set< ITEM * > m_garbageItems
void Dump(bool aLong=false)
void AddRaw(ITEM *aItem, bool aAllowRedundant=false)
NODE(const NODE &aB)
nodes are not copyable
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Destroy all child nodes. Applicable only to the root node.
RULE_RESOLVER * GetRuleResolver() const
Return the number of joints.
JOINT & touchJoint(const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet)
Touch a joint and links it to an m_item.
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
int QueryJoints(const BOX2I &aBox, std::vector< JOINT * > &aJoints, PNS_LAYER_RANGE aLayerMask=PNS_LAYER_RANGE::All(), int aKindMask=ITEM::ANY_T)
std::set< OBSTACLE > OBSTACLES
std::unordered_multimap< JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASH > JOINT_MAP
INDEX * m_index
Geometric/Net index of the items.
std::unordered_set< ITEM * > m_override
hash of root's items that have been changed in this node
void AllItemsInNet(NET_HANDLE aNet, std::set< ITEM * > &aItems, int aKindMask=-1)
OPT_OBSTACLE NearestObstacle(const LINE *aLine, const COLLISION_SEARCH_OPTIONS &aOpts=COLLISION_SEARCH_OPTIONS())
Follow the line in search of an obstacle that is nearest to the starting to the line's starting point...
void LockJoint(const VECTOR2I &aPos, const ITEM *aItem, bool aLock)
void SetRuleResolver(RULE_RESOLVER *aFunc)
void removeArcIndex(ARC *aVia)
int JointCount() const
Return the number of nodes in the inheritance chain (wrs to the root node).
void AddEdgeExclusion(std::unique_ptr< SHAPE > aShape)
int QueryColliding(const ITEM *aItem, OBSTACLES &aObstacles, const COLLISION_SEARCH_OPTIONS &aOpts=COLLISION_SEARCH_OPTIONS()) const
Find items colliding (closer than clearance) with the item aItem.
NODE & operator=(const NODE &aB)
Try to find matching joint and creates a new one if not found.
int m_maxClearance
worst case item-item clearance
const JOINT * FindJoint(const VECTOR2I &aPos, const ITEM *aItem) const
Search for a joint at a given position, linked to given item.
const std::unordered_set< ITEM * > & GetOverrides() const
VIA * FindViaByHandle(const VIA_HANDLE &handle) const
void removeViaIndex(VIA *aVia)
void add(ITEM *aItem, bool aAllowRedundant=false)
void removeSolidIndex(SOLID *aSeg)
int m_depth
depth of the node (number of parent nodes in the inheritance chain)
std::set< NODE * > m_children
list of nodes branched from this one
ITEM * FindItemByParent(const BOARD_ITEM *aParent)
JOINT_MAP m_joints
hash table with the joints, linking the items.
std::vector< ITEM * > FindItemsByParent(const BOARD_ITEM *aParent)
NODE * m_parent
node this node was branched from
void ClearRanks(int aMarkerMask=MK_HEAD|MK_VIOLATION)
void Remove(ARC *aArc)
Remove an item from this branch.
void Commit(NODE *aNode)
Apply the changes from a given branch (aNode) to the root branch.
RULE_RESOLVER * m_ruleResolver
Design rules resolver.
~NODE()
Return the expected clearance between items a and b.
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=nullptr, bool aStopAtLockedJoints=false, bool aFollowLockedSegments=false)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
SEGMENT * findRedundantSegment(const VECTOR2I &A, const VECTOR2I &B, const PNS_LAYER_RANGE &lr, NET_HANDLE aNet)
void linkJoint(const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
Unlink an item from a joint.
const ITEM_SET HitTest(const VECTOR2I &aPoint) const
Find all items that contain the point aPoint.
const NODE * m_node
node we are searching in (either root or a branch)
const ITEM * m_item
the item we are looking for collisions with
virtual bool operator()(ITEM *aCandidate)=0
bool visit(ITEM *aCandidate)
std::optional< int > m_layerContext
void SetLayerContext(int aLayer)
void SetWorld(const NODE *aNode, const NODE *aOverride=nullptr)
const NODE * m_override
node that overrides root entries
virtual ~OBSTACLE_VISITOR()
virtual int NetCode(NET_HANDLE aNet)=0
virtual void ClearCacheForItems(std::vector< const ITEM * > &aItems)
virtual int ClearanceEpsilon() const
virtual void ClearTemporaryCaches()
virtual bool IsNonPlatedSlot(const PNS::ITEM *aItem)=0
virtual int Clearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true)=0
virtual bool IsNetTieExclusion(const ITEM *aItem, const VECTOR2I &aCollisionPos, const ITEM *aCollidingItem)=0
virtual bool IsDrilledHole(const PNS::ITEM *aItem)=0
virtual bool IsKeepout(const ITEM *aObstacle, const ITEM *aItem, bool *aEnforce)=0
virtual bool DpNetPair(const ITEM *aItem, NET_HANDLE &aNetP, NET_HANDLE &aNetN)=0
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const ITEM *aItemA, const ITEM *aItemB, int aLayer, CONSTRAINT *aConstraint)=0
virtual bool IsInNetTie(const ITEM *aA)=0
virtual NET_HANDLE DpCoupledNet(NET_HANDLE aNet)=0
virtual int DpNetPolarity(NET_HANDLE aNet)=0
virtual void ClearCaches()
virtual wxString NetName(NET_HANDLE aNet)=0
Represent a contiguous set of PCB layers.
static PNS_LAYER_RANGE All()
Handle a list of polygons defining a copper zone.
Push and Shove diff pair dimensions (gap) settings dialog.
const COLLISION_SEARCH_OPTIONS options
std::set< OBSTACLE > & obstacles
COLLISION_SEARCH_CONTEXT(std::set< OBSTACLE > &aObs, const COLLISION_SEARCH_OPTIONS aOpts=COLLISION_SEARCH_OPTIONS())
std::function< bool(const ITEM *)> m_filter
bool m_useClearanceEpsilon
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
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
bool operator==(const OBSTACLE &other) const
ITEM * m_head
Line we search collisions against.
bool operator<(const OBSTACLE &other) const
VECTOR2I m_ipFirst
First intersection between m_head and m_hull.
ITEM * m_item
Item found to be colliding with m_head.