KiCad PCB EDA Suite
CGENERICCONTAINER Class Referenceabstract

#include <ccontainer.h>

Inheritance diagram for CGENERICCONTAINER:
CCONTAINER

Public Member Functions

 CGENERICCONTAINER ()
 
virtual ~CGENERICCONTAINER ()
 
void Add (COBJECT *aObject)
 
void Clear ()
 
const LIST_OBJECTGetList () const
 
void ConvertTo (CONST_VECTOR_OBJECT &aOutVector) const
 
const CBBOXGetBBox () const
 
virtual bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const =0
 
virtual bool IntersectP (const RAY &aRay, float aMaxDistance) const =0
 

Protected Attributes

CBBOX m_bbox
 
LIST_OBJECT m_objects
 

Detailed Description

Definition at line 41 of file ccontainer.h.

Constructor & Destructor Documentation

CGENERICCONTAINER::CGENERICCONTAINER ( )

Definition at line 33 of file ccontainer.cpp.

References m_bbox, m_objects, and CBBOX::Reset().

34 {
35  m_objects.clear();
36  m_bbox.Reset();
37 }
LIST_OBJECT m_objects
Definition: ccontainer.h:45
void Reset()
Function Reset reset the bounding box to zero and de-initialized it.
Definition: cbbox.cpp:98
CGENERICCONTAINER::~CGENERICCONTAINER ( )
virtual

Definition at line 58 of file ccontainer.cpp.

References Clear().

59 {
60  Clear();
61 }

Member Function Documentation

void CGENERICCONTAINER::Add ( COBJECT aObject)
inline

Definition at line 52 of file ccontainer.h.

References COBJECT::GetBBox(), and CBBOX::Union().

Referenced by C3D_RENDER_RAYTRACING::add_3D_models(), C3D_RENDER_RAYTRACING::create_3d_object_from(), C3D_RENDER_RAYTRACING::insert3DPadHole(), C3D_RENDER_RAYTRACING::insert3DViaHole(), and C3D_RENDER_RAYTRACING::reload().

53  {
54  if( aObject ) // Only add if it is a valid pointer
55  {
56  m_objects.push_back( aObject );
57  m_bbox.Union( aObject->GetBBox() );
58  }
59  }
LIST_OBJECT m_objects
Definition: ccontainer.h:45
void Union(const SFVEC3F &aPoint)
Function Union recalculate the bounding box adding a point.
Definition: cbbox.cpp:105
const CBBOX & GetBBox() const
Definition: cobject.h:94
void CGENERICCONTAINER::Clear ( )

Definition at line 39 of file ccontainer.cpp.

References m_bbox, m_objects, and CBBOX::Reset().

Referenced by C3D_RENDER_RAYTRACING::reload(), and ~CGENERICCONTAINER().

40 {
41  if( !m_objects.empty() )
42  {
43  for( LIST_OBJECT::iterator ii = m_objects.begin();
44  ii != m_objects.end();
45  ++ii )
46  {
47  delete *ii;
48  *ii = NULL;
49  }
50 
51  m_objects.clear();
52  }
53 
54  m_bbox.Reset();
55 }
LIST_OBJECT m_objects
Definition: ccontainer.h:45
void Reset()
Function Reset reset the bounding box to zero and de-initialized it.
Definition: cbbox.cpp:98
void CGENERICCONTAINER::ConvertTo ( CONST_VECTOR_OBJECT aOutVector) const

Definition at line 64 of file ccontainer.cpp.

References m_objects.

Referenced by CBVH_PBRT::CBVH_PBRT().

65 {
66  aOutVector.resize( m_objects.size() );
67 
68  if( !m_objects.empty() )
69  {
70  unsigned int i = 0;
71 
72  for( LIST_OBJECT::const_iterator ii = m_objects.begin();
73  ii != m_objects.end();
74  ++ii )
75  {
76  wxASSERT( (*ii) != NULL );
77 
78  aOutVector[i++] = static_cast<const COBJECT *>(*ii);
79  }
80  }
81 }
LIST_OBJECT m_objects
Definition: ccontainer.h:45
const CBBOX& CGENERICCONTAINER::GetBBox ( ) const
inline

Definition at line 67 of file ccontainer.h.

References m_bbox.

Referenced by C3D_RENDER_RAYTRACING::reload().

67 { return m_bbox; }
const LIST_OBJECT& CGENERICCONTAINER::GetList ( ) const
inline

Definition at line 63 of file ccontainer.h.

References m_objects.

Referenced by CBVH_PBRT::CBVH_PBRT(), and C3D_RENDER_RAYTRACING::reload().

63 { return m_objects; }
LIST_OBJECT m_objects
Definition: ccontainer.h:45
virtual bool CGENERICCONTAINER::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
pure virtual

Implemented in CCONTAINER.

virtual bool CGENERICCONTAINER::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
pure virtual

Implemented in CCONTAINER.

Member Data Documentation

CBBOX CGENERICCONTAINER::m_bbox
protected

Definition at line 44 of file ccontainer.h.

Referenced by CGENERICCONTAINER(), Clear(), GetBBox(), and CCONTAINER::Intersect().

LIST_OBJECT CGENERICCONTAINER::m_objects
protected

The documentation for this class was generated from the following files: