KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_node.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef __PNS_NODE_H
24#define __PNS_NODE_H
25
26#include <vector>
27#include <list>
28#include <set>
29#include <core/minoptmax.h>
30
33
34#include "pns_item.h"
35#include "pns_joint.h"
36#include "pns_itemset.h"
37
38class ZONE;
39namespace PNS {
40
41class ARC;
42class SEGMENT;
43class LINE;
44class SOLID;
45class VIA;
46class INDEX;
47class ROUTER;
48class NODE;
49
50
67
75
76
81
92
93
98{
99 ITEM* m_head = nullptr;
100 ITEM* m_item = nullptr;
106
107 bool operator==(const OBSTACLE& other) const
108 {
109 return m_head == other.m_head && m_item == other.m_item;
110 }
111
112 bool operator<(const OBSTACLE& other) const
113 {
114 if( (uintptr_t)m_head < (uintptr_t)other.m_head )
115 return true;
116 else if ( m_head == other.m_head )
117 return (uintptr_t)m_item < (uintptr_t)other.m_item;
118 return false;
119 }
120};
121
122typedef std::function<bool(const ITEM*, const ITEM*)> COLLISION_FILTER_FUNC;
123typedef std::function<int(const ITEM*, const ITEM*, CLEARANCE_ASPECT)> CLEARANCE_OVERRIDE_FUNC;
124
126{
127 return [ aFixedValue ] ( const ITEM*, const ITEM*, CLEARANCE_ASPECT ) -> int
128 {
129 return aFixedValue;
130 };
131}
132
134{
136 int m_limitCount = -1;
137 int m_kindMask = -1;
141
144
145 int m_layer = -1;
146
147 void SetFixedClearanceOverride( int aClearance )
148 {
150 }
151
152private:
153
154};
155
156
158{
159 COLLISION_SEARCH_CONTEXT( std::set<OBSTACLE>& aObs,
161 obstacles( aObs ),
162 options( aOpts )
163 {
164 }
165
166 std::set<OBSTACLE>& obstacles;
168};
169
170
172{
173public:
174 virtual ~RULE_RESOLVER() {}
175
176 virtual int Clearance( const ITEM* aA, const ITEM* aB, bool aUseClearanceEpsilon = true ) = 0;
177 virtual bool HasUserDefinedPhysicalConstraint() { return false; }
178
179 virtual NET_HANDLE DpCoupledNet( NET_HANDLE aNet ) = 0;
180 virtual int DpNetPolarity( NET_HANDLE aNet ) = 0;
181 virtual bool DpNetPair( const ITEM* aItem, NET_HANDLE& aNetP, NET_HANDLE& aNetN ) = 0;
182
183 virtual int NetCode( NET_HANDLE aNet ) = 0;
184 virtual wxString NetName( NET_HANDLE aNet ) = 0;
185
186 virtual bool IsInNetTie( const ITEM* aA ) = 0;
187 virtual bool IsNetTieExclusion( const ITEM* aItem, const VECTOR2I& aCollisionPos,
188 const ITEM* aCollidingItem ) = 0;
189
190 virtual bool IsDrilledHole( const PNS::ITEM* aItem ) = 0;
191 virtual bool IsNonPlatedSlot( const PNS::ITEM* aItem ) = 0;
192
197 virtual bool IsKeepout( const ITEM* aObstacle, const ITEM* aItem, bool* aEnforce ) = 0;
198
199 virtual bool QueryConstraint( CONSTRAINT_TYPE aType, const ITEM* aItemA, const ITEM* aItemB,
200 int aLayer, CONSTRAINT* aConstraint ) = 0;
201
202 virtual void ClearCacheForItems( std::vector<const ITEM*>& aItems ) {}
203 virtual void ClearCaches() {}
204 virtual void ClearTemporaryCaches() {}
205
206 virtual int ClearanceEpsilon() const { return 0; }
207
208 virtual const SHAPE_LINE_CHAIN& HullCache( const ITEM* aItem, int aClearance,
209 int aWalkaroundThickness, int aLayer )
210 {
211 static SHAPE_LINE_CHAIN empty;
212 empty = aItem->Hull( aClearance, aWalkaroundThickness, aLayer );
213 return empty;
214 }
215};
216
217
219{
220public:
221 OBSTACLE_VISITOR( const ITEM* aItem );
222
224 {
225 }
226
227 void SetWorld( const NODE* aNode, const NODE* aOverride = nullptr );
228
229 void SetLayerContext( int aLayer ) { m_layerContext = aLayer; }
230 void ClearLayerContext() { m_layerContext = std::nullopt; }
231
232 virtual bool operator()( ITEM* aCandidate ) = 0;
233
234protected:
235 bool visit( ITEM* aCandidate );
236
237protected:
238 const ITEM* m_item;
239
240 const NODE* m_node;
242 std::optional<int> m_layerContext;
243};
244
245
247{
248public:
249 LAYER_CONTEXT_SETTER( OBSTACLE_VISITOR& aVisitor, int aLayer ) :
250 m_visitor( aVisitor )
251 {
252 m_visitor.SetLayerContext( aLayer );
253 }
254
256 {
257 m_visitor.ClearLayerContext();
258 }
259
260private:
262};
263
273class NODE : public ITEM_OWNER
274{
275public:
276
283
284 typedef std::optional<OBSTACLE> OPT_OBSTACLE;
285 typedef std::vector<ITEM*> ITEM_VECTOR;
286 typedef std::set<OBSTACLE> OBSTACLES;
287
288 NODE();
289 ~NODE();
290
292 int GetClearance( const ITEM* aA, const ITEM* aB, bool aUseClearanceEpsilon = true, const COLLISION_SEARCH_OPTIONS& aOpts = COLLISION_SEARCH_OPTIONS() ) const;
293
295 int GetMaxClearance() const
296 {
297 return m_maxClearance;
298 }
299
304 void BeginBulkAdd();
305
309 void FinalizeBulkAdd();
310
312 void SetMaxClearance( int aClearance )
313 {
314 m_maxClearance = aClearance;
315 }
316
319 {
320 m_ruleResolver = aFunc;
321 }
322
324 {
325 return m_ruleResolver;
326 }
327
329 int JointCount() const
330 {
331 return m_joints.size();
332 }
333
335 int Depth() const
336 {
337 return m_depth;
338 }
339
349 int QueryColliding( const ITEM* aItem, OBSTACLES& aObstacles,
350 const COLLISION_SEARCH_OPTIONS& aOpts = COLLISION_SEARCH_OPTIONS() ) const;
351
352 int QueryJoints( const BOX2I& aBox, std::vector<JOINT*>& aJoints,
353 PNS_LAYER_RANGE aLayerMask = PNS_LAYER_RANGE::All(), int aKindMask = ITEM::ANY_T );
354
363 OPT_OBSTACLE NearestObstacle( const LINE* aLine,
365
374 OPT_OBSTACLE CheckColliding( const ITEM* aItem, int aKindMask = ITEM::ANY_T );
375
376
385 OPT_OBSTACLE CheckColliding( const ITEM_SET& aSet, int aKindMask = ITEM::ANY_T );
386
395 OPT_OBSTACLE CheckColliding( const ITEM* aItem, const COLLISION_SEARCH_OPTIONS& aOpts );
396
403 const ITEM_SET HitTest( const VECTOR2I& aPoint ) const;
404
413 bool Add( std::unique_ptr<SEGMENT> aSegment, bool aAllowRedundant = false );
414 void Add( std::unique_ptr<SOLID> aSolid );
415 void Add( std::unique_ptr<VIA> aVia );
416 bool Add( std::unique_ptr<ARC> aArc, bool aAllowRedundant = false );
417
418 void Add( LINE& aLine, bool aAllowRedundant = false );
419
420 void AddEdgeExclusion( std::unique_ptr<SHAPE> aShape );
421 bool QueryEdgeExclusions( const VECTOR2I& aPos ) const;
422
426 void Remove( ARC* aArc );
427 void Remove( SOLID* aSolid );
428 void Remove( VIA* aVia );
429 void Remove( SEGMENT* aSegment );
430 void Remove( ITEM* aItem );
431
437 void Remove( LINE& aLine );
438
445 void Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem );
446 void Replace( LINE& aOldLine, LINE& aNewLine, bool aAllowRedundantSegments = false );
447
456 NODE* Branch();
457
470 const LINE AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex = nullptr,
471 bool aStopAtLockedJoints = false,
472 bool aFollowLockedSegments = false,
473 bool aAllowSegmentSizeMismatch = true );
474
476 void Dump( bool aLong = false );
477
484 void GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded );
485
494 void Commit( NODE* aNode );
495
501 const JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, NET_HANDLE aNet ) const;
502
503 void LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock );
504
510 const JOINT* FindJoint( const VECTOR2I& aPos, const ITEM* aItem ) const
511 {
512 return FindJoint( aPos, aItem->Layers().Start(), aItem->Net() );
513 }
514
516 int FindLinesBetweenJoints( const JOINT& aA, const JOINT& aB, std::vector<LINE>& aLines );
517
519 void FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB );
520
522 void KillChildren();
523
524 void AllItemsInNet( NET_HANDLE aNet, std::set<ITEM*>& aItems, int aKindMask = -1 );
525
526 void ClearRanks( int aMarkerMask = MK_HEAD | MK_VIOLATION );
527
528 void RemoveByMarker( int aMarker );
529
530 ITEM* FindItemByParent( const BOARD_ITEM* aParent );
531
532 std::vector<ITEM*> FindItemsByParent( const BOARD_ITEM* aParent );
533
534 bool HasChildren() const
535 {
536 return !m_children.empty();
537 }
538
540 {
541 return m_parent;
542 }
543
545 bool Overrides( ITEM* aItem ) const
546 {
547 return m_override.find( aItem ) != m_override.end();
548 }
549
550 void FixupVirtualVias();
551
552 void AddRaw( ITEM* aItem, bool aAllowRedundant = false )
553 {
554 add( aItem, aAllowRedundant );
555 }
556
557 const std::unordered_set<ITEM*>& GetOverrides() const
558 {
559 return m_override;
560 }
561
562 VIA* FindViaByHandle ( const VIA_HANDLE& handle ) const;
563
564private:
565 void add( ITEM* aItem, bool aAllowRedundant = false );
566
568 NODE( const NODE& aB );
569 NODE& operator=( const NODE& aB );
570
572 JOINT& touchJoint( const VECTOR2I& aPos, const PNS_LAYER_RANGE& aLayers, NET_HANDLE aNet );
573
575 void linkJoint( const VECTOR2I& aPos, const PNS_LAYER_RANGE& aLayers, NET_HANDLE aNet,
576 ITEM* aWhere );
577
579 void unlinkJoint( const VECTOR2I& aPos, const PNS_LAYER_RANGE& aLayers, NET_HANDLE aNet,
580 ITEM* aWhere );
581
583 void addSolid( SOLID* aSeg );
584 void addSegment( SEGMENT* aSeg );
585 void addVia( VIA* aVia );
586 void addArc( ARC* aVia );
587 void addHole( HOLE* aHole );
588
589 void removeSolidIndex( SOLID* aSeg );
590 void removeSegmentIndex( SEGMENT* aSeg );
591 void removeViaIndex( VIA* aVia );
592 void removeArcIndex( ARC* aVia );
593
594 void doRemove( ITEM* aItem );
595 void unlinkParent();
596 void releaseChildren();
597 void releaseGarbage();
598 void rebuildJoint( const JOINT* aJoint, const ITEM* aItem );
599
600 bool isRoot() const
601 {
602 return m_parent == nullptr;
603 }
604
605 SEGMENT* findRedundantSegment( const VECTOR2I& A, const VECTOR2I& B, const PNS_LAYER_RANGE& lr,
606 NET_HANDLE aNet );
608
609 ARC* findRedundantArc( const VECTOR2I& A, const VECTOR2I& B, const PNS_LAYER_RANGE& lr,
610 NET_HANDLE aNet );
611 ARC* findRedundantArc( ARC* aSeg );
612
614 void followLine( LINKED_ITEM* aCurrent, bool aScanDirection, int& aPos, int aLimit,
615 VECTOR2I* aCorners, LINKED_ITEM** aSegments, bool* aArcReversed,
616 bool& aGuardHit, bool aStopAtLockedJoints, bool aFollowLockedSegments,
617 bool aAllowSegmentSizeMismatch );
618
619private:
620 struct DEFAULT_OBSTACLE_VISITOR;
621 typedef std::unordered_multimap<JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASH> JOINT_MAP;
622 typedef JOINT_MAP::value_type TagJointPair;
623
626
629 std::set<NODE*> m_children;
630
631 std::unordered_set<ITEM*> m_override;
633
639
640 std::vector< std::unique_ptr<SHAPE> > m_edgeExclusions;
641
642 std::unordered_set<ITEM*> m_garbageItems;
643};
644
645}
646
647#endif
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
INDEX.
Definition pns_index.h:47
Base class for PNS router board items.
Definition pns_item.h:98
const PNS_LAYER_RANGE & Layers() const
Definition pns_item.h:212
virtual NET_HANDLE Net() const
Definition pns_item.h:210
virtual const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const
Definition pns_item.h:164
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
Definition pns_joint.h:43
LAYER_CONTEXT_SETTER(OBSTACLE_VISITOR &aVisitor, int aLayer)
Definition pns_node.h:249
OBSTACLE_VISITOR & m_visitor
Definition pns_node.h:261
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:62
Keep the router "world" - i.e.
Definition pns_node.h:274
bool HasChildren() const
Definition pns_node.h:534
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
Definition pns_node.cpp:174
void RemoveByMarker(int aMarker)
NODE * m_root
root node of the whole hierarchy
Definition pns_node.h:628
int FindLinesBetweenJoints(const JOINT &aA, const JOINT &aB, std::vector< LINE > &aLines)
Find all lines between a pair of joints. Used by the loop removal procedure.
void BeginBulkAdd()
Defer spatial index insertion during bulk population.
NODE * GetParent() const
Definition pns_node.h:539
std::vector< ITEM * > ITEM_VECTOR
Definition pns_node.h:285
void addSolid(SOLID *aSeg)
Helpers for adding/removing items.
Definition pns_node.cpp:619
void Replace(ITEM *aOldItem, std::unique_ptr< ITEM > aNewItem)
Replace an item with another one.
Definition pns_node.cpp:969
bool Overrides(ITEM *aItem) const
Check if this branch contains an updated version of the m_item from the root branch.
Definition pns_node.h:545
int GetMaxClearance() const
Return the pre-set worst case clearance between any pair of items.
Definition pns_node.h:295
void removeSegmentIndex(SEGMENT *aSeg)
Definition pns_node.cpp:874
void SetMaxClearance(int aClearance)
Set the worst-case clearance between any pair of items.
Definition pns_node.h:312
COLLISION_QUERY_SCOPE
Supported item types.
Definition pns_node.h:279
@ CQS_IGNORE_HOLE_CLEARANCE
check everything except hole2hole / hole2copper
Definition pns_node.h:281
@ CQS_ALL_RULES
check all rules
Definition pns_node.h:280
void rebuildJoint(const JOINT *aJoint, const ITEM *aItem)
Definition pns_node.cpp:888
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)
Definition pns_node.cpp:754
std::vector< std::unique_ptr< SHAPE > > m_edgeExclusions
Definition pns_node.h:640
ARC * findRedundantArc(const VECTOR2I &A, const VECTOR2I &B, const PNS_LAYER_RANGE &lr, NET_HANDLE aNet)
void releaseChildren()
JOINT_MAP::value_type TagJointPair
Definition pns_node.h:622
void addVia(VIA *aVia)
Definition pns_node.cpp:642
bool QueryEdgeExclusions(const VECTOR2I &aPos) const
Definition pns_node.cpp:815
void doRemove(ITEM *aItem)
Definition pns_node.cpp:827
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.
Definition pns_node.cpp:510
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)
Definition pns_node.cpp:660
std::optional< OBSTACLE > OPT_OBSTACLE
Definition pns_node.h:284
void unlinkJoint(const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet, ITEM *aWhere)
Unlink an item from a joint.
std::unordered_set< ITEM * > m_garbageItems
Definition pns_node.h:642
void Dump(bool aLong=false)
Print the contents and joints structure.
void AddRaw(ITEM *aItem, bool aAllowRedundant=false)
Definition pns_node.h:552
NODE(const NODE &aB)
nodes are not copyable
void releaseGarbage()
int Depth() const
Return the number of nodes in the inheritance chain (wrs to the root node).
Definition pns_node.h:335
void addArc(ARC *aVia)
Definition pns_node.cpp:783
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Find the joints corresponding to the ends of line aLine.
RULE_RESOLVER * GetRuleResolver() const
Definition pns_node.h:323
JOINT & touchJoint(const VECTOR2I &aPos, const PNS_LAYER_RANGE &aLayers, NET_HANDLE aNet)
Try to find matching joint and creates a new one if not found.
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
Definition pns_node.cpp:765
void FixupVirtualVias()
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
Definition pns_node.h:286
std::unordered_multimap< JOINT::HASH_TAG, JOINT, JOINT::JOINT_TAG_HASH > JOINT_MAP
Definition pns_node.h:621
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=nullptr, bool aStopAtLockedJoints=false, bool aFollowLockedSegments=false, bool aAllowSegmentSizeMismatch=true)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
INDEX * m_index
Geometric/Net index of the items.
Definition pns_node.h:636
std::unordered_set< ITEM * > m_override
hash of root's items that have been changed in this node
Definition pns_node.h:631
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...
Definition pns_node.cpp:315
void LockJoint(const VECTOR2I &aPos, const ITEM *aItem, bool aLock)
void SetRuleResolver(RULE_RESOLVER *aFunc)
Assign a clearance resolution function object.
Definition pns_node.h:318
void removeArcIndex(ARC *aVia)
Definition pns_node.cpp:881
int JointCount() const
Return the number of joints.
Definition pns_node.h:329
void AddEdgeExclusion(std::unique_ptr< SHAPE > aShape)
Definition pns_node.cpp:809
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.
Definition pns_node.cpp:284
NODE & operator=(const NODE &aB)
int m_maxClearance
worst case item-item clearance
Definition pns_node.h:634
const JOINT * FindJoint(const VECTOR2I &aPos, const ITEM *aItem) const
Search for a joint at a given position, linked to given item.
Definition pns_node.h:510
bool isRoot() const
Definition pns_node.h:600
const std::unordered_set< ITEM * > & GetOverrides() const
Definition pns_node.h:557
VIA * FindViaByHandle(const VIA_HANDLE &handle) const
void removeViaIndex(VIA *aVia)
Definition pns_node.cpp:949
void add(ITEM *aItem, bool aAllowRedundant=false)
Definition pns_node.cpp:676
void followLine(LINKED_ITEM *aCurrent, bool aScanDirection, int &aPos, int aLimit, VECTOR2I *aCorners, LINKED_ITEM **aSegments, bool *aArcReversed, bool &aGuardHit, bool aStopAtLockedJoints, bool aFollowLockedSegments, bool aAllowSegmentSizeMismatch)
Scan the joint map, forming a line starting from segment (current).
void KillChildren()
Destroy all child nodes. Applicable only to the root node.
void removeSolidIndex(SOLID *aSeg)
Definition pns_node.cpp:957
int m_depth
depth of the node (number of parent nodes in the inheritance chain)
Definition pns_node.h:637
std::set< NODE * > m_children
list of nodes branched from this one
Definition pns_node.h:629
ITEM * FindItemByParent(const BOARD_ITEM *aParent)
JOINT_MAP m_joints
hash table with the joints, linking the items.
Definition pns_node.h:624
std::vector< ITEM * > FindItemsByParent(const BOARD_ITEM *aParent)
NODE * m_parent
node this node was branched from
Definition pns_node.h:627
void ClearRanks(int aMarkerMask=MK_HEAD|MK_VIOLATION)
void Remove(ARC *aArc)
Remove an item from this branch.
void unlinkParent()
Definition pns_node.cpp:208
void Commit(NODE *aNode)
Apply the changes from a given branch (aNode) to the root branch.
RULE_RESOLVER * m_ruleResolver
Design rules resolver.
Definition pns_node.h:635
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)
Touch a joint and links it to an m_item.
int GetClearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true, const COLLISION_SEARCH_OPTIONS &aOpts=COLLISION_SEARCH_OPTIONS()) const
Return the expected clearance between items a and b.
Definition pns_node.cpp:148
void FinalizeBulkAdd()
Build the spatial index from all items added since BeginBulkAdd().
const ITEM_SET HitTest(const VECTOR2I &aPoint) const
Find all items that contain the point aPoint.
Definition pns_node.cpp:590
OBSTACLE_VISITOR(const ITEM *aItem)
Definition pns_node.cpp:217
const NODE * m_node
node we are searching in (either root or a branch)
Definition pns_node.h:240
const ITEM * m_item
the item we are looking for collisions with
Definition pns_node.h:238
virtual bool operator()(ITEM *aCandidate)=0
bool visit(ITEM *aCandidate)
Definition pns_node.cpp:232
std::optional< int > m_layerContext
Definition pns_node.h:242
void SetLayerContext(int aLayer)
Definition pns_node.h:229
void SetWorld(const NODE *aNode, const NODE *aOverride=nullptr)
Definition pns_node.cpp:225
const NODE * m_override
node that overrides root entries
Definition pns_node.h:241
virtual ~OBSTACLE_VISITOR()
Definition pns_node.h:223
virtual int NetCode(NET_HANDLE aNet)=0
virtual ~RULE_RESOLVER()
Definition pns_node.h:174
virtual void ClearCacheForItems(std::vector< const ITEM * > &aItems)
Definition pns_node.h:202
virtual int ClearanceEpsilon() const
Definition pns_node.h:206
virtual void ClearTemporaryCaches()
Definition pns_node.h:204
virtual const SHAPE_LINE_CHAIN & HullCache(const ITEM *aItem, int aClearance, int aWalkaroundThickness, int aLayer)
Definition pns_node.h:208
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 HasUserDefinedPhysicalConstraint()
Definition pns_node.h:177
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()
Definition pns_node.h:203
virtual wxString NetName(NET_HANDLE aNet)=0
Represent a contiguous set of PCB layers.
int Start() const
static PNS_LAYER_RANGE All()
Shortcut for comparisons/overlap tests.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Handle a list of polygons defining a copper zone.
Definition zone.h:70
static bool empty(const wxTextEntryBase *aCtrl)
Push and Shove diff pair dimensions (gap) settings dialog.
std::function< int(const ITEM *, const ITEM *, CLEARANCE_ASPECT)> CLEARANCE_OVERRIDE_FUNC
Definition pns_node.h:123
static CLEARANCE_OVERRIDE_FUNC FixedClearanceOverrideLambda(int aFixedValue)
Definition pns_node.h:125
CONSTRAINT_TYPE
Definition pns_node.h:52
CLEARANCE_ASPECT
Definition pns_node.h:69
void * NET_HANDLE
Definition pns_item.h:55
std::function< bool(const ITEM *, const ITEM *)> COLLISION_FILTER_FUNC
Definition pns_node.h:122
@ MK_VIOLATION
Definition pns_item.h:44
@ MK_HEAD
Definition pns_item.h:43
const COLLISION_SEARCH_OPTIONS options
Definition pns_node.h:167
std::set< OBSTACLE > & obstacles
Definition pns_node.h:166
COLLISION_SEARCH_CONTEXT(std::set< OBSTACLE > &aObs, const COLLISION_SEARCH_OPTIONS aOpts=COLLISION_SEARCH_OPTIONS())
Definition pns_node.h:159
COLLISION_FILTER_FUNC m_filter
Definition pns_node.h:139
CLEARANCE_OVERRIDE_FUNC m_overrideClearance
Definition pns_node.h:140
void SetFixedClearanceOverride(int aClearance)
Definition pns_node.h:147
bool m_overrideExemptPairs
Apply m_overrideClearance even to pairs the resolver exempts, such as same-net items.
Definition pns_node.h:143
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
Definition pns_node.h:83
wxString m_FromName
Definition pns_node.h:88
wxString m_RuleName
Definition pns_node.h:87
wxString m_ToName
Definition pns_node.h:89
bool m_IsTimeDomain
Definition pns_node.h:90
MINOPTMAX< int > m_Value
Definition pns_node.h:85
CONSTRAINT_TYPE m_Type
Definition pns_node.h:84
Hold an object colliding with another object, along with some useful data about the collision.
Definition pns_node.h:98
VECTOR2I m_pos
Definition pns_node.h:103
int m_distFirst
... and the distance thereof
Definition pns_node.h:104
int m_maxFanoutWidth
worst case (largest) width of the tracks connected to the item
Definition pns_node.h:105
bool operator==(const OBSTACLE &other) const
Definition pns_node.h:107
ITEM * m_head
Line we search collisions against.
Definition pns_node.h:99
bool operator<(const OBSTACLE &other) const
Definition pns_node.h:112
VECTOR2I m_ipFirst
First intersection between m_head and m_hull.
Definition pns_node.h:101
ITEM * m_item
Item found to be colliding with m_head.
Definition pns_node.h:100
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708