9#ifndef opengl_CSetOfObjects_H
10#define opengl_CSetOfObjects_H
55 insert(objs.begin(),objs.end());
64 for (T_it it=
begin;it!=
end;it++) insert(*it);
76 size_t size() {
return m_objects.size(); }
79 inline bool empty()
const {
return m_objects.empty(); }
97 typename T::SmartPtr getByClass(
const size_t &ith = 0 )
const;
161 o->insertCollection(v);
166 template <
typename T>
170 size_t foundCount = 0;
172 for (CListOpenGLObjects::const_iterator it =
m_objects.begin();it!=
m_objects.end();++it)
173 if ( (*it).present() && (*it)->GetRuntimeClass()->derivedFrom( class_ID ) )
174 if (foundCount++ == ith)
175 return typename T::SmartPtr(*it);
178 for (CListOpenGLObjects::const_iterator it=
m_objects.begin();it!=
m_objects.end();++it)
187 return typename T::SmartPtr();
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
Access to runtime class ID for a defined class name.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
The base class of 3D objects that can be directly rendered through OpenGL.
A set of object, which are referenced to the coordinates framework established in this object.
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
CSetOfObjects()
Default constructor.
virtual CRenderizable & setColorA_u8(const uint8_t a) MRPT_OVERRIDE
Color components in the range [0,255].
void dumpListOfObjects(mrpt::utils::CStringList &lst)
Retrieves a list of all objects in text form
virtual CRenderizable & setColorG_u8(const uint8_t g) MRPT_OVERRIDE
Color components in the range [0,255].
T::SmartPtr getByClass(const size_t &ith=0) const
Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer)...
CRenderizablePtr getByName(const std::string &str)
Returns the first object with a given name, or a NULL pointer if not found.
bool empty() const
Returns true if there are no objects.
CListOpenGLObjects::iterator iterator
void removeObject(const CRenderizablePtr &obj)
Removes the given object from the scene (it also deletes the object to free its memory).
void insert(const T_it &begin, const T_it &end)
Inserts a set of objects, bounded by iterators, into the list.
const_iterator begin() const
void insertCollection(const T &objs)
Inserts a set of objects into the list.
static CSetOfObjectsPtr posePDF2opengl(const mrpt::poses::CPosePDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
static CSetOfObjectsPtr posePDF2opengl(const mrpt::poses::CPointPDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
CListOpenGLObjects m_objects
The list of child objects.
virtual CRenderizable & setColor_u8(const mrpt::utils::TColor &c) MRPT_OVERRIDE
CListOpenGLObjects::const_iterator const_iterator
void render() const MRPT_OVERRIDE
Render child objects.
bool contains(const CRenderizablePtr &obj) const
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Simulation of ray-trace, given a pose.
static CSetOfObjectsPtr posePDF2opengl(const mrpt::poses::CPose3DPDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
virtual ~CSetOfObjects()
Private, virtual destructor: only can be deleted from smart pointers.
static CSetOfObjectsPtr posePDF2opengl(const mrpt::poses::CPose3DQuatPDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it's more natural to call...
virtual CRenderizable & setColorB_u8(const uint8_t b) MRPT_OVERRIDE
Color components in the range [0,255].
const_iterator end() const
void insert(const CRenderizablePtr &newObject)
Insert a new object to the list.
virtual CRenderizable & setColorR_u8(const uint8_t r) MRPT_OVERRIDE
Color components in the range [0,255].
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x,...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually).
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually),...
Declares a class that represents a probability density function (pdf) of a 2D pose (x,...
A class for storing a list of text lines.
EIGEN_STRONG_INLINE iterator begin()
EIGEN_STRONG_INLINE iterator end()
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
The namespace for 3D scene representation and rendering.
std::deque< CRenderizablePtr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
struct OPENGL_IMPEXP CRenderizablePtr
struct OPENGL_IMPEXP CSetOfObjectsPtr
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A structure that holds runtime class type information.