KiCad PCB EDA Suite
PNS::NODE::DEFAULT_OBSTACLE_VISITOR Struct Reference
Inheritance diagram for PNS::NODE::DEFAULT_OBSTACLE_VISITOR:
PNS::OBSTACLE_VISITOR

Public Member Functions

 DEFAULT_OBSTACLE_VISITOR (NODE::OBSTACLES &aTab, const ITEM *aItem, int aKindMask, bool aDifferentNetsOnly)
 
virtual ~DEFAULT_OBSTACLE_VISITOR ()
 
void SetCountLimit (int aLimit)
 
bool operator() (ITEM *aCandidate) override
 
void SetWorld (const NODE *aNode, const NODE *aOverride=NULL)
 

Public Attributes

OBSTACLESm_tab
 

list of encountered obstacles

More...
 
int m_kindMask
 

acccepted kinds of colliding items (solids, vias, segments, etc...)

More...
 
int m_limitCount
 

max number of hits

More...
 
int m_matchCount
 

number of items found so far

More...
 
int m_extraClearance
 

additional clearance

More...
 
bool m_differentNetsOnly
 
int m_forceClearance
 

Protected Member Functions

bool visit (ITEM *aCandidate)
 

Protected Attributes

const ITEMm_item
 

the item we are looking for collisions with

More...
 
const NODEm_node
 

node we are searching in (either root or a branch)

More...
 
const NODEm_override
 

node that overrides root entries

More...
 

Detailed Description

Definition at line 178 of file pns_node.cpp.

Constructor & Destructor Documentation

◆ DEFAULT_OBSTACLE_VISITOR()

PNS::NODE::DEFAULT_OBSTACLE_VISITOR::DEFAULT_OBSTACLE_VISITOR ( NODE::OBSTACLES aTab,
const ITEM aItem,
int  aKindMask,
bool  aDifferentNetsOnly 
)
inline

Definition at line 199 of file pns_node.cpp.

199  :
200  OBSTACLE_VISITOR( aItem ),
201  m_tab( aTab ),
202  m_kindMask( aKindMask ),
203  m_limitCount( -1 ),
204  m_matchCount( 0 ),
205  m_extraClearance( 0 ),
206  m_differentNetsOnly( aDifferentNetsOnly ),
207  m_forceClearance( -1 )
208  {
209  if( aItem && aItem->Kind() == ITEM::LINE_T )
210  {
211  m_extraClearance += static_cast<const LINE*>( aItem )->Width() / 2;
212  }
213  }
OBSTACLES & m_tab
list of encountered obstacles
Definition: pns_node.cpp:181
OBSTACLE_VISITOR(const ITEM *aItem)
Definition: pns_node.cpp:149
int m_kindMask
acccepted kinds of colliding items (solids, vias, segments, etc...)
Definition: pns_node.cpp:184
int m_extraClearance
additional clearance
Definition: pns_node.cpp:193
int m_limitCount
max number of hits
Definition: pns_node.cpp:187
int m_matchCount
number of items found so far
Definition: pns_node.cpp:190

References PNS::ITEM::Kind(), PNS::ITEM::LINE_T, and m_extraClearance.

◆ ~DEFAULT_OBSTACLE_VISITOR()

virtual PNS::NODE::DEFAULT_OBSTACLE_VISITOR::~DEFAULT_OBSTACLE_VISITOR ( )
inlinevirtual

Definition at line 215 of file pns_node.cpp.

216  {
217  }

Member Function Documentation

◆ operator()()

bool PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator() ( ITEM aCandidate)
inlineoverridevirtual

Implements PNS::OBSTACLE_VISITOR.

Definition at line 224 of file pns_node.cpp.

225  {
226  if( !aCandidate->OfKind( m_kindMask ) )
227  return true;
228 
229  if( visit( aCandidate ) )
230  return true;
231 
232  int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
233 
234  if( aCandidate->Kind() == ITEM::LINE_T ) // this should never happen.
235  {
236  assert( false );
237  clearance += static_cast<LINE*>( aCandidate )->Width() / 2;
238  }
239 
240  if( m_forceClearance >= 0 )
241  clearance = m_forceClearance;
242 
243  if( !aCandidate->Collide( m_item, clearance, false, nullptr, m_node, m_differentNetsOnly ) )
244  return true;
245 
246  OBSTACLE obs;
247 
248  obs.m_item = aCandidate;
249  obs.m_head = m_item;
250  m_tab.push_back( obs );
251 
252  m_matchCount++;
253 
254  if( m_limitCount > 0 && m_matchCount >= m_limitCount )
255  return false;
256 
257  return true;
258  };
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:124
int GetClearance(const ITEM *aA, const ITEM *aB) const
Returns the expected clearance between items a and b.
Definition: pns_node.cpp:97
OBSTACLES & m_tab
list of encountered obstacles
Definition: pns_node.cpp:181
bool visit(ITEM *aCandidate)
Definition: pns_node.cpp:165
int m_kindMask
acccepted kinds of colliding items (solids, vias, segments, etc...)
Definition: pns_node.cpp:184
const ITEM * m_item
the item we are looking for collisions with
Definition: pns_node.h:121
int m_extraClearance
additional clearance
Definition: pns_node.cpp:193
int m_limitCount
max number of hits
Definition: pns_node.cpp:187
int m_matchCount
number of items found so far
Definition: pns_node.cpp:190

