User manual

old releases - latest release - trunk

ObjectProxyBase Class Reference

Inheritance diagram for ObjectProxyBase:
Collaboration diagram for ObjectProxyBase:

List of all members.


Detailed Description

Base class for all client object proxies.

Provides functionality needed by all proxies referring to objects - handling of pseudonyms, and all basic operations pertaining to objects.

Public Member Functions

 ObjectProxyBase (const ObjectProxyBase &p)
bool operator== (const ObjectProxyBase &p) const throw ()
 Equality comparison operation.
bool operator!= (const ObjectProxyBase &p) const throw ()
 Inequality comparison operator.
DelayedDispatch set_transformation (const Matrix4f &mat, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's transformation.
DelayedDispatch set_position (float x, float y, float z, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's position.
DelayedDispatch set_orientation (float vx, float vy, float vz, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's orientation.
DelayedDispatch set_rotation (float yaw, float roll=0, float pitch=0, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's rotation.
DelayedDispatch set_pose (float x, float y, float z, float yaw, float roll=0, float pitch=0, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's pose.
DelayedDispatch set_opacity (float opacity, bool absolute=false)
 Set the object's opacity.
DelayedDispatch set_visibility (bool visible)
 Hide/show the object and all it's children.
DelayedDispatch hide ()
 Hide the object.
DelayedDispatch show ()
 Show (unhide) the object.
DelayedDispatch set_layer (unsigned int layer, bool recursive=false)
 Move the object, and optionally, all its children, to the given layer.
DelayedDispatch set_color (float r, float g, float b, bool recursive=false)
 Set the object's color.
DelayedDispatch set_name (const std::string &name)
 Set the object's name.
DelayedDispatch set_meta_name (const std::string &meta_name)
 Set the object's meta name (description).
DelayedDispatch remove ()
 Remove the object, and all of its children, from the scene.
DelayedDispatch rearrange (const ObjectProxyBase &new_parent, bool retain_world_pose=false, NameConflictPolicy conflict_policy=AUTO_ENUMERATE_ON_CONFLICT) const
 Relocate the object to a new parent.
DelayedDispatch load_scene (const std::string &filename, NameConflictPolicy conflict_policy=FAIL_ON_CONFLICT)
 Load a scene file.
Result< Matrix4f > get_transformation (CoordinateSystem coord_sys=PARENT_COORDINATES) const
 Get the transformation of the object.
Result< Vector3f > get_position (CoordinateSystem coord_sys=PARENT_COORDINATES) const
 Get the position of the object.
Result< Vector3f > get_orientation (CoordinateSystem coord_sys=PARENT_COORDINATES) const
 Get the orientation of the object.
Result< std::vector
< std::string > > 
get_children () const
 Get the names of all the object's children.

Protected Member Functions

ObjectID get_object_id () const throw (std::logic_error)
 Returns the pseudonym ID of the object associated with the proxy.
void set_pseudonym (boost::shared_ptr< ObjectID > id) throw ()
 Set the pseudonym ID of the proxy to id.
boost::shared_ptr< ObjectIDget_pseudonym () const throw ()
boost::shared_ptr< ObjectIDallocate_pseudonym ()

Static Protected Member Functions

static ObjectID get_object_id (const ObjectProxyBase &p) throw (std::logic_error)
 Returns the pseudonym ID of the object associated with the given proxy p.
static boost::shared_ptr
< ObjectID
get_pseudonym (const ObjectProxyBase &p) throw ()

Private Attributes

boost::shared_ptr< ObjectIDm_pseudonym

Static Private Attributes

static IDAllocator< ObjectID > * m_pseudonym_allocator


Member Function Documentation

bool operator== ( const ObjectProxyBase p  )  const throw ()

Equality comparison operation.

Returns true if the two operands refer to the same object. More specifically, it returns true if they're tied to the same client and are assigned to the same object in the scene.

Two proxies with different clients but assigned to the same object are not considered to be equal.

bool operator!= ( const ObjectProxyBase p  )  const throw ()

Inequality comparison operator.

See also:
operator==

DelayedDispatch set_transformation ( const Matrix4f &  mat,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's transformation.

Sets the transformation matrix of the object to the given matrix, specified in the given coordinate system.

Warning:
Do not use this to control scale, use ScalableProxyBase::set_scale(float, float, float) for scaling operations.
Precondition:
The upper left 3x3 submatrix of mat is orthonormal. The bottom-most row of mat is equal to $(0,0,0,1)$.
Parameters:
mat The matrix describing the wanted transformation of the object, in the given coordinate system.
coord_sys The coordinate system mat is described in.

DelayedDispatch set_orientation ( float  vx,
float  vy,
float  vz,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's orientation.

Sets the object's X-axis (in the coordinate system given by coord_sys) to $(vx,vy,vz)$.

DelayedDispatch set_rotation ( float  yaw,
float  roll = 0,
float  pitch = 0,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's rotation.

Parameters:
yaw Rotation about the Z-axis.
roll Rotation about the Y-axis.
pitch Rotation about the X-axis.

DelayedDispatch set_pose ( float  x,
float  y,
float  z,
float  yaw,
float  roll = 0,
float  pitch = 0,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's pose.

Parameters:
yaw Rotation about the Z-axis.
roll Rotation about the Y-axis.
pitch Rotation about the X-axis.

DelayedDispatch set_opacity ( float  opacity,
bool  absolute = false 
)

Set the object's opacity.

Parameters:
opacity The (absolute or relative) alpha value of the object.
absolute If set to false, the actual opacity of the object will be computed relative to the parent object.
See also:
show(), hide()
Todo:
Add a pointer to text explaining how opacity is calculated, and the difference in absolute and relative opacity.

DelayedDispatch set_visibility ( bool  visible  ) 

Hide/show the object and all it's children.

Parameters:
visible Set to false and true to show and hide the object respectively.

DelayedDispatch hide (  )  [inline]

Hide the object.

See also:
set_opacity(), show()

DelayedDispatch show (  )  [inline]

Show (unhide) the object.

See also:
set_opacity(), hide()

DelayedDispatch set_layer ( unsigned int  layer,
bool  recursive = false 
)

Move the object, and optionally, all its children, to the given layer.

Precondition:
layer is in range [1,16].
Parameters:
layer The layer which to move the object/subtree to.
recursive If true, the layer setting is propagated to all of the object's children.
Exceptions:
std::range_error Thrown when layer is outside the allowed range.

DelayedDispatch set_color ( float  r,
float  g,
float  b,
bool  recursive = false 
)

Set the object's color.

Precondition:
r,g,b are in the range [0,1].
Parameters:
recursive If true, the layer setting is propagated to all of the object's children.

DelayedDispatch set_name ( const std::string &  name  ) 

Set the object's name.

Warning:
Remember that object names have to be unique among its siblings.
Parameters:
name The object's new name.

DelayedDispatch rearrange ( const ObjectProxyBase new_parent,
bool  retain_world_pose = false,
NameConflictPolicy  conflict_policy = AUTO_ENUMERATE_ON_CONFLICT 
) const

Relocate the object to a new parent.

Parameters:
retain_world_pose If true, the object's absolute pose will remain unchanged, otherwise the aboslute pose might change but the pose relative the parent object will be left unchanged.

DelayedDispatch load_scene ( const std::string &  filename,
NameConflictPolicy  conflict_policy = FAIL_ON_CONFLICT 
)

Load a scene file.

The contents of the scene file will be attached underneath this object.

Parameters:
filename The filename (path) of the server-side scene file to load.

Result< Matrix4f > get_transformation ( CoordinateSystem  coord_sys = PARENT_COORDINATES  )  const

Get the transformation of the object.

The result will be returned in the given coordinate system, either relative the parent object or in world coordinates.

Parameters:
coord_sys The coordinate system the result should be described in. Must be PARENT_COORDINATES or WORLD_COORDINATES.

Result< Vector3f > get_position ( CoordinateSystem  coord_sys = PARENT_COORDINATES  )  const

Get the position of the object.

The result will be returned in the given coordinate system, either relative the parent object or in world coordinates.

Parameters:
coord_sys The coordinate system the result should be described in. Must be PARENT_COORDINATES or WORLD_COORDINATES.

Result< Vector3f > get_orientation ( CoordinateSystem  coord_sys = PARENT_COORDINATES  )  const

Get the orientation of the object.

The result will be returned in the given coordinate system, either relative the parent object or in world coordinates.

Parameters:
coord_sys The coordinate system the result should be described in. Must be PARENT_COORDINATES or WORLD_COORDINATES.

Result< std::vector< std::string > > get_children (  )  const

Get the names of all the object's children.

The order of the returned names is undefined.

Warning:
Note that by the time the time the client receives the result, children might have been renamed, moved or removed.

ObjectID get_object_id (  )  const throw (std::logic_error) [protected]

Returns the pseudonym ID of the object associated with the proxy.

Exceptions:
std::logic_error Thrown if the proxy is unassigned, i.e. not yet associated with an object.

ObjectID get_object_id ( const ObjectProxyBase p  )  throw (std::logic_error) [static, protected]

Returns the pseudonym ID of the object associated with the given proxy p.

See also:
get_object_id()

void set_pseudonym ( boost::shared_ptr< ObjectID id  )  throw () [protected]

Set the pseudonym ID of the proxy to id.

If id is "null", and no one else is using the same pseudonym, it will be released.


Member Data Documentation

IDAllocator< ObjectID > * m_pseudonym_allocator [static, private]

Initial value:

 
    new DefaultIDAllocator<ObjectID>()


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