ADTF Display Toolbox
Loading...
Searching...
No Matches
cBaseObjectScene

Base class for managing a scene of objects. More...

#include <baseobjectscene.h>

Inheritance diagram for cBaseObjectScene:
[legend]

Public Member Functions

 cBaseObjectScene (const tChar *strName="")
 Default constructor.
 
virtual ~cBaseObjectScene ()
 Destructor.
 
virtual const tChar * GetName ()
 Returns the name of the scene.
 
virtual tResult AddObject (cBaseObject *pObj)
 Use this to add a new object to the scene.
 
virtual tResult RemoveObject (tUInt32 nId)
 Removes an object from the scene.
 
virtual tResult GetObject (tUInt32 nId, cBaseObject **ppObj)
 Retrieves an object.
 
virtual tResult RemoveInvalid ()
 Removes all objects that have not been updated since the last call.
 
virtual tResult SetPosition (tFloat64 fPosX, tFloat64 fPosY, tFloat64 fPosZ)
 Sets the position of the scene.
 
virtual tResult SetRotation (tFloat64 fRotX, tFloat64 fRotY, tFloat64 fRotZ)
 Sets the rotation (attitude) of the scene.
 

Protected Attributes

std::string m_strName
 
std::map< tUInt32, osg::ref_ptr< cBaseObject > > m_oObjects
 

Detailed Description

Base class for managing a scene of objects.

Use AddObject to add an object to the scene. Existing objects can be retrieved using the GetObject method. The baasic idea is that you first check if an object already exists using the GetObject method and in this case manipulate the existing object. If it does not exist create a new one using new and add it.

The cBaseObject class has a property that tells if the object has been updated. RemoveInvalid will remove all objects whos IsUpdated method returns false and call the Reset method of all others. The updated property will be set in the Update method.

This class is best used in combination with cBaseObjectMixin.

Definition at line 40 of file baseobjectscene.h.

Constructor & Destructor Documentation

◆ cBaseObjectScene()

cBaseObjectScene ( const tChar * strName = "")
inline

Default constructor.

Parameters
strName[in] The name of the scene.

Definition at line 48 of file baseobjectscene.h.

◆ ~cBaseObjectScene()

virtual ~cBaseObjectScene ( )
inlinevirtual

Destructor.

Definition at line 55 of file baseobjectscene.h.

Member Function Documentation

◆ AddObject()

virtual tResult AddObject ( cBaseObject * pObj)
inlinevirtual

Use this to add a new object to the scene.

Parameters
pObj[in] A pointer to the new object.
Returns
Standard result.

Definition at line 73 of file baseobjectscene.h.

References cBaseObject::GetId().

◆ GetName()

virtual const tChar * GetName ( )
inlinevirtual

Returns the name of the scene.

Returns
The name of the scene.

Definition at line 63 of file baseobjectscene.h.

Referenced by cBaseObjectSelectionMixin::UpdateWidgets().

◆ GetObject()

virtual tResult GetObject ( tUInt32 nId,
cBaseObject ** ppObj )
inlinevirtual

Retrieves an object.

Parameters
nId[in] The id of the object to retreive.
ppObj[out] The pointer to the object.
Returns
Standard result.

Definition at line 120 of file baseobjectscene.h.

◆ RemoveInvalid()

virtual tResult RemoveInvalid ( )
inlinevirtual

Removes all objects that have not been updated since the last call.

Returns
Standard result.

Definition at line 140 of file baseobjectscene.h.

References cBaseObject::GetId(), cBaseObject::IsUpdated(), and cBaseObject::Reset().

◆ RemoveObject()

virtual tResult RemoveObject ( tUInt32 nId)
inlinevirtual

Removes an object from the scene.

Parameters
nId[in] The id of the object to remove.
Returns
Standard result.

Definition at line 95 of file baseobjectscene.h.

◆ SetPosition()

virtual tResult SetPosition ( tFloat64 fPosX,
tFloat64 fPosY,
tFloat64 fPosZ )
inlinevirtual

Sets the position of the scene.

This translation will be applied to all objects.

Parameters
fPosX[in] The x-coordinate.
fPosY[in] The y-coordinate.
fPosZ[in] The z-coordinate.
Returns
Standard result.

Definition at line 174 of file baseobjectscene.h.

◆ SetRotation()

virtual tResult SetRotation ( tFloat64 fRotX,
tFloat64 fRotY,
tFloat64 fRotZ )
inlinevirtual

Sets the rotation (attitude) of the scene.

This rotation will be applied to all objects.

Parameters
fRotX[in] The x-rotation values (Rad).
fRotY[in] The y-rotation values (Rad).
fRotZ[in] The z-rotation values (Rad).
Returns
Standard result.

Definition at line 188 of file baseobjectscene.h.

Member Data Documentation

◆ m_oObjects

std::map<tUInt32, osg::ref_ptr<cBaseObject> > m_oObjects
protected

Definition at line 196 of file baseobjectscene.h.

◆ m_strName

std::string m_strName
protected

Definition at line 195 of file baseobjectscene.h.