References PNS::ITEM::Collide(), PNS::NODE::GetClearance(), PNS::ITEM::Kind(), PNS::ITEM::LINE_T, m_differentNetsOnly, m_extraClearance, m_forceClearance, PNS::OBSTACLE::m_head, PNS::OBSTACLE::m_item, PNS::OBSTACLE_VISITOR::m_item, m_kindMask, m_limitCount, m_matchCount, PNS::OBSTACLE_VISITOR::m_node, m_tab, PNS::ITEM::OfKind(), and PNS::OBSTACLE_VISITOR::visit().

◆ SetCountLimit()

void PNS::NODE::DEFAULT_OBSTACLE_VISITOR::SetCountLimit ( int  aLimit)
inline

Definition at line 219 of file pns_node.cpp.

220  {
221  m_limitCount = aLimit;
222  }
int m_limitCount
max number of hits
Definition: pns_node.cpp:187

References m_limitCount.

Referenced by PNS::NODE::QueryColliding().

◆ SetWorld()

void PNS::OBSTACLE_VISITOR::SetWorld ( const NODE aNode,
const NODE aOverride = NULL 
)
inherited

Definition at line 158 of file pns_node.cpp.

159 {
160  m_node = aNode;
161  m_override = aOverride;
162 }
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:124
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:127

References PNS::OBSTACLE_VISITOR::m_node, and PNS::OBSTACLE_VISITOR::m_override.

Referenced by PNS::NODE::HitTest(), and PNS::NODE::QueryColliding().

◆ visit()

bool PNS::OBSTACLE_VISITOR::visit ( ITEM aCandidate)
protectedinherited

Definition at line 165 of file pns_node.cpp.

166 {
167  // check if there is a more recent branch with a newer
168  // (possibily modified) version of this item.
169  if( m_override && m_override->Overrides( aCandidate ) )
170  return true;
171 
172  return false;
173 }
bool Overrides(ITEM *aItem) const
checks if this branch contains an updated version of the m_item from the root branch.
Definition: pns_node.h:434
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:127

References PNS::OBSTACLE_VISITOR::m_override, and PNS::NODE::Overrides().

Referenced by operator()().

Member Data Documentation

◆ m_differentNetsOnly

bool PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_differentNetsOnly

Definition at line 195 of file pns_node.cpp.

Referenced by operator()().

◆ m_extraClearance

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_extraClearance

additional clearance

Definition at line 193 of file pns_node.cpp.

Referenced by DEFAULT_OBSTACLE_VISITOR(), and operator()().

◆ m_forceClearance

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_forceClearance

Definition at line 197 of file pns_node.cpp.

Referenced by operator()(), and PNS::NODE::QueryColliding().

◆ m_item

const ITEM* PNS::OBSTACLE_VISITOR::m_item
protectedinherited

the item we are looking for collisions with

Definition at line 121 of file pns_node.h.

Referenced by operator()().

◆ m_kindMask

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_kindMask

acccepted kinds of colliding items (solids, vias, segments, etc...)

Definition at line 184 of file pns_node.cpp.

Referenced by operator()().

◆ m_limitCount

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_limitCount

max number of hits

Definition at line 187 of file pns_node.cpp.

Referenced by operator()(), and SetCountLimit().

◆ m_matchCount

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_matchCount

number of items found so far

Definition at line 190 of file pns_node.cpp.

Referenced by operator()(), and PNS::NODE::QueryColliding().

◆ m_node

const NODE* PNS::OBSTACLE_VISITOR::m_node
protectedinherited

node we are searching in (either root or a branch)

Definition at line 124 of file pns_node.h.

Referenced by operator()(), and PNS::OBSTACLE_VISITOR::SetWorld().

◆ m_override

const NODE* PNS::OBSTACLE_VISITOR::m_override
protectedinherited

node that overrides root entries

Definition at line 127 of file pns_node.h.

Referenced by PNS::OBSTACLE_VISITOR::SetWorld(), and PNS::OBSTACLE_VISITOR::visit().

◆ m_tab

OBSTACLES& PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_tab

list of encountered obstacles

Definition at line 181 of file pns_node.cpp.

Referenced by operator()().


The documentation for this struct was generated from the following file: