KiCad PCB EDA Suite
PNS::HIT_VISITOR Struct Reference
Inheritance diagram for PNS::HIT_VISITOR:
PNS::OBSTACLE_VISITOR

Public Member Functions

 HIT_VISITOR (ITEM_SET &aTab, const VECTOR2I &aPoint)
 
virtual ~HIT_VISITOR ()
 
bool operator() (ITEM *aItem) override
 
void SetWorld (const NODE *aNode, const NODE *aOverride=nullptr)
 

Public Attributes

ITEM_SETm_items
 
const VECTOR2Im_point
 

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

Constructor & Destructor Documentation

◆ HIT_VISITOR()

PNS::HIT_VISITOR::HIT_VISITOR ( ITEM_SET aTab,
const VECTOR2I aPoint 
)
inline

Definition at line 493 of file pns_node.cpp.

493  :
494  OBSTACLE_VISITOR( nullptr ),
495  m_items( aTab ),
496  m_point( aPoint )
497  {}
ITEM_SET & m_items
Definition: pns_node.cpp:490
OBSTACLE_VISITOR(const ITEM *aItem)
Definition: pns_node.cpp:182
const VECTOR2I & m_point
Definition: pns_node.cpp:491

◆ ~HIT_VISITOR()

virtual PNS::HIT_VISITOR::~HIT_VISITOR ( )
inlinevirtual

Definition at line 499 of file pns_node.cpp.

500  {
501  }

Member Function Documentation

◆ operator()()

bool PNS::HIT_VISITOR::operator() ( ITEM aItem)
inlineoverridevirtual

Implements PNS::OBSTACLE_VISITOR.

Definition at line 503 of file pns_node.cpp.

504  {
505  SHAPE_CIRCLE cp( m_point, 0 );
506 
507  int cl = 0;
508 
509  if( aItem->Shape()->Collide( &cp, cl ) )
510  m_items.Add( aItem );
511 
512  return true;
513  }
void Add(const LINE &aLine)
Definition: pns_itemset.cpp:32
ITEM_SET & m_items
Definition: pns_node.cpp:490
const VECTOR2I & m_point
Definition: pns_node.cpp:491

References PNS::ITEM_SET::Add(), SHAPE::Collide(), m_items, m_point, and PNS::ITEM::Shape().

◆ SetWorld()

void PNS::OBSTACLE_VISITOR::SetWorld ( const NODE aNode,
const NODE aOverride = nullptr 
)
inherited

Definition at line 190 of file pns_node.cpp.

191 {
192  m_node = aNode;
193  m_override = aOverride;
194 }
const NODE * m_node
node we are searching in (either root or a branch)
Definition: pns_node.h:133
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:134

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

198 {
199  // check if there is a more recent branch with a newer (possibly modified) version of this
200  // item.
201  if( m_override && m_override->Overrides( aCandidate ) )
202  return true;
203 
204  return false;
205 }
bool Overrides(ITEM *aItem) const
Definition: pns_node.h:380
const NODE * m_override
node that overrides root entries
Definition: pns_node.h:134

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

Referenced by PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()().

Member Data Documentation

◆ m_item

const ITEM* PNS::OBSTACLE_VISITOR::m_item
protectedinherited

the item we are looking for collisions with

Definition at line 131 of file pns_node.h.

Referenced by PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()().

◆ m_items

ITEM_SET& PNS::HIT_VISITOR::m_items

Definition at line 490 of file pns_node.cpp.

Referenced by operator()().

◆ m_node

const NODE* PNS::OBSTACLE_VISITOR::m_node
protectedinherited

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

Definition at line 133 of file pns_node.h.

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

◆ m_override

const NODE* PNS::OBSTACLE_VISITOR::m_override
protectedinherited

node that overrides root entries

Definition at line 134 of file pns_node.h.

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

◆ m_point

const VECTOR2I& PNS::HIT_VISITOR::m_point

Definition at line 491 of file pns_node.cpp.

Referenced by operator()().


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