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

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

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

Member Function Documentation

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

Implements PNS::OBSTACLE_VISITOR.

Definition at line 222 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().

223  {
224  if( !aCandidate->OfKind( m_kindMask ) )
225  return true;
226 
227  if( visit( aCandidate ) )
228  return true;
229 
230  int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
231 
232  if( aCandidate->Kind() == ITEM::LINE_T ) // this should never happen.
233  {
234  assert( false );
235  clearance += static_cast<LINE*>( aCandidate )->Width() / 2;
236  }
237 
238  if( m_forceClearance >= 0 )
239  clearance = m_forceClearance;
240 
241  if( !aCandidate->Collide( m_item, clearance, m_differentNetsOnly ) )
242  return true;
243 
244  OBSTACLE obs;
245 
246  obs.m_item = aCandidate;
247  obs.m_head = m_item;
248  m_tab.push_back( obs );
249 
250  m_matchCount++;
251 
252  if( m_limitCount > 0 && m_matchCount >= m_limitCount )
253  return false;
254 
255  return true;
256  };
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:183
bool visit(ITEM *aCandidate)
Definition: pns_node.cpp:167
int m_kindMask
acccepted kinds of colliding items (solids, vias, segments, etc...)
Definition: pns_node.cpp:186
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:195
int GetClearance(const ITEM *aA, const ITEM *aB) const
Returns the expected clearance between items a and b.
Definition: pns_node.cpp:98
int m_limitCount
max number of hits
Definition: pns_node.cpp:189
int m_matchCount
number of items found so far
Definition: pns_node.cpp:192
void PNS::NODE::DEFAULT_OBSTACLE_VISITOR::SetCountLimit ( int  aLimit)
inline

Definition at line 217 of file pns_node.cpp.

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

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

Definition at line 160 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().

161 {
162  m_node = aNode;
163  m_override = aOverride;
164 }
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 167 of file pns_node.cpp.

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

Referenced by operator()().

168 {
169  // check if there is a more recent branch with a newer
170  // (possibily modified) version of this item.
171  if( m_override && m_override->Overrides( aCandidate ) )
172  return true;
173 
174  return false;
175 }
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:119

Member Data Documentation

bool PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_differentNetsOnly

Definition at line 197 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_extraClearance

additional clearance

Definition at line 195 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_forceClearance

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

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_limitCount

max number of hits

Definition at line 189 of file pns_node.cpp.

int PNS::NODE::DEFAULT_OBSTACLE_VISITOR::m_matchCount

number of items found so far

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


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