ADTF_DISPLAY_TOOLBOX  3.8.0 (ADTF 3.14.3)
cBaseObject

Base class for objects that can be managed with cBaseObjectScene. More...

Inheritance diagram for cBaseObject:
[legend]

Public Member Functions

 cBaseObject (tUInt32 nId)
 Constructor. More...
 
virtual ~cBaseObject ()
 Destructor.
 
tUInt32 GetId ()
 Returns the id of the object. More...
 
tResult Update ()
 Base Implementation sets the updated property to true. More...
 
tBool IsUpdated ()
 Returns whether or not this object has been updated since the last Reset call. More...
 
tResult Reset ()
 Resets the updated property to false. More...
 
virtual tResult SetHistory (tBool bEnabled, tUInt32 nCount=0)
 Enables or disable the history trail of this object. More...
 
virtual tResult SetMotionVector (tBool bEnabled)
 Enables or disables the motion vector. More...
 
virtual tResult SetPosition (tFloat64 fPosX, tFloat64 fPosY, tFloat64 fPosZ)
 Sets the position of the object. More...
 
osg::Vec3d GetPosition ()
 Returns the current position. More...
 
virtual tResult SetRotation (tFloat64 fRotX, tFloat64 fRotY, tFloat64 fRotZ)
 Sets the rotation (attitude) of the object. More...
 
osg::Vec3d GetRotation ()
 Returns the current rotation. More...
 
virtual tResult SetSize (tFloat64 fSizeX, tFloat64 fSizeY, tFloat64 fSizeZ)
 Sets the dimensions of the object. More...
 
osg::Vec3d GetSize ()
 Returns the current size. More...
 
virtual tResult SetColor (tFloat64 fRed, tFloat64 fGreen, tFloat64 fBlue, tFloat64 fAlpha)
 Sets the color of the object. More...
 
virtual tResult SetMotion (tFloat64 fMotionX, tFloat64 fMotionY, tFloat64 fMotionZ)
 Sets the motion vector of the object. More...
 
osg::Vec3d GetMotion ()
 Returns the current motion vector. More...
 
virtual tResult SetSelected (tBool bSelected)
 Gives the object a chance to change its appearance when being selected or unselected. More...
 
virtual tBool IsSelected ()
 Returns the selected property of the object. More...
 

Protected Member Functions

virtual tResult UpdateSelection ()
 Used to update the selection sphere. More...
 

Protected Attributes

tUInt32 m_nId
 internal Id
 
osg::ref_ptr< osg::PositionAttitudeTransform > m_pTransform
 The transform that applies the translation and rotation to the box.
 
osg::ref_ptr< osg::ShapeDrawable > m_pDrawable
 The drawable for the box.
 
osg::ref_ptr< osg::Box > m_pBox
 The box that represents the object.
 
osg::ref_ptr< osg::Geometry > m_pHistoryGeom
 Geometry object used for rendering the history trail.
 
osg::ref_ptr< osg::DrawArrays > m_pHistoryArray
 This will do the actual drawing of the history trail.
 
osg::ref_ptr< osg::Geometry > m_pMotionGeom
 Geometry object used for rendering the motion vector.
 
osg::ref_ptr< osg::DrawArrays > m_pMotionArray
 This will do the actual drawing of the motion vector.
 
osg::Vec3d m_vPos
 The current position of the object.
 
osg::ref_ptr< osg::Vec3Array > m_pPositionHistory
 This will store old positions for drawing the history trail.
 
tUInt32 m_nHistorySize
 The maximum amount of positions in the m_pPositionHistory array.
 
osg::ref_ptr< osg::Vec3Array > m_pMotionVector
 The start and end point of the motion vector.
 
osg::ref_ptr< osg::Vec4Array > m_pColorArray
 The color array used for drawing the history trail and the motion vector.
 
tBool m_bHistory
 Whether or not to show the history trail.
 
tBool m_bMotionVector
 Whether or not to show the motion vector.
 
tBool m_bSelected
 Whether or not this object is selected.
 
tBool m_bUpdated
 Whether or not this object has been updated.
 
std::unique_ptr< cImplementation > m_pImplementation
 D-Pointer implementation.
 

Detailed Description

Base class for objects that can be managed with cBaseObjectScene.

