Inheritance diagram for HPS.MeasurementOperator:
HPS.Operator HPS.Sprocket HPS.Object

Classes

class  MeasurementEvent
 

Public Types

enum  DistanceMeasurementReference { DistanceMeasurementReference.Entity = 0, DistanceMeasurementReference.Body = 1 }
 
enum  LineMeasurementPosition { LineMeasurementPosition.LastPoint = 0, LineMeasurementPosition.FirstPoint = 1, LineMeasurementPosition.MidPoint = 2 }
 
enum  MeasurementType {
MeasurementType.PointToPoint = 0, MeasurementType.Line = 1, MeasurementType.Angle = 2, MeasurementType.Area = 3,
MeasurementType.Distance = 4
}


 
enum  SelectionHint { SelectionHint.Snapped = 0, SelectionHint.Valid = 1, SelectionHint.Invalid = 2 }
 
- Public Types inherited from HPS.Operator
enum  Priority { Low = 0, Default = 1, High = 2 }
 

Public Member Functions

void DeleteAllMeasurements ()
 
override void Dispose ()
 
HPS.MeasurementOperator.DistanceMeasurementReference GetDistanceMeasurementReference ()
 
HPS.SegmentKey GetHintSegment (HPS.MeasurementOperator.SelectionHint in_hint)
 
HPS.MeasurementOperator.LineMeasurementPosition GetLineMeasurementPosition ()
 
HPS.MeasurementOperator.MeasurementType GetMeasurementType ()
 
override string GetName ()
 
ulong GetPrecision ()
 
bool GetSelectionHinting ()
 
void GetVertexSnapping (out bool out_state, out float out_proximity)
 
MeasurementOperator (HPS.MouseButtons in_mouse_trigger, HPS.ModifierKeys in_modifier_trigger)
 
MeasurementOperator (HPS.MouseButtons in_mouse_trigger)
 
MeasurementOperator (HPS.MeasurementOperator in_that)
 
override bool OnKeyDown (HPS.KeyboardState in_state)
 
override void OnModelAttached ()
 
override void OnModelDetached ()
 
override bool OnMouseDown (HPS.MouseState in_state)
 
override bool OnMouseMove (HPS.MouseState in_state)
 
override bool OnMouseUp (HPS.MouseState in_state)
 
override bool OnTouchDown (HPS.TouchState in_state)
 
override bool OnTouchMove (HPS.TouchState in_state)
 
override bool OnTouchUp (HPS.TouchState in_state)
 
override void OnViewAttached (HPS.View in_attached_view)
 
override void OnViewDetached (HPS.View in_detached_view)
 
void SetDistanceMeasurementReference (HPS.MeasurementOperator.DistanceMeasurementReference in_reference)
 
void SetLineMeasurementPosition (HPS.MeasurementOperator.LineMeasurementPosition in_position)
 
void SetMeasurementType (HPS.MeasurementOperator.MeasurementType in_measurement_type)
 
void SetPrecision (ulong in_precision)
 
void SetSelectionHinting (bool in_state)
 
void SetVertexSnapping (bool in_state, float in_proximity)
 
void SetVertexSnapping (bool in_state)
 
- Public Member Functions inherited from HPS.Operator
virtual void Assign (HPS.Operator in_that)
 
void DetachView ()
 
delegate void DtorDelegate (IntPtr cPtr)
 
override bool Equals (System.Object obj)
 
virtual bool Equals (HPS.Operator in_that)
 
HPS.View GetAttachedView ()
 
override int GetHashCode ()
 
HPS.ModifierKeys GetModifierTrigger ()
 
HPS.MouseButtons GetMouseTrigger ()
 
virtual bool IsMouseTriggered (HPS.MouseState in_state)
 
override HPS.Type ObjectType ()
 
virtual bool OnKeyUp (HPS.KeyboardState in_state)
 
virtual bool OnMouseEnter (HPS.MouseState in_state)
 
virtual bool OnMouseLeave (HPS.MouseState in_state)
 
virtual bool OnMouseWheel (HPS.MouseState in_state)
 
virtual bool OnTextInput (string in_text)
 
virtual bool OnTimerTick (HPS.TimerTickEvent in_event)
 
Operator (HPS.MouseButtons in_mouse_trigger, HPS.ModifierKeys in_modifier_trigger)
 
Operator (HPS.MouseButtons in_mouse_trigger)
 
Operator (HPS.Operator in_that)
 
delegate void RemoveCacheItemDelegate (IntPtr cPtr)
 
void SetModifierTrigger (HPS.ModifierKeys in_modifiers)
 
void SetMouseTrigger (HPS.MouseButtons in_buttons)
 
- Public Member Functions inherited from HPS.Sprocket
Sprocket (HPS.Sprocket in_that)
 
- Public Member Functions inherited from HPS.Object
virtual bool Empty ()
 
IntPtr GetClassID ()
 
IntPtr GetInstanceID ()
 
bool HasType (HPS.Type in_mask)
 
Object (HPS.Object that)
 
virtual void Reset ()
 
virtual HPS.Type Type ()
 

Protected Member Functions

override void deleteCptr ()
 
override bool DerivedClassHasMethod (string methodName, System.Type[] methodTypes)
 
override IntPtr GetNonDirectorClassID ()
 
override bool IsUserDerived ()
 

Additional Inherited Members

- Static Public Member Functions inherited from HPS.Operator
static bool operator!= (HPS.Operator a, HPS.Operator b)
 
static bool operator== (HPS.Operator a, HPS.Operator b)
 
- Static Public Member Functions inherited from HPS.Object
static IntPtr ClassID< T > ()
 
- Protected Attributes inherited from HPS.Operator
HandleRef sptr
 
- Protected Attributes inherited from HPS.Object
bool cMemOwn
 
HandleRef cptr
 
- Static Protected Attributes inherited from HPS.Operator
static Dictionary< IntPtr, OperatorcachedObjects = new Dictionary<IntPtr, Operator>()
 
static Dictionary< IntPtr, WeakReference > cachedWeakRefs = new Dictionary<IntPtr, WeakReference>()
 
static ReaderWriterLockSlim mapLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion)
 

Detailed Description

The MeasurementOperator class defines an operator which allows the user to measure geometry. This operator responds to both mouse and touch events. Five different measuring types are available: Point to Point, Line, Angle, Area and Distance. Whenever a measurement is inserted, an Event of type MeasurementEvent is injected. This event can be handled in order to to get details about the measurement (its type and value), which View it was inserted under, and what Segment it was placed on. This information, and specifically the segment in which the measurement is placed, can be used to customize the appearance of the measurement, to delete it, hide it, etc...

When vertex snapping is enabled, the measurement operator will try to snap to vertices close to the location that was clicked / touched. The value of the proximity snapping is expressed in centimeter. Snapping is not taken into consideration when placing Distance measurements.

If hinting is turned on, which it is by default, the operator will give the user feedback on what would be measured if a click were to happen at the current position. This feedback is given in the form of markers of various shapes. By default, an X means that the clicking the current point will not yield a measurement point. This can happen if the click happens off the geometry or if the current point would otherwise be invalid (for example, if the point would not be on the same plane as the other points which describe an area measurement). When vertex snapping is enabled, a square denotes the position the measurement point would snap to. Finally, a circle indicates that the current selection is valid but would not be snapped to a vertex. The look of these hinting geometry can be changed at anytime by editing the attributes found in their owning segments. The segments can be obtained through a call to GetHintSegment Hinting geometry is not enabled for Distance measurement, since the individual points picked are not relevant in this mode.

The number of decimal place shown in measurement labels can be changed through the SetPrecision function, and defaults to 2.

When working with a CADModel, the CADModel can be passed to this operator through the SetCADModel function. Setting a CADModel allows the operator to detect the unit of measurements used in the loaded file, which will be displayed when inserting measurement labels. When a CADModel is not set, measurements are considered unit-less.

While inserting a measurement, the last point inserted can be undone by pressing CTRL+Z. Note that in order to delete a single measurement that was already inserted, you should delete its associate segment, which can be obtained by intercepting MeasurementEvent events. Deleting all measurements at once can be easily done through the DeleteAllMeasurements function.

Notes about specific measurement types:<itemizedlist><listitem>

Line Measurements Lines are measured as points are picked. An arbitrary number of points describing a line can be picked. To signal that you are done describing a line, either select the last point inserted, or double click/tap anywhere in the scene The position of the label for Line Measurement can be chosen through the SetLineMeasurementPosition.

</listitem><listitem>

Area Measurements Placing at least three points is required when measuring an area. All points placed should be co-planar. After the third point has been inserted, attempting to insert a point that does not lie on the same plane will result in a warning, and the operator will discard this point. To signal that you are done inserting points for the area measurement, either select the first point inserted, or double click/tap anywhere in the scene.

