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

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

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

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

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

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

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

162 {
163  m_node = aNode;
164  m_override = aOverride;
165 }
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:115
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:118

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

169 {
170  // check if there is a more recent branch with a newer
171  // (possibily modified) version of this item.
172  if( m_override && m_override->Overrides( aCandidate ) )
173  return true;
174 
175  return false;
176 }
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:416
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:118

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

Referenced by operator()().

◆ m_extraClearance

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_extraClearance

additional clearance

Definition at line 196 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 200 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 112 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 187 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 190 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 193 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 115 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 118 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 184 of file pns_node.cpp.

Referenced by operator()().


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