HPS::Exchange::MeasurementOperator Class Reference

#include <sprk_exchange.h>

Inheritance diagram for HPS::Exchange::MeasurementOperator:
HPS::Exchange::CommonMeasurementOperator HPS::Operator HPS::Sprocket HPS::Object

Public Types

enum  MeasurementType { PointToPoint, EdgeAndRadius, FeatureToFeature, FaceAngle }
 
- Public Types inherited from HPS::Exchange::CommonMeasurementOperator
enum  Tags {
  Name = 0, MeasurementType, Radius, Inverted,
  VectorX, VectorY, VectorZ
}


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

Public Member Functions

void DeleteLastMeasurement ()
 
HighlightOptionsKit GetHighlightOptions ()
 
MeasurementType GetMeasurementType ()
 
bool GetMouseOverHighlighting ()
 
virtual HPS::UTF8 GetName () const override
 
bool IsMeasurementActive ()
 
 MeasurementOperator (Exchange::CADModel const &in_cad_model, MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
virtual bool OnKeyDown (KeyboardState const &in_state) override
 
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 SetMeasurementType (MeasurementType in_measurement_type)
 
void SetMouseOverHighlighting (bool in_highlighting)
 
void SetMouseOverHighlighting (bool in_highlighting, HighlightOptionsKit const &in_highlight_options_kit)
 
- Public Member Functions inherited from HPS::Exchange::CommonMeasurementOperator
 CommonMeasurementOperator (Exchange::CADModel const &in_cad_model, MouseButtons in_mouse_trigger=MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger=ModifierKeys())
 
void DeleteMeasurements ()
 
Exchange::CADModel GetCADModel () const
 
MaterialMappingKit GetMaterial () const
 
SegmentKey GetMeasurementSegment () const
 
size_t GetPrecision () const
 
TextAttributeKit GetTextAttributes () const
 
void SetCADModel (Exchange::CADModel const &in_cad_model)
 
void SetMaterial (MaterialMappingKit const &in_material_mapping)
 
void SetPrecision (size_t in_precision)
 
void SetTextAttribute (TextAttributeKit const &in_text_attributes)
 
- 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 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::Exchange::CommonMeasurementOperator
static UTF8 GetNewMeasurementSegmentName (HPS::UTF8 const &in_prefix)
 
- 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 Member Functions inherited from HPS::Exchange::CommonMeasurementOperator
void GetCameraDirection ()
 
float GetModelScale (Exchange::Component const &component)
 
void GetUnits ()
 
void PositionLinearMeasurementGeometry (WindowPoint const &window_cursor_location, KeyPath const &event_path, LineKey &leader_line_one, LineKey &leader_line_two, LineKey &measurement_line, LineKey &line_to_cursor, Point &original_point_one, Point &original_point_two, TextKey &text, UTF8 const &text_string, Point &distance_point_one, Point &distance_point_two, SegmentKey &current_measurement_segment, Plane const &measurement_plane=Plane(), Vector const &explicit_direction=Vector())
 
void SetGlyphColor ()
 
void SetMaterialsOnMeasurementSegment (HPS::SegmentKey const &set_materials_here, HPS::MaterialMappingKit const &materials_to_apply)
 
void SetupConstructionSegment ()
 
void Tag (HPS::Key &tag, const char *message, Tags tag_index)
 
- Protected Attributes inherited from HPS::Exchange::CommonMeasurementOperator
Exchange::CADModel cad_model
 
Vector camera_direction
 
HighlightOptionsKit highlight_options
 
GlyphDefinition left_arrow
 
bool manipulate_measurement
 
MaterialMappingKit materials
 
size_t measurement_precision
 
SegmentKey measurement_segment
 
PortfolioKey portfolio
 
GlyphDefinition right_arrow
 
SelectionOptionsKit selection_options
 
SegmentKey style_segment
 
TextAttributeKit text_attributes
 
UTF8 units
 
- Protected Attributes inherited from HPS::Operator
HPS::ModifierKeys modifier_trigger
 
HPS::MouseButtons mouse_trigger
 
- Static Protected Attributes inherited from HPS::Exchange::CommonMeasurementOperator
static size_t angle_measurement_index
 
static size_t distance_measurement_index
 
static size_t length_measurement_index
 
static size_t radius_measurement_index
 

Detailed Description

The MeasurementOperator class defines an operator which allows the user to insert measurements into the scene This operator requires the model be loaded using the Exchange bridge, and the model must contain B-rep.

The behavior of the operator, and its usage, vary based on the type of measurement the user wishes to insert.

  • Point to Point measurement: The Point to Point measurement mode allows the user to measure the distance between two arbitrary points. Usage:
  • Click or tap where you want to insert the first measurement point.
  • Click or tap where you want to insert the second measurement point
  • Move the mouse or drag your finger to move the measurement geometry around.
  • Click or lift your finger to position the measurement.
  • Edge and Radius measurement: The Edge and Radius measurement mode allows the user to measure the length of an edge, or the radius of a circle, based on whether the edge clicked on is a line or a circle. Usage:
  • Click or tap on the edge you want to measure
  • Move the mouse or drag your finger to move the measurement geometry around.
  • Click again or lift your finger to position the measurement.
  • If the edge you selected is part of a circle, the circle radius will be measured, otherwise the edge length will be measured.
  • Feature to Feature measurement: The Feature to Feature measurement mode allows the user to measure the shortest distance between two features. Usage:
  • Click or tap on a face
  • Click or tap on a different face
  • Move the mouse or drag your finger to move the measurement geometry around.
  • Click again or lift your finger to position the measurement.
  • If both faces are planar, the shortest distance between them is measured
  • If one face is planar and the other is id conical or cylindrical, the shortest distance between the center line and the face is measured
  • If both faces are conical or cylindrical, the shortest distance between the two center lines is measured
  • Face Angle measurement: The Face Angle measurement mode allows the user to measure the angle between two planar, non-parallel faces. Usage:
  • Click or tap on a face
  • Click or tap on a different face, which is not parallel to the first face
  • Move the mouse or drag your finger to move the measurement geometry around.
  • Click again or lift your finger to position the measurement.

Once a measurement has been inserted, its position can be modified by clicking on it, moving the mouse, and clicking once more once it is in the desired position. On touch-enabled devices measurements can be repositioned by dragging them into a new position. Pressing Escape will delete the measurement currently being inserted.

The operator will inject an Event of type MeasurementInsertedEvent every time a new measurement is inserted. The user can handle this event to obtain the segment key associated with every inserted measurement.

A valid CADModel needs to be passed to the constructor of this class.

Member Function Documentation

◆ DeleteLastMeasurement()

void HPS::Exchange::MeasurementOperator::DeleteLastMeasurement ( )

Delete the current measurement and brings the operator back to a state to start a new measurement

◆ GetHighlightOptions()

HighlightOptionsKit HPS::Exchange::MeasurementOperator::GetHighlightOptions ( )

Returns the highlight option kit currently used for mouse over highlighting.

Returns
the highlight option kit currently used for mouse over highlighting.

◆ GetMeasurementType()

MeasurementType HPS::Exchange::MeasurementOperator::GetMeasurementType ( )

Returns the type of measurement the operator is currently set up to insert.

Returns
The type of measurement the operator is currently set up to insert.

◆ GetMouseOverHighlighting()

bool HPS::Exchange::MeasurementOperator::GetMouseOverHighlighting ( )

Whether measurable geometry is highlighted when mousing over it

Returns
true if measurable geometry is highlighted on mouse over, false otherwise.

◆ GetName()

virtual HPS::UTF8 HPS::Exchange::MeasurementOperator::GetName ( ) const
inlineoverridevirtual

Returns the name of the operator.

Reimplemented from HPS::Exchange::CommonMeasurementOperator.

◆ IsMeasurementActive()

bool HPS::Exchange::MeasurementOperator::IsMeasurementActive ( )

Whether a measurement is currently being inserted or edited.

Returns
true if a measurement is being inserted or manipulated, false otherwise.

◆ OnKeyDown()

virtual bool HPS::Exchange::MeasurementOperator::OnKeyDown ( KeyboardState const &  in_state)
overridevirtual

This function is called whenever HPS receives a KeyDownEvent that signals a key was pressed. Pressing Escape while in the process of inserting a measurement deletes that measurement.

Returns
true if the input event was handled, false otherwise.

Reimplemented from HPS::Operator.

◆ OnMouseDown()

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

This function is called whenever HPS receives a MouseEvent that signals a mouse button was pressed. This function inserts the measuring points.

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::Exchange::MeasurementOperator::OnMouseMove ( MouseState const &  in_state)
overridevirtual

This function is called whenever HPS receives a MouseEvent that signals the mouse moved When the user has just inserted the second measurement point, this function allows the user to move the measurement If the user has selected an already existing measurement, this function allows the user to reposition the measurement

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::Exchange::MeasurementOperator::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::Exchange::MeasurementOperator::OnTouchDown ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals the device was touched. This function inserts the measuring points.

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::Exchange::MeasurementOperator::OnTouchMove ( TouchState const &  in_state)
overridevirtual

This function is called whenever HPS receives a TouchEvent that signals a point of contact has moved. When the user has just inserted the second measurement point, this function allows the user to move the measurement If the user has selected an already existing measurement, this function allows the user to reposition the measurement

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::Exchange::MeasurementOperator::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::Exchange::MeasurementOperator::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::Exchange::CommonMeasurementOperator.

◆ OnViewDetached()

virtual void HPS::Exchange::MeasurementOperator::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::Exchange::CommonMeasurementOperator.

◆ SetMeasurementType()

void HPS::Exchange::MeasurementOperator::SetMeasurementType ( MeasurementType  in_measurement_type)

Sets the type of measurement to insert.

Parameters
in_measurement_typeThe type of measurement to insert.

◆ SetMouseOverHighlighting() [1/2]

void HPS::Exchange::MeasurementOperator::SetMouseOverHighlighting ( bool  in_highlighting)

Whether measurable geometry should be highlighted when mousing over it

Parameters
in_highlightingWhether measurable geometry should be highlighted when mousing over it.

◆ SetMouseOverHighlighting() [2/2]

void HPS::Exchange::MeasurementOperator::SetMouseOverHighlighting ( bool  in_highlighting,
HighlightOptionsKit const &  in_highlight_options_kit 
)

Whether measurable geometry should be highlighted when mousing over it

Parameters
in_highlightingWhether measurable geometry should be highlighted when mousing over it.
in_highlight_options_kitThe highlight kit used for mouse over highlights

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