</listitem><listitem>

Distance Measurements The distance measurement finds the shortest distance between two objects. The two objects in question can be either individual faceted Entities (shells, polygons, meshes, etc...) or Bodies. This setting can be controlled through the SetDistanceMeasurementReference function. When Bodies are selected as the reference, is a CADModel is not associated with this operator, Segments will be used instead. Note that when comparing whole bodies it might take a noticeable amount of time for the operator to complete the calculation.

</listitem></itemizedlist>

Member Enumeration Documentation

◆ DistanceMeasurementReference

Enumerator
Entity 

When measuring distance, only the specific entity selected will be considered.

Body 

When measuring distance, all faceted entities belonging to the selected body will be considered.

◆ LineMeasurementPosition

Enumerator
LastPoint 

Measurement text should be at the last selected point.

FirstPoint 

Measurement text should be at the first selected point.

MidPoint 

Measurement text should be at the mid-point of the line.

◆ MeasurementType

Enumerator
PointToPoint 

Measure the distance between two points.

Line 

Measure the length of a series of lines.

Angle 

Measure the angle between two lines.

Area 

Measure the area of a polygon on a plane.

Distance 

Measure the shortest distance between two objects.

◆ SelectionHint

Enumerator
Snapped 

If vertex snapping is enabled, hint goemetry is rendered over the closest vertex within the snapping proximity supplied to SetVertexSnapping.

Valid 

Hint goemetry is rendered under the mouse cursor indicating that a valid measurement point could be inserted at the underlying position. If vertex snapping is enabled this also indicates that the current position is outside the proximity specified to SetVertexSnapping.

Invalid 

Hint goemetry is rendered under the mouse cursor indicating that no valid measurement point could be inserted at the underlying position. This could be due to the cursor being over no visible geometry or the underlying position being invalid for usage with the current measurement type.

Member Function Documentation

◆ DeleteAllMeasurements()

void HPS.MeasurementOperator.DeleteAllMeasurements ( )
inline

Deletes all inserted measurements.

◆ GetDistanceMeasurementReference()

HPS.MeasurementOperator.DistanceMeasurementReference HPS.MeasurementOperator.GetDistanceMeasurementReference ( )
inline

Returns the reference used for distance measurements.

◆ GetHintSegment()

HPS.SegmentKey HPS.MeasurementOperator.GetHintSegment ( HPS.MeasurementOperator.SelectionHint  in_hint)
inline

Retrieves the segment key which contains the marker used for a given snapping hint. The appearance of the marker used for each hint type can be altered by modifying the attributes of the returned segment key.

Parameters
in_hintIndicates the hint type to retrieve the parent segment for. which contains the marker used to indicate the snapping state given the mouse position.

◆ GetLineMeasurementPosition()

HPS.MeasurementOperator.LineMeasurementPosition HPS.MeasurementOperator.GetLineMeasurementPosition ( )
inline

Returns where the line measurement text will be positioned.

◆ GetMeasurementType()

HPS.MeasurementOperator.MeasurementType HPS.MeasurementOperator.GetMeasurementType ( )
inline

Returns the type of measurement the operator will insert the next time a measurement operation is started

◆ GetName()

override string HPS.MeasurementOperator.GetName ( )
inlinevirtual

Returns the name of the operator.

Reimplemented from HPS.Operator.

◆ GetPrecision()

ulong HPS.MeasurementOperator.GetPrecision ( )
inline

Returns the precision used in the measurement (number of digits after the decimal point)

◆ GetSelectionHinting()

bool HPS.MeasurementOperator.GetSelectionHinting ( )
inline

Whether hint geometry is shown during point selection.

◆ GetVertexSnapping()

void HPS.MeasurementOperator.GetVertexSnapping ( out bool  out_state,
out float  out_proximity 
)
inline

Whether to snap to vertices during selection.

◆ OnKeyDown()

override bool HPS.MeasurementOperator.OnKeyDown ( HPS.KeyboardState  in_state)
inlinevirtual

This function is called whenever HPS receives a KeyboardState event that signals a button was pressed. This function is used to undo a measurement point when CTRL+Z is pressed

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

Reimplemented from HPS.Operator.

◆ OnModelAttached()

override void HPS.MeasurementOperator.OnModelAttached ( )
inlinevirtual

This function is called whenever a model is attached to the view that is attached to this operator. If no view is attached to this operator, this function will not be called.

Reimplemented from HPS.Operator.

◆ OnModelDetached()

override void HPS.MeasurementOperator.OnModelDetached ( )
inlinevirtual

This function is called whenever a model is detached from the view that is attached to this operator. If no view is attached to this operator, this function will not be called.

Reimplemented from HPS.Operator.

◆ OnMouseDown()

override bool HPS.MeasurementOperator.OnMouseDown ( HPS.MouseState  in_state)
inlinevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was pressed. This function starts the operator and records the position of the mouse click

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()

override bool HPS.MeasurementOperator.OnMouseMove ( HPS.MouseState  in_state)
inlinevirtual

This function is called whenever HPS receives a MouseEvent that signals the mouse moved This function shows a preview of what would be selected, taking into account vertex snapping

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()

override bool HPS.MeasurementOperator.OnMouseUp ( HPS.MouseState  in_state)
inlinevirtual

This function is called whenever HPS receives a MouseEvent that signals a mouse button was released. If the mouse position was the same as it was when the mouse button was pressed, a measurement point is inserted.

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()

override bool HPS.MeasurementOperator.OnTouchDown ( HPS.TouchState  in_state)
inlinevirtual

This function is called whenever HPS receives a TouchEvent that signals that the device was touched. This is the touch equivalent of OnMouseDown

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()

override bool HPS.MeasurementOperator.OnTouchMove ( HPS.TouchState  in_state)
inlinevirtual

This function is called whenever HPS receives a TouchEvent that signals that a touch on the device has moved This is the touch equivalent of OnMouseMove

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()

override bool HPS.MeasurementOperator.OnTouchUp ( HPS.TouchState  in_state)
inlinevirtual

This function is called whenever HPS receives a TouchEvent that signals that a touch on the device was released This is the touch equivalent of OnMouseUp

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()

override void HPS.MeasurementOperator.OnViewAttached ( HPS.View  in_attached_view)
inlinevirtual

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

Reimplemented from HPS.Operator.

◆ OnViewDetached()

override void HPS.MeasurementOperator.OnViewDetached ( HPS.View  in_detached_view)
inlinevirtual

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

Reimplemented from HPS.Operator.

◆ SetLineMeasurementPosition()

void HPS.MeasurementOperator.SetLineMeasurementPosition ( HPS.MeasurementOperator.LineMeasurementPosition  in_position)
inline

Sets where to position line measurement text relative to the line.

◆ SetMeasurementType()

void HPS.MeasurementOperator.SetMeasurementType ( HPS.MeasurementOperator.MeasurementType  in_measurement_type)
inline

Sets the type of measurement to insert. If a measurement of a different type is currently being inserted, that measurement will be deleted.

◆ SetPrecision()

void HPS.MeasurementOperator.SetPrecision ( ulong  in_precision)
inline

Changes the precision used in the measurement (number of digits after the decimal point) The operator might override this setting if increasing the precision is necessary in order not to display the measurement value as all zeros. Example: When precision is set to 2, and a distance measurement of 0.0012 is performed, the operator will display 3 digits after the decimal point (0.001) in order not to display a value of 0. Only affects future measurements.

◆ SetSelectionHinting()

void HPS.MeasurementOperator.SetSelectionHinting ( bool  in_state)
inline

Whether to show hint geometry while moving the mouse over the model during point selection. This function is not available on mobile platforms as it requires hovering over geometry.

Parameters
in_stateIndicates whether to enable or disable visual selection hints.

◆ SetVertexSnapping() [1/2]

void HPS.MeasurementOperator.SetVertexSnapping ( bool  in_state,
float  in_proximity 
)
inline

Whether selections should snap to the closest vertex. This behavior is only relevant when selecting shells, meshes, lines, NURBS curves and polygons. If the selection cannot be snapped to a vertex, the measurement will be taken based on the actual selection point.

Parameters
in_stateIndicates whether to enable or disable vertex snapping.
in_proximityThe distance to which a vertex will snap. The value is specified in centimeters.

◆ SetVertexSnapping() [2/2]

void HPS.MeasurementOperator.SetVertexSnapping ( bool  in_state)
inline

Whether selections should snap to the closest vertex. This behavior is only relevant when selecting shells, meshes, lines, NURBS curves and polygons. If the selection cannot be snapped to a vertex, the measurement will be taken based on the actual selection point.

Parameters
in_stateIndicates whether to enable or disable vertex snapping.

The documentation for this class was generated from the following file:
  • internals/hps_sprk_ops/source/cs/HPS.MeasurementOperator.cs