Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUtilityGeomHandle Class Reference

The HUtilityGeomHandle class contains a set of functions which controls the creation and manipulation of geometry handles. More...

#include <HUtilityGeomHandle.h>

List of all members.

Public Member Functions

void AdjustPointToRay (HC_KEY geomhandlekey, HPoint &p, HC_KEY camerasegment, HBaseView *view)
virtual void AdjustPositionToPlane (HC_KEY handlekey, HPoint &p, float a, float b, float c, float d, HC_KEY camerakey)
virtual void AdjustPositionToRay (HC_KEY handlekey, HPoint &C, HPoint A, HPoint B)
virtual float CalculatePlaneZ (HC_KEY handlekey, HPoint point)
virtual void CalculatePositionOnPlane (HC_KEY handlekey, HPoint &p, float a, float b, float c, float d)
virtual void CalculateTransformedPosition (HC_KEY handlekey, HPoint &t, HBaseView *view)
virtual void ConstrainToOnOff (HC_KEY handlekey, HBaseView *view=0)
virtual void ConstrainToPlane (HC_KEY handlekey, HPoint p1, HPoint p2, HPoint p3, HBaseView *view=0)
virtual void ConstrainToRay (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0)
virtual void ConstrainToRotationVector (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0)
virtual void ConstrainToScale (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0)
virtual void ConstrainToViewplane (HC_KEY handlekey, HBaseView *view=0)
virtual void GetConstraintParameters (HC_KEY handlekey)
HConstrainType GetConstraintType (HC_KEY handlekey)
virtual HPointGetRotationAxis (HC_KEY handlekey)
virtual HC_KEY Insert (HPoint position, bool edges=false, int level=4)
virtual void Move (HC_KEY handlekey, HPoint newposition, HC_KEY camerakey, HBaseView *view=0)
virtual void ResetHandle (HC_KEY handlekey, float scale=0.5f, HBaseView *view=0)
void Rotate (HC_KEY handlekey, float rotangle)
virtual void Scale (HC_KEY handlekey, float scalex, float scaley, float scalez)
virtual void SetupGeomHandleSegment (bool edges)
virtual void ShowBasePosition (HC_KEY handlekey, HPoint &bp)
virtual void ShowHandle (HC_KEY handlekey, float sf=0.7f, HBaseView *view=0)
virtual void TurnOff (HC_KEY handlekey)

Static Public Member Functions

static void ClearAllHandles (HBaseView *view)
static bool ContainsGeomHandles (HC_KEY key)
static void GetCenterPoint (HC_KEY objectkey, HPoint &centerpoint)
static HC_KEY GetMMSegment (HC_KEY handlekey)
static HC_KEY IsGeomHandle (HC_KEY key)
static void RegisterCallbacks ()
 Registers various callbacks needed for this class.
static HC_KEY SelectHandle (HBaseView *view, HPoint pos)
static HC_KEY SelectObject (HBaseView *view, HPoint pos, HC_KEY oldkey, bool exclude, float proximity=0.3)
static void SetupCuttingPlane (HC_KEY key, HBaseView *view)
static void SetupCuttingPlaneManipulator (HC_KEY startkey, HBaseView *view, HPoint *midpoint=0, bool omit_rotate=false)
static HC_KEY SetupManipulator (HC_KEY startkey, HBaseView *view, HPoint *mp, bool AddNonUniformScale=true, bool AddScale=true, bool AddPlane=true, bool AddAxismove=true, bool AddAxisrotate=true, bool AddViewplaneMove=true)
static void SetupObject (HC_KEY key, HBaseView *view, float boxzoom=1.0f)
static void SetupTextObject (HC_KEY key, HBaseView *view, float boxzoom=1.0f, float scale=1.0f)
static void SetVisibilityForAll (HC_KEY startkey, const char *visibility)

Detailed Description

The HUtilityGeomHandle class contains a set of functions which controls the creation and manipulation of geometry handles.

"Handles" can be attached to any geometry in the HOOPS segment tree. They can be used for dragging, rotating or scaling of objects. By specifying constraints, it is possible to limit their movement to a given ray or plane.

"Handles" are created as subsegments of any segment that contains geometry that needs to be manipulated. Multiple handles can be created fot the same geometry.


Member Function Documentation

void HUtilityGeomHandle::AdjustPointToRay ( HC_KEY  geomhandlekey,
HPoint p,
HC_KEY  camerasegment,
HBaseView view 
)

This method adjusts the given point p to lie to the ray that constrains the given handles.

Parameters:
geomhandlekeyThe key to the handle segment.
pThe point to be adjusted. When the method returned, p will be populated with the newly adjusted values.
camerasegmentThe key to the associated camera segment.
viewA pointer to the HBaseView object.
virtual void HUtilityGeomHandle::AdjustPositionToPlane ( HC_KEY  handlekey,
HPoint p,
float  a,
float  b,
float  c,
float  d,
HC_KEY  camerakey 
) [virtual]

This method adjusts point p to lie on a plane(described by the planar equation ax + by + cz + d = 0) by constructing a ray defined by the camera position and the point itself.

Parameters:
handlekeyThe key to the handle segment.
pThe point to be adjusted.
aThe first parameter that defines the plane.
bThe second parameter that defines the plane.
cThe third parameter that defines the plane.
dThe fourth parameter that defines the plane.
camerakeykey to segment with desired reference camera
virtual void HUtilityGeomHandle::AdjustPositionToRay ( HC_KEY  handlekey,
HPoint C,
HPoint  A,
HPoint  B 
) [virtual]

This method adjusts the given point C to lie on the ray defined by points A and B.

Parameters:
handlekeyThe key to the handle segment.
CThe point to be adjusted.
AThe first point that define the ray.
BThe second point that defines the ray.
virtual float HUtilityGeomHandle::CalculatePlaneZ ( HC_KEY  handlekey,
HPoint  point 
) [virtual]

This method calculates the correct z value corresponding to the handle plane for a given point. Note that you must pass a segment with camera attributes to be open.

Parameters:
handlekeyThe key to the handle segment.
pointThe point for which z value needs to be calculated
Returns:
The z value on the handle plane.
virtual void HUtilityGeomHandle::CalculatePositionOnPlane ( HC_KEY  handlekey,
HPoint p,
float  a,
float  b,
float  c,
float  d 
) [virtual]

This method projects the given point C to a given plane described via the parameters of a planar equation ax + by + cz + d = 0.

Parameters:
handlekeyThe key to the handle segment.
pThe point to be adjusted.
aThe first parameter that defines the plane.
bThe second parameter that defines the plane.
cThe third parameter that defines the plane.
dThe fourth parameter that defines the plane.
virtual void HUtilityGeomHandle::CalculateTransformedPosition ( HC_KEY  handlekey,
HPoint t,
HBaseView view 
) [virtual]

This method calculates the handle position after being combined with the world modelling transformation.

Parameters:
handlekeyThe key to the handle segment.
tThe handle position to be transformed.
viewA pointer to HBaseView object.
static void HUtilityGeomHandle::ClearAllHandles ( HBaseView view) [static]

This method delete all the handles from the current HBaseView.

Parameters:
viewA pointer to the view object.
virtual void HUtilityGeomHandle::ConstrainToOnOff ( HC_KEY  handlekey,
HBaseView view = 0 
) [virtual]

This method constrains the given handle to delete associated geometry

Parameters:
handlekeyThe key to the handle segment.
virtual void HUtilityGeomHandle::ConstrainToPlane ( HC_KEY  handlekey,
HPoint  p1,
HPoint  p2,
HPoint  p3,
HBaseView view = 0 
) [virtual]

This method constrains handle movement to the given plane.

Parameters:
handlekeyThe key to the handle segment.
p1The first point which defines the plane.
p2The second point which defines the plane.
p3The third point which defines the plane.
virtual void HUtilityGeomHandle::ConstrainToRay ( HC_KEY  handlekey,
HPoint  p1,
HPoint  p2,
HBaseView view = 0 
) [virtual]

This method constrains the given handle's movement to the given ray.

Parameters:
handlekeyThe key to the handle segment.
p1The first point which defines the ray.
p2The second point which defines the ray.
virtual void HUtilityGeomHandle::ConstrainToRotationVector ( HC_KEY  handlekey,
HPoint  p1,
HPoint  p2,
HBaseView view = 0 
) [virtual]

This method constrains the given handle's rotation to the passed rotation vector.

Parameters:
handlekeyThe key to the handle segment.
p1The first point which defines the rotation vector.
p2The second point which defines the rotation vector.
virtual void HUtilityGeomHandle::ConstrainToScale ( HC_KEY  handlekey,
HPoint  p1,
HPoint  p2,
HBaseView view = 0 
) [virtual]

The method contrains the given handle to the given scale.

Parameters:
handlekeyThe key to the handle segment.
p1The center for scaling.
p2The initial scaling value along the three axis. Pass 1.0 to indicate no scaling.
virtual void HUtilityGeomHandle::ConstrainToViewplane ( HC_KEY  handlekey,
HBaseView view = 0 
) [virtual]

This method contrains the given handle's movement to the view plane.

Parameters:
handlekeyThe key to the handle segment.
static bool HUtilityGeomHandle::ContainsGeomHandles ( HC_KEY  key) [static]

This method identifies if the given segment or any of it's subsegments contains handles.

Parameters:
keyThe key to the segment.
Returns:
True if there is handle in segment or subsegments or false if there are no handles.
static void HUtilityGeomHandle::GetCenterPoint ( HC_KEY  objectkey,
HPoint centerpoint 
) [static]

This method finds the center point of the object (in its local space) attached to the given handle.

Parameters:
objectkeyThe object attached to the handle.
centerpointReturns a center point of the object.
virtual void HUtilityGeomHandle::GetConstraintParameters ( HC_KEY  handlekey) [virtual]

This method restores the constraint parameters for a given handle from user options to the class members so that they can be used for calculations like rotate.

Parameters:
handlekeykey to handle segment
HConstrainType HUtilityGeomHandle::GetConstraintType ( HC_KEY  handlekey) [inline]

This method gets the constraint type for the given handle.

Parameters:
handlekeyThe key to handle segment.
Returns:
The constraint type of the given handle.
static HC_KEY HUtilityGeomHandle::GetMMSegment ( HC_KEY  handlekey) [static]

This method finds a key to attached a modelling matrix segment for a given handle.

Parameters:
handlekeyA key to the handle.
Returns:
The segment key containing modelling matrix.
virtual HPoint* HUtilityGeomHandle::GetRotationAxis ( HC_KEY  handlekey) [inline, virtual]

This method gets the rotation axis for a handle with a rotational constraint.

Parameters:
handlekeyThe key to the handle segment.
Returns:
A pointer to array defining the ray.
virtual HC_KEY HUtilityGeomHandle::Insert ( HPoint  position,
bool  edges = false,
int  level = 4 
) [virtual]

Creates a new handle underneath the currently open segment.

Parameters:
positionThe coordinates where the handle should be created.
edgesPass true to display edges for handle arrows or false not to show them.
levelModelling Matrix level for handles.
Returns:
The key of the newly created handle segment.
static HC_KEY HUtilityGeomHandle::IsGeomHandle ( HC_KEY  key) [static]

This method identifies if the given segment has handles.

Parameters:
keyThe key to the segment.
Returns:
The original key that was passed if there are handles or INVALID_KEY if there are no handles.
virtual void HUtilityGeomHandle::Move ( HC_KEY  handlekey,
HPoint  newposition,
HC_KEY  camerakey,
HBaseView view = 0 
) [virtual]

This method moves the handle position. Note this affects the associated geometry.

Parameters:
handlekeyThe key to the handle segment.
newpositionThe coordinates of the new handle position.
camerakeyThe key to the camera segment.
viewA pointer to the HBaseView object.
virtual void HUtilityGeomHandle::ResetHandle ( HC_KEY  handlekey,
float  scale = 0.5f,
HBaseView view = 0 
) [virtual]

This method shows the given handle with default values.

Parameters:
handlekeyThe key to the handle segment.
scaleThe scale factor for the handle.
void HUtilityGeomHandle::Rotate ( HC_KEY  handlekey,
float  rotangle 
)

This method applies a given rotation angle to the associated geometry of the handle.

Parameters:
handlekeyThe key to the handle segment.
rotangleThe angle of rotation in degrees.
virtual void HUtilityGeomHandle::Scale ( HC_KEY  handlekey,
float  scalex,
float  scaley,
float  scalez 
) [virtual]

This method applies a scale matrix to the geometry associated with the given handle.

Parameters:
handlekeyThe key to the handle segment.
scalexThe scale factor in x direction.
scaleyThe scale factor in y direction.
scalezThe scale factor in z direction.
static HC_KEY HUtilityGeomHandle::SelectHandle ( HBaseView view,
HPoint  pos 
) [static]

This method finds the handle that is closest to the given screen position.

Parameters:
viewA pointer to the view object.
posThe screen position.
Returns:
The key of the closest handle or INVALID_KEY if no handle was found.
static HC_KEY HUtilityGeomHandle::SelectObject ( HBaseView view,
HPoint  pos,
HC_KEY  oldkey,
bool  exclude,
float  proximity = 0.3 
) [static]

This method finds an object to attach handles to based on the given screen position.

Parameters:
viewA pointer to view object.
posThe screen position.
oldkeyThe key to the currently active object.
excludePass true to exclude currently active object from the search or false if you want to include it in the search.
proximityThe selection proximity to be used. Pass a negative number for "no selection proximity"
Returns:
The key of the object that was found or INVALID_KEY if no object was found.
static void HUtilityGeomHandle::SetupCuttingPlane ( HC_KEY  key,
HBaseView view 
) [static]

This method has been deprecated. Please use SetupCuttingPlaneManipulator instead.

Parameters:
keyThe cutting plane segment to attach handles to.
viewA pointer to the view object.
static void HUtilityGeomHandle::SetupCuttingPlaneManipulator ( HC_KEY  startkey,
HBaseView view,
HPoint midpoint = 0,
bool  omit_rotate = false 
) [static]

This method attaches default handles to a cutting plane object.

Parameters:
startkeyThe cutting plane segment to attach handles to.
viewA pointer to the view object.
virtual void HUtilityGeomHandle::SetupGeomHandleSegment ( bool  edges) [virtual]

This method sets default attributes for the handle segment which includes turning LOD off and backplane culling.

Parameters:
edgesPass true to display edges for handle arrows.
static HC_KEY HUtilityGeomHandle::SetupManipulator ( HC_KEY  startkey,
HBaseView view,
HPoint mp,
bool  AddNonUniformScale = true,
bool  AddScale = true,
bool  AddPlane = true,
bool  AddAxismove = true,
bool  AddAxisrotate = true,
bool  AddViewplaneMove = true 
) [static]

This method attaches handles with the specified attributes to the given object.

Parameters:
startkeyThe segment key to attach handles to.
viewA pointer to the view object.
mpThe midpoint for the handles.
AddNonUniformScalePass true to create a handle of this type.
AddScalePass true to create a handle of this type.
AddPlanePass true to create a handle of this type.
AddAxismovePass true to create a handle of this type.
AddAxisrotatePass true to create a handle of this type.
AddViewplaneMovePass true to create a handle of this type.
Returns:
The top level key that contains all the newly created handles.
static void HUtilityGeomHandle::SetupObject ( HC_KEY  key,
HBaseView view,
float  boxzoom = 1.0f 
) [static]

This method attaches default handles to a given object.

Parameters:
keyThe key to the segment to attach handles to.
viewA pointer to the view object.
boxzoomThe default scale factor for the object's bounding box.
static void HUtilityGeomHandle::SetupTextObject ( HC_KEY  key,
HBaseView view,
float  boxzoom = 1.0f,
float  scale = 1.0f 
) [static]

This method attaches default handles to a given text object.

Parameters:
keyThe key to the segment to attach handles to.
viewA pointer to the view object.
boxzoomThe default scale factor for the object's bounding box.
scaleThe text scale factor.
static void HUtilityGeomHandle::SetVisibilityForAll ( HC_KEY  startkey,
const char *  visibility 
) [static]

This method sets the visibility for all handles.

Parameters:
startkeyThe start key to search for handles.
visibilityThe visibility setting as described in HC_Set_Visibility.
virtual void HUtilityGeomHandle::ShowBasePosition ( HC_KEY  handlekey,
HPoint bp 
) [virtual]

This method shows the initial position of the given handle relative to segment attached to the handle.

Parameters:
handlekeyThe key to the handle segment.
bpReturns the coordinate of the initial handle position.
virtual void HUtilityGeomHandle::ShowHandle ( HC_KEY  handlekey,
float  sf = 0.7f,
HBaseView view = 0 
) [virtual]

This method shows the given handle with the passed scale factor and with a symbol based on constraint type.

Parameters:
handlekeyThe key to handle segment.
sfThe scale factor for the handle.
virtual void HUtilityGeomHandle::TurnOff ( HC_KEY  handlekey) [virtual]

This method delete the geometry associated with the handle.

Parameters:
handlekeyThe key to the handle segment.

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