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.
 
int GetClearance (const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true) const
 Return the pre-set worst case clearance between any pair of items.
 
int GetMaxClearance () const
 Set the worst-case clearance between any pair of items.
 
void SetMaxClearance (int aClearance)
 Assign a clearance resolution function object.
 
void SetRuleResolver (RULE_RESOLVER *aFunc)
 
RULE_RESOLVERGetRuleResolver () const
 Return the number of joints.
 
int JointCount () const
 Return the number of nodes in the inheritance chain (wrs to the root node).
 
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.
 
int QueryJoints (const BOX2I &aBox, std::vector< JOINT * > &aJoints, PNS_LAYER_RANGE aLayerMask=PNS_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.
 
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.
 
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.
 
OPT_OBSTACLE CheckColliding (const ITEM *aItem, const COLLISION_SEARCH_OPTIONS &aOpts)
 Check if the item collides with anything else in the world, and if found, returns the obstacle.
 
const ITEM_SET HitTest (const VECTOR2I &aPoint) const
 Find all items that contain the point aPoint.
 
bool Add (std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
 Add an item to the current node.
 
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.
 
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.
 
void Replace (ITEM *aOldItem, std::unique_ptr< ITEM > aNewItem)
 Replace an item with another one.
 
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.
 
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.
 
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.
 
void Commit (NODE *aNode)
 Apply the changes from a given branch (aNode) to the root branch.
 
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.
 
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.
 
int FindLinesBetweenJoints (const JOINT &aA, const JOINT &aB, std::vector< LINE > &aLines)
 Find the joints corresponding to the ends of line aLine.
 
void FindLineEnds (const LINE &aLine, JOINT &aA, JOINT &aB)
 Destroy all child nodes. Applicable only to the root node.
 
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.
 
bool Overrides (ITEM *aItem) const
 
void FixupVirtualVias ()
 
void AddRaw (ITEM *aItem, bool aAllowRedundant=false)
 
const std::unordered_set< ITEM * > & GetOverrides () const
 
VIAFindViaByHandle (const VIA_HANDLE &handle) const
 

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
 
NODEoperator= (const NODE &aB)
 Try to find matching joint and creates a new one if not found.
 
JOINTtouchJoint (const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet)
 Touch a joint and links it to an m_item.
 
void linkJoint (const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
 Unlink an item from a joint.
 
void unlinkJoint (const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
 Helpers for adding/removing items.
 
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 PNS_LAYER_RANGE &lr, NET_HANDLE aNet)
 
SEGMENTfindRedundantSegment (SEGMENT *aSeg)
 
ARCfindRedundantArc (const VECTOR2I &A, const VECTOR2I &B, const PNS_LAYER_RANGE &lr, NET_HANDLE aNet)
 
ARCfindRedundantArc (ARC *aSeg)
 Scan the joint map, forming a line starting from segment (current).
 
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.
 
NODEm_parent
 node this node was branched from
 
NODEm_root
 root node of the whole hierarchy
 
std::set< NODE * > m_children
 list of nodes branched from this one
 
std::unordered_set< ITEM * > m_override
 hash of root's items that have been changed in this node
 
int m_maxClearance
 worst case item-item clearance
 
RULE_RESOLVERm_ruleResolver
 Design rules resolver.
 
INDEXm_index
 Geometric/Net index of the items.
 
int m_depth
 depth of the node (number of parent nodes in the inheritance chain)
 
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 230 of file pns_node.h.

Member Typedef Documentation

◆ ITEM_VECTOR

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

Definition at line 242 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 564 of file pns_node.h.

◆ OBSTACLES

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

Definition at line 243 of file pns_node.h.

◆ OPT_OBSTACLE

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

Definition at line 241 of file pns_node.h.

◆ TagJointPair

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

Definition at line 565 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 235 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 694 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 535 of file pns_node.cpp.

References addSolid().

◆ Add() [5/5]

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

Definition at line 570 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 709 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 560 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 496 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 1044 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_LINE_CHAIN::RemoveDuplicatePoints(), 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(), and PNS::LINKED_ITEM::Width().

Referenced by PNS::TOPOLOGY::AssembleCluster(), 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::MULTI_DRAGGER::Start(), PNS::DRAGGER::startDragArc(), and PNS::DRAGGER::startDragSegment().

◆ Branch()

◆ CheckColliding() [1/3]

NODE::OPT_OBSTACLE PNS::NODE::CheckColliding ( const ITEM aItem,
const COLLISION_SEARCH_OPTIONS aOpts 
)

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

Parameters
aItemthe item to find collisions with
aOptsoptions for the search
Returns
the obstacle, if found, otherwise empty.

Definition at line 420 of file pns_node.cpp.

References PNS::LINE::CLine(), SHAPE_LINE_CHAIN::CSegment(), PNS::LINE::EndsWithVia(), PNS::ITEM::Kind(), PNS::ITEM::LINE_T, QueryColliding(), SHAPE_LINE_CHAIN::SegmentCount(), and PNS::LINE::Via().

◆ CheckColliding() [2/3]

◆ CheckColliding() [3/3]

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)

Definition at line 1558 of file pns_node.cpp.

References m_index.

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

◆ 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 1498 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()

◆ 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 1712 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 454 of file pns_node.h.

References FindJoint(), PNS::ITEM::Layers(), PNS::ITEM::Net(), and PNS_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 1130 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 1647 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 PNS_LAYER_RANGE lr,
NET_HANDLE  aNet 
)
private

◆ findRedundantSegment() [1/2]

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

◆ findRedundantSegment() [2/2]

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

◆ FindViaByHandle()

◆ 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 252 of file pns_node.h.

References m_maxClearance.

◆ GetOverrides()

const std::unordered_set< ITEM * > & PNS::NODE::GetOverrides ( ) const
inline

Definition at line 501 of file pns_node.h.

References m_override.

◆ 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 483 of file pns_node.h.

References m_parent.

Referenced by PNS::DRAGGER::Drag().

◆ 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 1443 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::nodeStats(), PNS::SHOVE::pruneRootLines(), PNS_LOG_PLAYER::ReplayLog(), PNS::LINE_PLACER::simplifyNewLine(), and PNS::ROUTER::updateView().

◆ HasChildren()

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

Definition at line 478 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 490 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 275 of file pns_node.h.

References m_joints.

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

◆ KillChildren()

◆ linkJoint()

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

Unlink an item from a joint.

Definition at line 1337 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 1269 of file pns_node.cpp.

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

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

◆ NearestObstacle()

NODE::OPT_OBSTACLE PNS::NODE::NearestObstacle ( const LINE aLine,
const COLLISION_SEARCH_OPTIONS aOpts = COLLISION_SEARCH_OPTIONS() 
)

◆ 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 489 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 255 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 715 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,
PNS_LAYER_RANGE  aLayerMask = PNS_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 1462 of file pns_node.cpp.

References m_children.

Referenced by Commit(), and KillChildren().

◆ releaseGarbage()

void PNS::NODE::releaseGarbage ( )
private

Definition at line 1475 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 969 of file pns_node.cpp.

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

◆ Remove() [4/6]

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

Definition at line 899 of file pns_node.cpp.

References doRemove(), and removeSegmentIndex().

◆ Remove() [5/6]

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

Definition at line 880 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 781 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 1568 of file pns_node.cpp.

References m_index, and Remove().

◆ removeSegmentIndex()

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

Definition at line 774 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 866 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 873 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 258 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 264 of file pns_node.h.

References m_ruleResolver.

Referenced by PNS_KICAD_IFACE_BASE::SyncWorld().

◆ touchJoint()

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

Touch a joint and links it to an m_item.

Definition at line 1276 of file pns_node.cpp.

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

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

◆ unlinkJoint()

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

Helpers for adding/removing items.

Definition at line 1346 of file pns_node.cpp.

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

Referenced by rebuildJoint(), 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 572 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 580 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 583 of file pns_node.h.

Referenced by AddEdgeExclusion(), and QueryEdgeExclusions().

◆ m_garbageItems

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

Definition at line 585 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 567 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 577 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 574 of file pns_node.h.

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

◆ m_parent

NODE* PNS::NODE::m_parent
private

node this node was branched from

Definition at line 570 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 571 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 578 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: