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

Constructor & Destructor Documentation

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

Definition at line 203 of file pns_node.cpp.

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

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

Member Function Documentation

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

Implements PNS::OBSTACLE_VISITOR.

Definition at line 224 of file pns_node.cpp.

References PNS::ITEM::Collide(), PNS::NODE::GetClearance(), PNS::ITEM::Kind(), PNS::ITEM::LINE_T, m_forceClearance, PNS::OBSTACLE::m_head, PNS::OBSTACLE::m_item, PNS::OBSTACLE_VISITOR::m_item, PNS::OBSTACLE_VISITOR::m_node, PNS::ITEM::OfKind(), and PNS::OBSTACLE_VISITOR::visit().

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, 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:116
OBSTACLES & m_tab
list of encountered obstacles
Definition: pns_node.cpp:185
bool visit(ITEM *aCandidate)
Definition: pns_node.cpp:169
int m_kindMask
acccepted kinds of colliding items (solids, vias, segments, etc...)
Definition: pns_node.cpp:188
const ITEM * m_item
the item we are looking for collisions with
Definition: pns_node.h:113
int m_extraClearance
additional clearance
Definition: pns_node.cpp:197
int GetClearance(const ITEM *aA, const ITEM *aB) const
Returns the expected clearance between items a and b.
Definition: pns_node.cpp:100
int m_limitCount
max number of hits
Definition: pns_node.cpp:191
int m_matchCount
number of items found so far
Definition: pns_node.cpp:194
void PNS::NODE::DEFAULT_OBSTACLE_VISITOR::SetCountLimit ( int  aLimit)
inline

Definition at line 219 of file pns_node.cpp.

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

220  {
221  m_limitCount = aLimit;
222  }
int m_limitCount
max number of hits
Definition: pns_node.cpp:191
void PNS::OBSTACLE_VISITOR::SetWorld ( const NODE aNode,
const NODE aOverride = NULL 
)
inherited

Definition at line 162 of file pns_node.cpp.

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

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

163 {
164  m_node = aNode;
165  m_override = aOverride;
166 }
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:116
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:119
bool PNS::OBSTACLE_VISITOR::visit ( ITEM aCandidate)
protectedinherited

Definition at line 169 of file pns_node.cpp.

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

Referenced by operator()().

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

Member Data Documentation

bool PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_differentNetsOnly

Definition at line 199 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_extraClearance

additional clearance

Definition at line 197 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_forceClearance

Definition at line 201 of file pns_node.cpp.

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

const ITEM* PNS::OBSTACLE_VISITOR::m_item
protectedinherited

the item we are looking for collisions with

Definition at line 113 of file pns_node.h.

Referenced by operator()().

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_kindMask

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

Definition at line 188 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_limitCount

max number of hits

Definition at line 191 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_matchCount

number of items found so far

Definition at line 194 of file pns_node.cpp.

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

const NODE* PNS::OBSTACLE_VISITOR::m_node
protectedinherited

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

Definition at line 116 of file pns_node.h.

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

const NODE* PNS::OBSTACLE_VISITOR::m_override
protectedinherited

node that overrides root entries

Definition at line 119 of file pns_node.h.

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

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

list of encountered obstacles

Definition at line 185 of file pns_node.cpp.


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