KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PNS::NODE Class Reference

Keep the router "world" - i.e. More...

#include <pns_node.h>

Inheritance diagram for PNS::NODE:
PNS::ITEM_OWNER

Classes

struct  DEFAULT_OBSTACLE_VISITOR
 

Public Types

enum  COLLISION_QUERY_SCOPE { CQS_ALL_RULES = 1 , CQS_IGNORE_HOLE_CLEARANCE = 2 }
 < Supported item types More...
 
typedef std::optional< OBSTACLEOPT_OBSTACLE
 
typedef std::vector< ITEM * > ITEM_VECTOR
 
typedef std::set< OBSTACLEOBSTACLES
 

Public Member Functions

 NODE ()
 
 ~NODE ()
 Return the expected clearance between items a and b. More...
 
int GetClearance (const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true) const
 Return the pre-set worst case clearance between any pair of items. More...
 
int GetMaxClearance () const
 Set the worst-case clearance between any pair of items. More...
 
void SetMaxClearance (int aClearance)
 Assign a clearance resolution function object. More...
 
void SetRuleResolver (RULE_RESOLVER *aFunc)
 
RULE_RESOLVERGetRuleResolver () const
 Return the number of joints. More...
 
int JointCount () const
 Return the number of nodes in the inheritance chain (wrs to the root node). More...
 
int Depth () const
 
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. More...
 
int QueryJoints (const BOX2I &aBox, std::vector< JOINT * > &aJoints, LAYER_RANGE aLayerMask=LAYER_RANGE::All(), int aKindMask=ITEM::ANY_T)
 
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. More...
 
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. More...
 
OPT_OBSTACLE CheckColliding (const ITEM_SET &aSet, int aKindMask=ITEM::ANY_T)
 Check if any item in the set collides with anything else in the world, and if found, returns the obstacle. More...
 
const ITEM_SET HitTest (const VECTOR2I &aPoint) const
 Find all items that contain the point aPoint. More...
 
