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)
 
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 176 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 197 of file pns_node.cpp.

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

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

Member Function Documentation

◆ operator()()

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

Implements PNS::OBSTACLE_VISITOR.

Definition at line 218 of file pns_node.cpp.

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

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 213 of file pns_node.cpp.

214  {
215  m_limitCount = aLimit;
216  }
int m_limitCount
max number of hits
Definition: pns_node.cpp:185

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 156 of file pns_node.cpp.

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

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 163 of file pns_node.cpp.

164 {
165  // check if there is a more recent branch with a newer
166  // (possibily modified) version of this item.
167  if( m_override && m_override->Overrides( aCandidate ) )
168  return true;
169 
170  return false;
171 }
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:419
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:122

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 193 of file pns_node.cpp.

Referenced by operator()().

◆ m_extraClearance

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_extraClearance

additional clearance

Definition at line 191 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 195 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 116 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 182 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 185 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 188 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 119 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 122 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 179 of file pns_node.cpp.

Referenced by operator()().


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