If you want to extend its functionality subclass this class. You can create your own nodes and add them either with addChild at the root of this object or with m_pTransform->addChild at the transformation node which manages the shapes position and rotation.

You can find the implementation of this class in src/3dscenedisplay/mixinlib/baseobject.cpp

Definition at line 39 of file baseobject.h.

Constructor & Destructor Documentation

◆ cBaseObject()

cBaseObject ( tUInt32  nId)

Constructor.

Parameters
nId[in] The id of the object

Member Function Documentation

◆ GetId()

tUInt32 GetId ( )

Returns the id of the object.

Returns
The id of the object.

◆ GetMotion()

osg::Vec3d GetMotion ( )

Returns the current motion vector.

Returns
The current motion vector.

◆ GetPosition()

osg::Vec3d GetPosition ( )

Returns the current position.

Returns
The current position.

◆ GetRotation()

osg::Vec3d GetRotation ( )

Returns the current rotation.

Returns
The current rotation.

◆ GetSize()

osg::Vec3d GetSize ( )

Returns the current size.

Returns
The current size.

◆ IsSelected()

virtual tBool IsSelected ( )
virtual

Returns the selected property of the object.

Returns
The selected property of the object.

◆ IsUpdated()

tBool IsUpdated ( )

Returns whether or not this object has been updated since the last Reset call.

Returns
Whether or not this object has been updated since the last Reset call.

◆ Reset()

tResult Reset ( )

Resets the updated property to false.

Returns
Standard result.

◆ SetColor()

virtual tResult SetColor ( tFloat64  fRed,
tFloat64  fGreen,
tFloat64  fBlue,
tFloat64  fAlpha 
)
virtual

Sets the color of the object.

If you draw opaque objects, make sure that fAlpha is exactly 1.0.

Parameters
fRed/fGreen/fBlue/fAlpha[in] The color components.
Returns
Standard result.

◆ SetHistory()

virtual tResult SetHistory ( tBool  bEnabled,
tUInt32  nCount = 0 
)
virtual

Enables or disable the history trail of this object.

By default the history is enabled.

Parameters
bEnabled[in] Whether to enable or disable the history trail.
nCount[in] The amount of history positions to remember. If the array grows larger then this value, the oldest ones will be removed. Please mind that this comes at a performance cost since osg holds its vertices in a vector that has O(N) complexity for removing a single element. By default (0) no positions will be removed.
Returns
Standard result.

◆ SetMotion()

virtual tResult SetMotion ( tFloat64  fMotionX,
tFloat64  fMotionY,
tFloat64  fMotionZ 
)
virtual

Sets the motion vector of the object.

Note that the rotation specified with SetRotation is not applied to this vector.

Parameters
fMotionX/fMotionY/fMotionZ[in] The motion vector.
Returns
Standard result.

◆ SetMotionVector()

virtual tResult SetMotionVector ( tBool  bEnabled)
virtual

Enables or disables the motion vector.

Parameters
bEnabled[in] Whether to enable or disable the motion vector.
Returns
Standard result.

◆ SetPosition()

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

Sets the position of the object.

Parameters
fPosX/fPosY/fPosZ[in] The coordinates.
Returns
Standard result.

◆ SetRotation()

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

Sets the rotation (attitude) of the object.

Parameters
fRotX/fRotY/fRotZ[in] The rotation values.
Returns
Standard result.

◆ SetSelected()

virtual tResult SetSelected ( tBool  bSelected)
virtual

Gives the object a chance to change its appearance when being selected or unselected.

Parameters
bSelected[in] whether ot not the object is selected.
Returns
Standard result.

◆ SetSize()

virtual tResult SetSize ( tFloat64  fSizeX,
tFloat64  fSizeY,
tFloat64  fSizeZ 
)
virtual

Sets the dimensions of the object.

Parameters
fSizeX/fSizeY/fSizeZ[in] The dimensions.
Returns
Standard result.

◆ Update()

tResult Update ( )

Base Implementation sets the updated property to true.

Call this whenever you modified the object and/or need to modify the nodes inside your object.

Returns
Standard result.

◆ UpdateSelection()

virtual tResult UpdateSelection ( )
protectedvirtual

Used to update the selection sphere.

Returns
Standard result.