bool Add (std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
 Add an item to the current node. More...
 
void Add (std::unique_ptr< SOLID > aSolid)
 
void Add (std::unique_ptr< VIA > aVia)
 
bool Add (std::unique_ptr< ARC > aArc, bool aAllowRedundant=false)
 
void Add (LINE &aLine, bool aAllowRedundant=false)
 
void AddEdgeExclusion (std::unique_ptr< SHAPE > aShape)
 
bool QueryEdgeExclusions (const VECTOR2I &aPos) const
 
void Remove (ARC *aArc)
 Remove an item from this branch. More...
 
void Remove (SOLID *aSolid)
 
void Remove (VIA *aVia)
 
void Remove (SEGMENT *aSegment)
 
void Remove (ITEM *aItem)
 
void Remove (LINE &aLine)
 Removes a line from this branch. More...
 
void Replace (ITEM *aOldItem, std::unique_ptr< ITEM > aNewItem)
 Replace an item with another one. More...
 
void Replace (LINE &aOldLine, LINE &aNewLine)
 
NODEBranch ()
 Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs to the root. More...
 
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. More...
 
void Dump (bool aLong=false)
 
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. More...
 
void Commit (NODE *aNode)
 Apply the changes from a given branch (aNode) to the root branch. More...
 
const JOINTFindJoint (const VECTOR2I &aPos, int aLayer, NET_HANDLE aNet) const
 Search for a joint at a given position, layer and belonging to given net. More...
 
void LockJoint (const VECTOR2I &aPos, const ITEM *aItem, bool aLock)
 
const JOINTFindJoint (const VECTOR2I &aPos, const ITEM *aItem) const
 Search for a joint at a given position, linked to given item. More...
 
int FindLinesBetweenJoints (const JOINT &aA, const JOINT &aB, std::vector< LINE > &aLines)
 Find the joints corresponding to the ends of line aLine. More...
 
void FindLineEnds (const LINE &aLine, JOINT &aA, JOINT &aB)
 Destroy all child nodes. Applicable only to the root node. More...
 
void KillChildren ()
 
void AllItemsInNet (NET_HANDLE aNet, std::set< ITEM * > &aItems, int aKindMask=-1)
 
void ClearRanks (int aMarkerMask=MK_HEAD|MK_VIOLATION)
 
void RemoveByMarker (int aMarker)
 
ITEMFindItemByParent (const BOARD_ITEM *aParent)
 
std::vector< ITEM * > FindItemsByZone (const ZONE *aParent)
 
bool HasChildren () const
 
NODEGetParent () const
 Check if this branch contains an updated version of the m_item from the root branch. More...
 
bool Overrides (ITEM *aItem) const
 
void FixupVirtualVias ()
 
void AddRaw (ITEM *aItem, bool aAllowRedundant=false)
 

Private Types

typedef std::unordered_multimap< JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASHJOINT_MAP
 
typedef JOINT_MAP::value_type TagJointPair
 

Private Member Functions

void add (ITEM *aItem, bool aAllowRedundant=false)
 
 NODE (const NODE &aB)
 nodes are not copyable More...
 
NODEoperator= (const NODE &aB)
 Try to find matching joint and creates a new one if not found. More...
 
JOINTtouchJoint (const VECTOR2I &aPos, const LAYER_RANGE &aLayers, NET_HANDLE aNet)
 Touch a joint and links it to an m_item. More...
 
void linkJoint (const VECTOR2I &aPos, const LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
 Unlink an item from a joint. More...
 
void unlinkJoint (const VECTOR2I &aPos, const LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
 Helpers for adding/removing items. More...
 
void addSolid (SOLID *aSeg)
 
void addSegment (SEGMENT *aSeg)
 
void addVia (VIA *aVia)
 
void addArc (ARC *aVia)
 
void addHole (HOLE *aHole)
 
void removeSolidIndex (SOLID *aSeg)
 
void removeSegmentIndex (SEGMENT *aSeg)
 
void removeViaIndex (VIA *aVia)
 
void removeArcIndex (ARC *aVia)
 
void doRemove (ITEM *aItem)
 
void unlinkParent ()
 
void releaseChildren ()
 
void releaseGarbage ()
 
void rebuildJoint (const JOINT *aJoint, const ITEM *aItem)
 
bool isRoot () const
 
SEGMENTfindRedundantSegment (const VECTOR2I &A, const VECTOR2I &B, const LAYER_RANGE &lr, NET_HANDLE aNet)
 
SEGMENTfindRedundantSegment (SEGMENT *aSeg)
 
ARCfindRedundantArc (const VECTOR2I &A, const VECTOR2I &B, const LAYER_RANGE &lr, NET_HANDLE aNet)
 
ARCfindRedundantArc (ARC *aSeg)
 Scan the joint map, forming a line starting from segment (current). More...
 
void followLine (LINKED_ITEM *aCurrent, bool aScanDirection, int &aPos, int aLimit, VECTOR2I *aCorners, LINKED_ITEM **aSegments, bool *aArcReversed, bool &aGuardHit, bool aStopAtLockedJoints, bool aFollowLockedSegments)
 

Private Attributes

JOINT_MAP m_joints
 hash table with the joints, linking the items. More...
 
NODEm_parent
 node this node was branched from More...
 
NODEm_root
 root node of the whole hierarchy More...
 
std::set< NODE * > m_children
 list of nodes branched from this one More...
 
std::unordered_set< ITEM * > m_override
 hash of root's items that have been changed in this node More...
 
int m_maxClearance
 worst case item-item clearance More...
 
RULE_RESOLVERm_ruleResolver
 Design rules resolver. More...
 
INDEXm_index
 Geometric/Net index of the items. More...
 
int m_depth
 depth of the node (number of parent nodes in the inheritance chain) More...
 
std::vector< std::unique_ptr< SHAPE > > m_edgeExclusions
 
std::unordered_set< ITEM * > m_garbageItems
 

Detailed Description

Keep the router "world" - i.e.

all the tracks, vias, solids in a hierarchical and indexed way.

Features:

  • spatial-indexed container for PCB item shapes.
  • collision search & clearance checking.
  • assembly of lines connecting joints, finding loops and unique paths.
  • lightweight cloning/branching (for recursive optimization and shove springback).

Definition at line 206 of file pns_node.h.

Member Typedef Documentation

◆ ITEM_VECTOR

typedef std::vector<ITEM*> PNS::NODE::ITEM_VECTOR

Definition at line 218 of file pns_node.h.

◆ JOINT_MAP

typedef std::unordered_multimap<JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASH> PNS::NODE::JOINT_MAP
private

Definition at line 524 of file pns_node.h.

◆ OBSTACLES

typedef std::set<OBSTACLE> PNS::NODE::OBSTACLES

Definition at line 219 of file pns_node.h.

◆ OPT_OBSTACLE

typedef std::optional<OBSTACLE> PNS::NODE::OPT_OBSTACLE

Definition at line 217 of file pns_node.h.

◆ TagJointPair

typedef JOINT_MAP::value_type PNS::NODE::TagJointPair
private

Definition at line 525 of file pns_node.h.

Member Enumeration Documentation

◆ COLLISION_QUERY_SCOPE

< Supported item types

Enumerator
CQS_ALL_RULES 

check all rules

CQS_IGNORE_HOLE_CLEARANCE 

check everything except hole2hole / hole2copper

Definition at line 211 of file pns_node.h.

Constructor & Destructor Documentation

◆ NODE() [1/2]

PNS::NODE::NODE ( )

Definition at line 55 of file pns_node.cpp.

References m_depth, m_index, m_maxClearance, m_parent, m_root, and m_ruleResolver.

Referenced by Branch().

◆ ~NODE()

PNS::NODE::~NODE ( )

◆ NODE() [2/2]

PNS::NODE::NODE ( const NODE aB)
private

nodes are not copyable

Member Function Documentation

◆ add()

void PNS::NODE::add ( ITEM aItem,
bool  aAllowRedundant = false 
)
private

◆ Add() [1/5]

◆ Add() [2/5]

bool PNS::NODE::Add ( std::unique_ptr< ARC aArc,
bool  aAllowRedundant = false 
)

Definition at line 686 of file pns_node.cpp.

References addArc(), findRedundantArc(), SHAPE_ARC::GetP0(), and SHAPE_ARC::GetP1().

◆ Add() [3/5]

◆ Add() [4/5]

void PNS::NODE::Add ( std::unique_ptr< SOLID aSolid)

Definition at line 528 of file pns_node.cpp.

References addSolid().

◆ Add() [5/5]

void PNS::NODE::Add ( std::unique_ptr< VIA aVia)

Definition at line 563 of file pns_node.cpp.

References addVia().

◆ addArc()

void PNS::NODE::addArc ( ARC aVia)
private

◆ AddEdgeExclusion()

void PNS::NODE::AddEdgeExclusion ( std::unique_ptr< SHAPE aShape)

Definition at line 701 of file pns_node.cpp.

References m_edgeExclusions.

Referenced by PNS_KICAD_IFACE_BASE::SyncWorld().

◆ addHole()

void PNS::NODE::addHole ( HOLE aHole)
private

Definition at line 553 of file pns_node.cpp.

References PNS::INDEX::Add(), m_index, and PNS::OWNABLE_ITEM::SetOwner().

Referenced by addSolid(), and addVia().

◆ AddRaw()

void PNS::NODE::AddRaw ( ITEM aItem,
bool  aAllowRedundant = false 
)
inline

Definition at line 463 of file pns_node.h.

References add().

◆ addSegment()

void PNS::NODE::addSegment ( SEGMENT aSeg)
private

◆ addSolid()

◆ addVia()

◆ AllItemsInNet()

void PNS::NODE::AllItemsInNet ( NET_HANDLE  aNet,
std::set< ITEM * > &  aItems,
int  aKindMask = -1 
)

◆ AssembleLine()

const LINE PNS::NODE::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.

Parameters
aSegthe initial segment.
aOriginSegmentIndexindex of aSeg in the resulting line.
aStopAtLockedJointswill terminate the line at the first locked joint encountered
aFollowLockedSegmentswill consider a joint between a locked segment and an unlocked segment of the same width as a trivial joint.
Returns
the line Print the contents and joints structure.

Definition at line 1008 of file pns_node.cpp.

References SHAPE_LINE_CHAIN::Append(), PNS::ITEM::ARC_T, SHAPE_LINE_CHAIN::ArcIndex(), SHAPE_LINE_CHAIN::CPoint(), followLine(), PNS::ITEM::Kind(), PNS::ITEM::Layers(), PNS::LINE::Line(), PNS::LINK_HOLDER::Link(), PNS::ITEM::Net(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_ARC::Reversed(), PNS::ITEM::SEGMENT_T, SHAPE_LINE_CHAIN::SegmentCount(), PNS::LINE::SegmentCount(), PNS::ITEM::SetLayers(), PNS::ITEM::SetNet(), PNS::OWNABLE_ITEM::SetOwner(), PNS::LINE::SetWidth(), PNS::ARC::Shape(), SHAPE_LINE_CHAIN::Simplify(), and PNS::LINKED_ITEM::Width().

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::SHOVE::assembleLine(), PNS::TOPOLOGY::AssembleTrivialPath(), Dump(), FindLinesBetweenJoints(), PNS::DRAGGER::findViaFanoutByHandle(), PNS::TOPOLOGY::followTrivialPath(), getPNSLine(), PCB_TUNING_PATTERN::initBaseLine(), PNS::LINE_PLACER::removeLoops(), PNS::TOPOLOGY::SimplifyLine(), PNS::LINE_PLACER::simplifyNewLine(), PNS::MEANDER_PLACER::Start(), PNS::MEANDER_SKEW_PLACER::Start(), PNS::COMPONENT_DRAGGER::Start(), PNS::DRAGGER::startDragArc(), and PNS::DRAGGER::startDragSegment().

◆ Branch()

◆ CheckColliding() [1/2]

NODE::OPT_OBSTACLE PNS::NODE::CheckColliding ( const ITEM aItem,
int  aKindMask = ITEM::ANY_T 
)

◆ CheckColliding() [2/2]

NODE::OPT_OBSTACLE PNS::NODE::CheckColliding ( const ITEM_SET aSet,
int  aKindMask = ITEM::ANY_T 
)

Check if any item in the set collides with anything else in the world, and if found, returns the obstacle.

Parameters
aSetset of items to find collisions with.
aKindMaskmask of obstacle types to take into account.
Returns
the obstacle, if found, otherwise empty.

Definition at line 396 of file pns_node.cpp.

References CheckColliding(), and PNS::ITEM_SET::CItems().

◆ ClearRanks()

void PNS::NODE::ClearRanks ( int  aMarkerMask = MK_HEAD | MK_VIOLATION)

◆ Commit()

void PNS::NODE::Commit ( NODE aNode)

Apply the changes from a given branch (aNode) to the root branch.

Calling on a non-root branch will fail. Calling commit also kills all children nodes of the root branch.

Parameters
aNodenode to commit changes from.

Definition at line 1465 of file pns_node.cpp.

References add(), PNS::ITEM::HasHole(), PNS::ITEM::Hole(), isRoot(), m_index, m_override, releaseChildren(), releaseGarbage(), Remove(), PNS::OWNABLE_ITEM::SetOwner(), PNS::ITEM::SetRank(), and PNS::ITEM::Unmark().

◆ Depth()

int PNS::NODE::Depth ( ) const
inline

Definition at line 257 of file pns_node.h.

References m_depth.

Referenced by PNS::LINE_PLACER::Move().

◆ doRemove()

void PNS::NODE::doRemove ( ITEM aItem)
private

◆ Dump()

void PNS::NODE::Dump ( bool  aLong = false)

◆ FindItemByParent()

◆ FindItemsByZone()

std::vector< ITEM * > PNS::NODE::FindItemsByZone ( const ZONE aParent)

Definition at line 1678 of file pns_node.cpp.

References m_index.

Referenced by ROUTER_TOOL::InlineDrag().

◆ FindJoint() [1/2]

const JOINT * PNS::NODE::FindJoint ( const VECTOR2I aPos,
const ITEM aItem 
) const
inline

Search for a joint at a given position, linked to given item.

Returns
the joint, if found, otherwise empty. Find all lines between a pair of joints. Used by the loop removal procedure.

Definition at line 421 of file pns_node.h.

References FindJoint(), PNS::ITEM::Layers(), PNS::ITEM::Net(), and LAYER_RANGE::Start().

◆ FindJoint() [2/2]

◆ FindLineEnds()

void PNS::NODE::FindLineEnds ( const LINE aLine,
JOINT aA,
JOINT aB 
)

Destroy all child nodes. Applicable only to the root node.

Definition at line 1094 of file pns_node.cpp.

References PNS::LINE::CPoint(), and FindJoint().

Referenced by FindLinesBetweenJoints(), PNS::MEANDER_PLACER_BASE::GetTotalPadToDieLength(), and PNS::LINE_PLACER::removeLoops().

◆ FindLinesBetweenJoints()

int PNS::NODE::FindLinesBetweenJoints ( const JOINT aA,
const JOINT aB,
std::vector< LINE > &  aLines 
)

◆ findRedundantArc() [1/2]

ARC * PNS::NODE::findRedundantArc ( ARC aSeg)
private

Scan the joint map, forming a line starting from segment (current).

Definition at line 1614 of file pns_node.cpp.

References PNS::ARC::Anchor(), findRedundantArc(), PNS::ITEM::Layers(), and PNS::ITEM::Net().

◆ findRedundantArc() [2/2]

ARC * PNS::NODE::findRedundantArc ( const VECTOR2I A,
const VECTOR2I B,
const LAYER_RANGE lr,
NET_HANDLE  aNet 
)
private

◆ findRedundantSegment() [1/2]

SEGMENT * PNS::NODE::findRedundantSegment ( const VECTOR2I A,
const VECTOR2I B,
const LAYER_RANGE lr,
NET_HANDLE  aNet 
)
private

◆ findRedundantSegment() [2/2]

SEGMENT * PNS::NODE::findRedundantSegment ( SEGMENT aSeg)
private

◆ FixupVirtualVias()

◆ followLine()

void PNS::NODE::followLine ( LINKED_ITEM aCurrent,
bool  aScanDirection,
int &  aPos,
int  aLimit,
VECTOR2I aCorners,
LINKED_ITEM **  aSegments,
bool *  aArcReversed,
bool &  aGuardHit,
bool  aStopAtLockedJoints,
bool  aFollowLockedSegments 
)
private

◆ GetClearance()

int PNS::NODE::GetClearance ( const ITEM aA,
const ITEM aB,
bool  aUseClearanceEpsilon = true 
) const

◆ GetMaxClearance()

int PNS::NODE::GetMaxClearance ( ) const
inline

Set the worst-case clearance between any pair of items.

Definition at line 228 of file pns_node.h.

References m_maxClearance.

◆ GetParent()

NODE * PNS::NODE::GetParent ( ) const
inline

Check if this branch contains an updated version of the m_item from the root branch.

Definition at line 450 of file pns_node.h.

References m_parent.

◆ GetRuleResolver()

RULE_RESOLVER * PNS::NODE::GetRuleResolver ( ) const
inline

◆ GetUpdatedItems()

void PNS::NODE::GetUpdatedItems ( ITEM_VECTOR aRemoved,
ITEM_VECTOR aAdded 
)

Return the list of items removed and added in this branch with respect to the root branch.

Parameters
aRemovedremoved items.
aAddedadded items.

Definition at line 1410 of file pns_node.cpp.

References isRoot(), m_index, m_override, and PNS::INDEX::Size().

Referenced by PNS::ROUTER::CommitRouting(), PNS::LINE_PLACER::FixRoute(), PNS::ROUTER::GetUpdatedItems(), PNS_LOG_PLAYER::ReplayLog(), PNS::LINE_PLACER::simplifyNewLine(), and PNS::ROUTER::updateView().

◆ HasChildren()

bool PNS::NODE::HasChildren ( ) const
inline

Definition at line 445 of file pns_node.h.

References m_children.

◆ HitTest()

const ITEM_SET PNS::NODE::HitTest ( const VECTOR2I aPoint) const

Find all items that contain the point aPoint.

Parameters
aPointthe point.
Returns
the items.

Definition at line 483 of file pns_node.cpp.

References PNS::ITEM_SET::Add(), isRoot(), PNS::ITEM_SET::Items(), m_index, m_maxClearance, m_root, Overrides(), PNS::INDEX::Query(), and PNS::OBSTACLE_VISITOR::SetWorld().

Referenced by PNS::ROUTER::QueryHoverItems().

◆ isRoot()

bool PNS::NODE::isRoot ( ) const
inlineprivate

◆ JointCount()

int PNS::NODE::JointCount ( ) const
inline

Return the number of nodes in the inheritance chain (wrs to the root node).

Definition at line 251 of file pns_node.h.

References m_joints.

Referenced by PNS::SHOVE::shoveMainLoop().

◆ KillChildren()

◆ linkJoint()

void PNS::NODE::linkJoint ( const VECTOR2I aPos,
const LAYER_RANGE aLayers,
NET_HANDLE  aNet,
ITEM aWhere 
)
private

Unlink an item from a joint.

Definition at line 1304 of file pns_node.cpp.

References PNS::JOINT::Link(), and touchJoint().

Referenced by addArc(), addSegment(), addSolid(), addVia(), and rebuildJoint().

◆ LockJoint()

void PNS::NODE::LockJoint ( const VECTOR2I aPos,
const ITEM aItem,
bool  aLock 
)

Definition at line 1236 of file pns_node.cpp.

References PNS::ITEM::Layers(), PNS::JOINT::Lock(), PNS::ITEM::Net(), and touchJoint().

Referenced by PNS::SHOVE::ShoveLines().

◆ NearestObstacle()

NODE::OPT_OBSTACLE PNS::NODE::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.

Parameters
aLinethe item to find collisions with
aKindMaskmask of obstacle types to take into account
aRestrictedSetis an optional set of items that should be considered as obstacles
Returns
the obstacle, if found, otherwise empty.

Definition at line 283 of file pns_node.cpp.

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::BBox(), SHAPE_LINE_CHAIN::Clear(), PNS::RULE_RESOLVER::ClearanceEpsilon(), PNS::LINE::CLine(), SHAPE_LINE_CHAIN::CSegment(), PNS::LINE::EndsWithVia(), BOX2< Vec >::GetBottom(), GetClearance(), PNS::ROUTING_SETTINGS::GetCornerMode(), PNS::ROUTER_IFACE::GetDebugDecorator(), PNS::ROUTER::GetInstance(), PNS::ROUTER::GetInterface(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), GetRuleResolver(), BOX2< Vec >::GetTop(), PNS::HullIntersection(), SHAPE_LINE_CHAIN::INTERSECTION::index_their, PNS::ITEM::Layer(), PNS::OBSTACLE::m_distFirst, PNS::OBSTACLE::m_head, PNS::OBSTACLE::m_ipFirst, PNS::OBSTACLE::m_item, PNS::OBSTACLE::m_maxFanoutWidth, PNS::COLLISION_SEARCH_OPTIONS::m_restrictedSet, PNS::COLLISION_SEARCH_OPTIONS::m_useClearanceEpsilon, DIRECTION_45::MITERED_90, SHAPE_LINE_CHAIN::INTERSECTION::p, SHAPE_LINE_CHAIN::PathLength(), QueryColliding(), DIRECTION_45::ROUNDED_90, PNS::ROUTER::Settings(), via, PNS::LINE::Via(), and PNS::LINE::Width().

Referenced by PNS::LINE::ClipToNearestObstacle(), PNS::WALKAROUND::nearestObstacle(), PNS::LINE_PLACER::rhMarkObstacles(), and PNS::SHOVE::shoveIteration().

◆ operator=()

NODE & PNS::NODE::operator= ( const NODE aB)
private

Try to find matching joint and creates a new one if not found.

◆ Overrides()

bool PNS::NODE::Overrides ( ITEM aItem) const
inline

Definition at line 456 of file pns_node.h.

References m_override.

Referenced by AllItemsInNet(), HitTest(), QueryJoints(), and PNS::OBSTACLE_VISITOR::visit().

◆ QueryColliding()

int PNS::NODE::QueryColliding ( const ITEM aItem,
NODE::OBSTACLES aObstacles,
const COLLISION_SEARCH_OPTIONS aOpts = COLLISION_SEARCH_OPTIONS() 
) const

Find items colliding (closer than clearance) with the item aItem.

Parameters
aItemitem to check collisions against
aObstaclesset of colliding objects found
aKindMaskmask of obstacle types to take into account
aLimitCountstop looking for collisions after finding this number of colliding items
Returns
number of obstacles found

By default, virtual items cannot collide

Definition at line 252 of file pns_node.cpp.

References isRoot(), PNS::ITEM::IsVirtual(), m_index, PNS::COLLISION_SEARCH_OPTIONS::m_limitCount, m_maxClearance, m_root, PNS::COLLISION_SEARCH_CONTEXT::obstacles, PNS::INDEX::Query(), and PNS::OBSTACLE_VISITOR::SetWorld().

Referenced by PNS::TOPOLOGY::AssembleCluster(), CheckColliding(), PNS::ROUTER::markViolations(), NearestObstacle(), PNS::ROUTER::QueryHoverItems(), and PCB_TUNING_PATTERN::recoverBaseline().

◆ QueryEdgeExclusions()

bool PNS::NODE::QueryEdgeExclusions ( const VECTOR2I aPos) const

Definition at line 707 of file pns_node.cpp.

References m_edgeExclusions.

Referenced by PNS::ITEM::collideSimple().

◆ QueryJoints()

int PNS::NODE::QueryJoints ( const BOX2I aBox,
std::vector< JOINT * > &  aJoints,
LAYER_RANGE  aLayerMask = LAYER_RANGE::All(),
int  aKindMask = ITEM::ANY_T 
)

◆ rebuildJoint()

void PNS::NODE::rebuildJoint ( const JOINT aJoint,
const ITEM aItem 
)
private

◆ releaseChildren()

void PNS::NODE::releaseChildren ( )
private

Definition at line 1429 of file pns_node.cpp.

References m_children.

Referenced by Commit(), and KillChildren().

◆ releaseGarbage()

void PNS::NODE::releaseGarbage ( )
private

Definition at line 1442 of file pns_node.cpp.

References PNS::RULE_RESOLVER::ClearCacheForItems(), isRoot(), m_garbageItems, and m_ruleResolver.

Referenced by Commit(), and ~NODE().

◆ Remove() [1/6]

◆ Remove() [2/6]

◆ Remove() [3/6]

void PNS::NODE::Remove ( LINE aLine)

Removes a line from this branch.

Parameters
aLineitem to remove

Definition at line 941 of file pns_node.cpp.

References PNS::ITEM::ARC_T, PNS::LINK_HOLDER::ClearLinks(), PNS::LINK_HOLDER::Links(), Remove(), PNS::ITEM::SEGMENT_T, and PNS::OWNABLE_ITEM::SetOwner().

◆ Remove() [4/6]

void PNS::NODE::Remove ( SEGMENT aSegment)

Definition at line 871 of file pns_node.cpp.

References doRemove(), and removeSegmentIndex().

◆ Remove() [5/6]

void PNS::NODE::Remove ( SOLID aSolid)

Definition at line 852 of file pns_node.cpp.

References doRemove(), and removeSolidIndex().

◆ Remove() [6/6]

void PNS::NODE::Remove ( VIA aVia)

◆ removeArcIndex()

void PNS::NODE::removeArcIndex ( ARC aVia)
private

Definition at line 766 of file pns_node.cpp.

References PNS::ARC::Anchor(), PNS::ITEM::Layers(), PNS::ITEM::Net(), and unlinkJoint().

Referenced by Remove().

◆ RemoveByMarker()

void PNS::NODE::RemoveByMarker ( int  aMarker)

Definition at line 1535 of file pns_node.cpp.

References m_index, and Remove().

Referenced by PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ removeSegmentIndex()

void PNS::NODE::removeSegmentIndex ( SEGMENT aSeg)
private

Definition at line 759 of file pns_node.cpp.

References SEG::A, SEG::B, PNS::ITEM::Layers(), PNS::ITEM::Net(), PNS::SEGMENT::Seg(), and unlinkJoint().

Referenced by Remove().

◆ removeSolidIndex()

void PNS::NODE::removeSolidIndex ( SOLID aSeg)
private

◆ removeViaIndex()

void PNS::NODE::removeViaIndex ( VIA aVia)
private

◆ Replace() [1/2]

void PNS::NODE::Replace ( ITEM aOldItem,
std::unique_ptr< ITEM aNewItem 
)

Replace an item with another one.

Parameters
aOldItemitem to be removed
aNewItemitem add instead

Definition at line 838 of file pns_node.cpp.

References add(), and Remove().

Referenced by PNS::SHOVE::replaceItems(), and PNS::SHOVE::replaceLine().

◆ Replace() [2/2]

void PNS::NODE::Replace ( LINE aOldLine,
LINE aNewLine 
)

Definition at line 845 of file pns_node.cpp.

References Add(), and Remove().

◆ SetMaxClearance()

void PNS::NODE::SetMaxClearance ( int  aClearance)
inline

Assign a clearance resolution function object.

Definition at line 234 of file pns_node.h.

References m_maxClearance.

Referenced by PNS_KICAD_IFACE_BASE::SyncWorld().

◆ SetRuleResolver()

void PNS::NODE::SetRuleResolver ( RULE_RESOLVER aFunc)
inline

Definition at line 240 of file pns_node.h.

References m_ruleResolver.

Referenced by PNS_KICAD_IFACE_BASE::SyncWorld().

◆ touchJoint()

JOINT & PNS::NODE::touchJoint ( const VECTOR2I aPos,
const LAYER_RANGE aLayers,
NET_HANDLE  aNet 
)
private

Touch a joint and links it to an m_item.

Definition at line 1243 of file pns_node.cpp.

References isRoot(), m_joints, m_root, PNS::JOINT::Merge(), PNS::JOINT::HASH_TAG::net, LAYER_RANGE::Overlaps(), and PNS::JOINT::HASH_TAG::pos.

Referenced by linkJoint(), LockJoint(), and unlinkJoint().

◆ unlinkJoint()

void PNS::NODE::unlinkJoint ( const VECTOR2I aPos,
const LAYER_RANGE aLayers,
NET_HANDLE  aNet,
ITEM aWhere 
)
private

Helpers for adding/removing items.

Definition at line 1313 of file pns_node.cpp.

References touchJoint(), and PNS::JOINT::Unlink().

Referenced by removeArcIndex(), and removeSegmentIndex().

◆ unlinkParent()

void PNS::NODE::unlinkParent ( )
private

Definition at line 179 of file pns_node.cpp.

References isRoot(), m_children, and m_parent.

Referenced by ~NODE().

Member Data Documentation

◆ m_children

std::set<NODE*> PNS::NODE::m_children
private

list of nodes branched from this one

Definition at line 532 of file pns_node.h.

Referenced by Branch(), HasChildren(), releaseChildren(), unlinkParent(), and ~NODE().

◆ m_depth

int PNS::NODE::m_depth
private

depth of the node (number of parent nodes in the inheritance chain)

Definition at line 540 of file pns_node.h.

Referenced by Branch(), Depth(), and NODE().

◆ m_edgeExclusions

std::vector< std::unique_ptr<SHAPE> > PNS::NODE::m_edgeExclusions
private

Definition at line 543 of file pns_node.h.

Referenced by AddEdgeExclusion(), and QueryEdgeExclusions().

◆ m_garbageItems

std::unordered_set<ITEM*> PNS::NODE::m_garbageItems
private

Definition at line 545 of file pns_node.h.

Referenced by doRemove(), and releaseGarbage().

◆ m_index

◆ m_joints

JOINT_MAP PNS::NODE::m_joints
private

hash table with the joints, linking the items.

Joints are hashed by their position, layer set and net.

Definition at line 527 of file pns_node.h.

Referenced by Branch(), Dump(), FindJoint(), FixupVirtualVias(), JointCount(), QueryJoints(), rebuildJoint(), touchJoint(), and ~NODE().

◆ m_maxClearance

int PNS::NODE::m_maxClearance
private

worst case item-item clearance

Definition at line 537 of file pns_node.h.

Referenced by Branch(), GetMaxClearance(), HitTest(), NODE(), QueryColliding(), and SetMaxClearance().

◆ m_override

std::unordered_set<ITEM*> PNS::NODE::m_override
private

hash of root's items that have been changed in this node

Definition at line 534 of file pns_node.h.

Referenced by Branch(), Commit(), doRemove(), GetUpdatedItems(), and Overrides().

◆ m_parent

NODE* PNS::NODE::m_parent
private

node this node was branched from

Definition at line 530 of file pns_node.h.

Referenced by Branch(), GetParent(), isRoot(), NODE(), and unlinkParent().

◆ m_root

NODE* PNS::NODE::m_root
private

root node of the whole hierarchy

Definition at line 531 of file pns_node.h.

Referenced by AllItemsInNet(), Branch(), doRemove(), Dump(), FindJoint(), HitTest(), NODE(), QueryColliding(), QueryJoints(), and touchJoint().

◆ m_ruleResolver

RULE_RESOLVER* PNS::NODE::m_ruleResolver
private

Design rules resolver.

Definition at line 538 of file pns_node.h.

Referenced by Branch(), GetClearance(), GetRuleResolver(), NODE(), releaseGarbage(), SetRuleResolver(), and ~NODE().


The documentation for this class was generated from the following files: