HPS::HandlesOperator Class Reference

#include <sprk_ops.h>

Inheritance diagram for HPS::HandlesOperator:
HPS::Operator HPS::Sprocket HPS::Object

Classes

class  GeometryTransformedEvent
 

Public Types

enum  HandleType {
  HandleType::Rotation, HandleType::RotationX, HandleType::RotationY, HandleType::RotationZ,
  HandleType::AxisTranslation, HandleType::AxisTranslationX, HandleType::AxisTranslationY, HandleType::AxisTranslationZ,
  HandleType::PlaneTranslation, HandleType::PlaneTranslationXY, HandleType::PlaneTranslationYZ, HandleType::PlaneTranslationZX,
  HandleType::CenterPoint
}




 
- Public Types inherited from HPS::Operator
enum  Priority { Low, Default, High }
 

Public Member Functions

void AddHandles (HandleType handle_type)
 
void DismissHandles ()
 
CADModel GetCADModel () const
 
void GetHandlesAppearance (float &out_length, float &out_radius, size_t &out_handles_points) const
 
MaterialKitArray GetHandlesColors () const
 
RGBAColor GetHighlightColor () const
 
virtual HPS::UTF8 GetName () const override
 
void GetPlaneTranslationAppearance (float &out_plane_offset, float &out_plane_length, float &out_center_radius) const
 
void GetRotationHandleAppearance (float &out_offset, float &out_angle, float &out_tip_size) const
 
bool GetTrailingGeometry () const
 
 HandlesOperator (MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
virtual bool OnMouseDown (MouseState const &in_state) override
 
virtual bool OnMouseMove (MouseState const &in_state) override
 
virtual bool OnMouseUp (MouseState const &in_state) override
 
virtual bool OnTouchDown (TouchState const &in_state) override
 
virtual bool OnTouchMove (TouchState const &in_state) override
 
virtual bool OnTouchUp (TouchState const &in_state) override
 
virtual void OnViewAttached (HPS::View const &in_attached_view) override
 
virtual void OnViewDetached (HPS::View const &in_detached_view) override
 
void RemoveHandles (HandleType handle_type)
 
void SetCADModel (CADModel const &in_cad_model)
 
void SetHandlesAppearance (float in_length=0.16f, float in_radius=0.005f, size_t in_handles_points=30)
 
void SetHandlesColors (MaterialKitArray const &in_colors)
 
void SetHighlightColor (RGBAColor const &in_highlight_color)
 
void SetPlaneTranslationAppearance (float in_plane_offset=0.2f, float in_plane_length=0.6f, float in_center_radius=0.2f)
 
void SetRotationHandleAppearance (float in_offset=0.045f, float in_angle=25.0f, float in_tip_size=0.15f)
 
void SetTrailingGeometry (bool in_state)
 
- Public Member Functions inherited from HPS::Operator
virtual void Assign (Operator const &in_that)
 
void DetachView ()
 
virtual bool Equals (Operator const &in_that) const
 
View GetAttachedView () const
 
ModifierKeys GetModifierTrigger () const
 
MouseButtons GetMouseTrigger () const
 
virtual bool IsMouseTriggered (MouseState const &in_state)
 
HPS::Type ObjectType () const
 
virtual bool OnKeyDown (KeyboardState const &in_state)
 
virtual bool OnKeyUp (KeyboardState const &in_state)
 
virtual void OnModelAttached ()
 
virtual void OnModelDetached ()
 
virtual bool OnMouseEnter (MouseState const &in_state)
 
virtual bool OnMouseLeave (MouseState const &in_state)
 
virtual bool OnMouseWheel (MouseState const &in_state)
 
virtual bool OnTextInput (HPS::UTF8 const &in_text)
 
virtual bool OnTimerTick (HPS::TimerTickEvent const &in_event)
 
 Operator (MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
 Operator (Operator const &in_that)
 
virtual bool operator!= (Operator const &in_that) const
 
virtual Operatoroperator= (Operator const &in_that)
 
virtual bool operator== (Operator const &in_that) const
 
void SetModifierTrigger (ModifierKeys in_modifiers)
 
void SetMouseTrigger (MouseButtons in_buttons)
 
- Public Member Functions inherited from HPS::Sprocket
 Sprocket (Sprocket &&in_that)
 
- Public Member Functions inherited from HPS::Object
virtual bool Empty () const
 
intptr_t GetClassID () const
 
intptr_t GetInstanceID () const
 
bool HasType (HPS::Type in_mask) const
 
 Object (Object const &that)
 
 Object (Object &&in_that)
 
Objectoperator= (Object const &other_object)
 
Objectoperator= (Object &&in_that)
 
virtual void Reset ()
 
virtual HPS::Type Type () const
 

Additional Inherited Members

- Static Public Member Functions inherited from HPS::Object
template<typename T >
static intptr_t ClassID ()
 
- Static Public Attributes inherited from HPS::Operator
static const HPS::Type staticType = HPS::Type::Operator
 
- Static Public Attributes inherited from HPS::Object
static const HPS::Type staticType = HPS::Type::None
 
- Protected Attributes inherited from HPS::Operator
HPS::ModifierKeys modifier_trigger
 
HPS::MouseButtons mouse_trigger
 

Detailed Description

The HandlesOperator class defines an operator which allows the user to translate geometry in the view plane or along an axis. This operator works for both mouse- and touch-driven devices.

To use this operator on a mouse-driven device:

  1. Activate the operator
  2. Double click on a piece of geometry to activate the handles
  3. Click and drag the handles to transform the selected geometry
  4. Click on the background to dismiss the handles

To use this operator on a touch-driven device:

  1. Activate the operator
  2. Double tap on a piece of geometry to activate the handles
  3. Tap and drag the handles to move the selected geometry
  4. Tap on the background to dismiss the handles

This operator works on the segment containing the geometry selected. An event of type GeometryTransformedEvent is dispatched after the handles are dismissed, containing the information on which segment was affected and what transform was applied to it.

This operator does not work on Exchange models which have a Drawing structure. This includes CATDrawing models and 2D DWG models loaded through Exchange. Any attempt to use this operator on such a model will produce a warning.

Member Enumeration Documentation

◆ HandleType

Enumerator
Rotation 

Represents three all rotation handles.

RotationX 

Represents handle for rotation around the X axis.

RotationY 

Represents handle for rotation around the Y axis.

RotationZ 

Represents handle for rotation around the Z axis.

AxisTranslation 

Represents three all axis translation handles.

AxisTranslationX 

Represents handle for translation along the X axis.

AxisTranslationY 

Represents handle for translation along the Y axis.

AxisTranslationZ 

Represents handle for translation along the Z axis.

PlaneTranslation 

Represents three all plane translation handles.

PlaneTranslationXY 

Represents handle for translation along the XY plane.

PlaneTranslationYZ 

Represents handle for translation along the YZ plane.

PlaneTranslationZX 

Represents handle for translation along the ZX plane.

CenterPoint 

Represents handle for translation along the view plane.

Member Function Documentation

◆ AddHandles()

void HPS::HandlesOperator::AddHandles ( HandleType  handle_type)

Add a type of handle to those displayed by this operator. Changes take place the next time handles are inserted, by either double clicking or double tapping on geometry.

Parameters
handle_typeThe type of handle to be added to those displayed.

◆ GetCADModel()

CADModel HPS::HandlesOperator::GetCADModel ( ) const
inline

Returns the CADModel associated with this operator. If no CADModel was associated with this operator, the returned object will be invalid and have type HPS::Type::None.

Returns
The CADModel associated with this operator.

◆ GetHandlesAppearance()

void HPS::HandlesOperator::GetHandlesAppearance ( float &  out_length,
float &  out_radius,
size_t &  out_handles_points 
) const

Returns the parameters used to decide the appearance of the handles.

Parameters
out_lengthThe length of the handles, specified as a percentage of the view containing it.
out_radiusThe radius of the handles, specified as a percentage of the view containing it.
out_handles_pointsThe number of points used to draw the handles. A higher number will yield a smoother appearance.

◆ GetHandlesColors()

MaterialKitArray HPS::HandlesOperator::GetHandlesColors ( ) const
inline

This function returns the materials used to color the handles. Only the diffuse color field of the materials is guaranteed to have a value. The materials are used as follows:

Entry 0 - translation handle in the x direction Entry 1 - translation handle in the y direction Entry 2 - translation handle in the z direction Entry 3 - rotation handle in the x direction Entry 4 - rotation handle in the y direction Entry 5 - rotation handle in the z direction Entry 6 - xz plane translation Entry 7 - xy plane translation Entry 8 - yz plane translation Entry 9 - center-sphere

Returns
An array of materials associated with the handles

◆ GetHighlightColor()

RGBAColor HPS::HandlesOperator::GetHighlightColor ( ) const
inline

Returns the color used to highlight the handles then the user mouses over them.

Returns
the color used to highlight the handles then the user mouses over them.

◆ GetName()

virtual HPS::UTF8 HPS::HandlesOperator::GetName ( ) const
inlineoverridevirtual

Returns the name of the operator.

Reimplemented from HPS::Operator.

◆ GetPlaneTranslationAppearance()

void HPS::HandlesOperator::GetPlaneTranslationAppearance ( float &  out_plane_offset,
float &  out_plane_length,
float &  out_center_radius 
) const

Returns the parameters used to decide the appearance of the rotation handles.

Parameters
out_plane_offsetThe distance between the axis translation handle and the start of the plane translation handle, specified as a percentage of handle length.
out_plane_lengthThe size of plane translation handles, specified as a percentage of handle length.
out_center_radiusThe radius of the sphere at the center of the handles, specified as a percentage of handle length.

◆ GetRotationHandleAppearance()

void HPS::HandlesOperator::GetRotationHandleAppearance ( float &  out_offset,
float &  out_angle,
float &  out_tip_size 
) const

Returns the parameters used to decide the appearance of the rotation handles.

Parameters
out_offsetThe distance between the end of a translation handle and the rotation handle associated with it, specified as a percentage of handle length.
out_angleThe angle formed by the rotation handles, specified in degrees.
out_tip_sizeThe size of the tip at the end of the handles, specified as a percentage of handle length.

◆ GetTrailingGeometry()

bool HPS::HandlesOperator::GetTrailingGeometry ( ) const
inline

Whether trailing geometry will be drawn when using the handles. Trailing geometry is geometry which shows you the path of the last movement operation you performed through the handles.

Returns
true if trailing geometry will be drawn, false otherwise.

◆ OnMouseDown()

virtual bool HPS::HandlesOperator::OnMouseDown ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was pressed. If the user double clicks on a piece of geometry, handles will be inserted there. If the user clicks on a handle, the segment containing that handle will be translated or rotated appropriately. The user can click on the background to remove the handles.

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseMove()

virtual bool HPS::HandlesOperator::OnMouseMove ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals the mouse moved When users click and drag a handle, the associated geometry will be translated or rotated as appropriate.

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseUp()

virtual bool HPS::HandlesOperator::OnMouseUp ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was released

Parameters
in_stateA MouseState object describing the current mouse state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchDown()

virtual bool HPS::HandlesOperator::OnTouchDown ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals the device was touched. If the user double taps a piece of geometry, handles will be inserted there. If the user taps on a handle, the segment containing that handle will be translated or rotated appropriately. The user can tap on the background to remove the handles.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchMove()

virtual bool HPS::HandlesOperator::OnTouchMove ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals a point of contact has moved. When users click and drag a handle, the associated geometry will be translated or rotated as appropriate.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnTouchUp()

virtual bool HPS::HandlesOperator::OnTouchUp ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals a point of contact has been released.

Parameters
in_stateA TouchState object describing the current touch state.
Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnViewAttached()

virtual void HPS::HandlesOperator::OnViewAttached ( HPS::View const &  in_attached_view)
overridevirtual

This function is called whenever a view is attached to this operator.

Parameters
in_attached_viewThe view attached to this operator.

Reimplemented from HPS::Operator.

◆ OnViewDetached()

virtual void HPS::HandlesOperator::OnViewDetached ( HPS::View const &  in_detached_view)
overridevirtual

This function is called whenever a view is detached from this operator.

Parameters
in_detached_viewThe view detached from this operator.

Reimplemented from HPS::Operator.

◆ RemoveHandles()

void HPS::HandlesOperator::RemoveHandles ( HandleType  handle_type)

Remove a type of handle from those displayed by this operator. Changes take place the next time handles are inserted, by either double clicking or double tapping on geometry.

Parameters
handle_typeThe type of handle to be removed from those displayed.

◆ SetCADModel()

void HPS::HandlesOperator::SetCADModel ( CADModel const &  in_cad_model)

Sets the CADModel associated with this operator. If a CADModel is set, the underlying PRC or Parasolid data associated with any Components moved by the user with the handles operator will be changed to reflect how the CADModel appears on the user's screen. This function needs to be called before the user starts transforming geometry through the handles operator.

Parameters
in_cad_modelThe CADModel associated with this operator.

◆ SetHandlesAppearance()

void HPS::HandlesOperator::SetHandlesAppearance ( float  in_length = 0.16f,
float  in_radius = 0.005f,
size_t  in_handles_points = 30 
)

This function can be used to modify the appearance of handles. Changes will take effect the next time handles are inserted.

Parameters
in_lengthThe length of the handles, specified as a percentage of the view containing it. Valid range is (0, 1].
in_radiusThe radius of the handles, specified as a percentage of the view containing it. Valid range is (0, 1].
in_handles_pointsThe number of points used to draw the handles. A higher number will yield a smoother appearance. Valid range is > 0.

◆ SetHandlesColors()

void HPS::HandlesOperator::SetHandlesColors ( MaterialKitArray const &  in_colors)
inline

This function is used to provide a set of colors which will be applied to the handles. The changes will take effect the next time the handles are inserted. The materials need to contain a diffuse color, and will be applied as follows: Entry 0 - translation handle in the x direction Entry 1 - translation handle in the y direction Entry 2 - translation handle in the z direction Entry 3 - rotation handle in the x direction Entry 4 - rotation handle in the y direction Entry 5 - rotation handle in the z direction Entry 6 - xz plane translation Entry 7 - xy plane translation Entry 8 - yz plane translation Entry 9 - center-sphere

Parameters
in_colorsAn array of materials to be applied to the handles.

◆ SetHighlightColor()

void HPS::HandlesOperator::SetHighlightColor ( RGBAColor const &  in_highlight_color)

Sets the highlight color used when the user mouses over the handles. The default value for the highlight color is RGBAColor(1.0f, 0.55f, 0.0f)

Parameters
in_highlight_colorThe color used to highlight handles when the user mouses over them.

◆ SetPlaneTranslationAppearance()

void HPS::HandlesOperator::SetPlaneTranslationAppearance ( float  in_plane_offset = 0.2f,
float  in_plane_length = 0.6f,
float  in_center_radius = 0.2f 
)

This function can be used to modify the appearance of the handles used to perform plane-translation. Changes will take effect the next time handles are inserted.

Parameters
in_plane_offsetThe distance between the axis translation handle and the start of the plane translation handle, specified as a percentage of handle length.
in_plane_lengthThe size of plane translation handles, specified as a percentage of handle length.
in_center_radiusThe radius of the sphere at the center of the handles, specified as a percentage of handle length.

◆ SetRotationHandleAppearance()

void HPS::HandlesOperator::SetRotationHandleAppearance ( float  in_offset = 0.045f,
float  in_angle = 25.0f,
float  in_tip_size = 0.15f 
)

This function can be used to modify the appearance of handles used to perform rotations. Changes will take effect the next time handles are inserted.

Parameters
in_offsetThe distance between the end of a translation handle and the start of then rotation handle associated with it, specified as a percentage of handle length. Valid range is (0, 1].
in_angleThe angle formed by the rotation handles, specified in degrees. Valid range is > 0
in_tip_sizeThe size of the tip at the end of the handles, specified as a percentage of the handle length. Valid range is [0, 1].

◆ SetTrailingGeometry()

void HPS::HandlesOperator::SetTrailingGeometry ( bool  in_state)
inline

Whether to draw trailing geometry when using the handles. Trailing geometry is geometry which shows you the path of the last movement operation you performed through the handles.

Parameters
in_stateWhether to draw trailing geometry when using the handles.

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