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
 
int m_kindMask
 (solids, vias, segments, etc...) More...
 
int m_limitCount
 
int m_matchCount
 
bool m_differentNetsOnly
 

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...
 
int m_extraClearance
 additional clearance More...
 

Detailed Description

Definition at line 197 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 206 of file pns_node.cpp.

207  :
208  OBSTACLE_VISITOR( aItem ),
209  m_tab( aTab ),
210  m_kindMask( aKindMask ),
211  m_limitCount( -1 ),
212  m_matchCount( 0 ),
213  m_differentNetsOnly( aDifferentNetsOnly )
214  {
215  if( aItem && aItem->Kind() == ITEM::LINE_T )
216  {
217  m_extraClearance += static_cast<const LINE*>( aItem )->Width() / 2;
218  }
219  }
int m_extraClearance
additional clearance
Definition: pns_node.h:133
OBSTACLE_VISITOR(const ITEM *aItem)
Definition: pns_node.cpp:169
int m_kindMask
(solids, vias, segments, etc...)
Definition: pns_node.cpp:201

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

◆ ~DEFAULT_OBSTACLE_VISITOR()

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

Definition at line 221 of file pns_node.cpp.

222  {
223  }

Member Function Documentation

◆ operator()()

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

Implements PNS::OBSTACLE_VISITOR.

Definition at line 230 of file pns_node.cpp.

231  {
232  if( !aCandidate->OfKind( m_kindMask ) )
233  return true;
234 
235  if( visit( aCandidate ) )
236  return true;
237 
238  if( !aCandidate->Collide( m_item, m_node, m_differentNetsOnly ) )
239  return true;
240 
241  OBSTACLE obs;
242 
243  obs.m_item = aCandidate;
244  obs.m_head = m_item;
245  m_tab.push_back( obs );
246 
247  m_matchCount++;
248 
249  if( m_limitCount > 0 && m_matchCount >= m_limitCount )
250  return false;
251 
252  return true;
253  };
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:131
bool visit(ITEM *aCandidate)
Definition: pns_node.cpp:185
int m_kindMask
(solids, vias, segments, etc...)
Definition: pns_node.cpp:201
const ITEM * m_item
the item we are looking for collisions with
Definition: pns_node.h:129

References PNS::ITEM::Collide(), m_differentNetsOnly, 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 225 of file pns_node.cpp.

226  {
227  m_limitCount = aLimit;
228  }

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

179 {
180  m_node = aNode;
181  m_override = aOverride;
182 }
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:131
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:132

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

186 {
187  // check if there is a more recent branch with a newer (possibly modified) version of this
188  // item.
189  if( m_override && m_override->Overrides( aCandidate ) )
190  return true;
191 
192  return false;
193 }
bool Overrides(ITEM *aItem) const
Definition: pns_node.h:379
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:132

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

Referenced by operator()().

◆ m_extraClearance

int PNS::OBSTACLE_VISITOR::m_extraClearance
protectedinherited

additional clearance

Definition at line 133 of file pns_node.h.

Referenced by DEFAULT_OBSTACLE_VISITOR().

◆ m_item

const ITEM* PNS::OBSTACLE_VISITOR::m_item
protectedinherited

the item we are looking for collisions with

Definition at line 129 of file pns_node.h.

Referenced by operator()().

◆ m_kindMask

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_kindMask

(solids, vias, segments, etc...)

Definition at line 201 of file pns_node.cpp.

Referenced by operator()().

◆ m_limitCount

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_limitCount

Definition at line 202 of file pns_node.cpp.

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

◆ m_matchCount

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_matchCount

Definition at line 203 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 131 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 132 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

Definition at line 199 of file pns_node.cpp.

Referenced by operator()().


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