Public Member Functions | Protected Member Functions | Static Protected Member Functions

ObjectProxyBase Class Reference

Base class for all client object proxies. More...

Inheritance diagram for ObjectProxyBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ObjectProxyBase (const ObjectProxyBase &p)
bool operator== (const ObjectProxyBase &p) const
 Equality comparison operation.
bool operator!= (const ObjectProxyBase &p) const
 Inequality comparison operator.
DelayedDispatch set_transformation (float x1, float y1, float z1, float p1, float x2, float y2, float z2, float p2, float x3, float y3, float z3, float p3, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's transformation matrix.
DelayedDispatch set_transformation (const float *m, bool row_major=true, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's transformation matrix.
DelayedDispatch set_position (float x, float y, float z, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's position.
DelayedDispatch translate (float x, float y, float z, CoordinateSystem coord_sys=LOCAL_COORDINATES)
 Move the object.
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 pitch=0, float roll=0, CoordinateSystem coord_sys=PARENT_COORDINATES)
 Set the object's rotation from Euler angles.
DelayedDispatch rotate (float rad, float axis_x, float axis_y, float axis_z, float pivot_x=0, float pivot_y=0, float pivot_z=0, CoordinateSystem axis_coord_sys=LOCAL_COORDINATES, CoordinateSystem pivot_coord_sys=LOCAL_COORDINATES)
 Rotate the object around the given rotational axis and pivot.
DelayedDispatch set_pose (float x, float y, float z, float yaw, float pitch=0, float roll=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 remove ()
 Remove the object, and all of its children, from the scene.
DelayedDispatch clear ()
 Remove all child objects.
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< Transformation > get_transformation (CoordinateSystem coord_sys=PARENT_COORDINATES) const
 Get the transformation of the object.
Result< Vector3 > get_position (CoordinateSystem coord_sys=PARENT_COORDINATES) const
 Get the position of the object.
Result< Vector3 > 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

PEEKABOT_HIDDEN ObjectID get_object_id () const
 Returns the pseudonym ID of the object associated with the proxy.
PEEKABOT_HIDDEN void unchecked_assign (boost::shared_ptr< ClientImpl > client, boost::shared_ptr< ObjectID > id)
 Low level assign - set the pseudonym ID and client of the proxy. No type checking is done.
PEEKABOT_HIDDEN void unchecked_assign (const ObjectProxyBase &other)
 Low level assign - set the pseudonym ID and client of the proxy to that of other. No type checking is done.
PEEKABOT_HIDDEN
boost::shared_ptr< ObjectID > 
get_pseudonym () const
PEEKABOT_HIDDEN
boost::shared_ptr< ObjectID > 
allocate_pseudonym ()

Static Protected Member Functions

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

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.


Member Function Documentation

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 [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  )  [static, protected]

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

See also:
get_object_id()
Result< Vector3 > 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< Vector3 > 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< Transformation > 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.
DelayedDispatch hide (  )  [inline]

Hide the object.

See also:
set_opacity(), show()
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.
bool operator!= ( const ObjectProxyBase p  )  const

Inequality comparison operator.

See also:
operator==
bool operator== ( const ObjectProxyBase p  )  const

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.

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 rotate ( float  rad,
float  axis_x,
float  axis_y,
float  axis_z,
float  pivot_x = 0,
float  pivot_y = 0,
float  pivot_z = 0,
CoordinateSystem  axis_coord_sys = LOCAL_COORDINATES,
CoordinateSystem  pivot_coord_sys = LOCAL_COORDINATES 
)

Rotate the object around the given rotational axis and pivot.

Precondition:
The rotational axis must be a non-zero vector.
Parameters:
axis_coord_sys The coordinate system in which the rotational axis is specified.
pivot_coord_sys The coordinate system in which the rotational pivot is specified.
Exceptions:
std::logic_error Thrown if the specified axis forms a zero vector.
See also:
set_rotation()
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_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_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 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_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)$.

Note that when the requested orientation equals the negated current orientation (e.g. current is $(1, 0, 0)$ and requested is $(-1, 0, 0)$) the change in orientation is ambiguous: we can achieve the desired orientation by rotating 180 degrees around either object's Z or Y axis. In this case, this operation always chooses to rotate around the Z axis.

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

Set the object's pose.

The yaw rotation is applied first, then pitch and roll last.

Parameters:
yaw Rotation about the Z-axis.
roll Rotation about the Y-axis.
pitch Rotation about the X-axis.
DelayedDispatch set_position ( float  x,
float  y,
float  z,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's position.

See also:
translate()
DelayedDispatch set_rotation ( float  yaw,
float  pitch = 0,
float  roll = 0,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's rotation from Euler angles.

The yaw rotation is applied first, then pitch and roll last.

Parameters:
yaw Rotation about the Z-axis.
pitch Rotation about the Y-axis.
roll Rotation about the X-axis.
See also:
rotate()
DelayedDispatch set_transformation ( const float *  m,
bool  row_major = true,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's transformation matrix.

Set the object's transformation from a 4x4 array with either row or column major storage.

Parameters:
row_major Storage layout of the input m.
coord_sys The coordinate system the transformation matrix is specified in.
DelayedDispatch set_transformation ( float  x1,
float  y1,
float  z1,
float  p1,
float  x2,
float  y2,
float  z2,
float  p2,
float  x3,
float  y3,
float  z3,
float  p3,
CoordinateSystem  coord_sys = PARENT_COORDINATES 
)

Set the object's transformation matrix.

Precondition:
(x1,x2,x3), (y1,y2,y3) and (z1,z2,z3) must all form unit vectors. p1,p2,p3 must all have finite values.
Parameters:
coord_sys The coordinate system the transformation matrix is specified in.
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 show (  )  [inline]

Show (unhide) the object.

See also:
set_opacity(), hide()
DelayedDispatch translate ( float  x,
float  y,
float  z,
CoordinateSystem  coord_sys = LOCAL_COORDINATES 
)

Move the object.

Translate the object the specified distances along the given coordinate systems axes.

Remarks:
translate() in local coordinates is the equivalent to set_position() with local coordinates.
See also:
set_position()

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