#include <HOpObjectClash.h>

Public Member Functions

virtual HBaseOperatorClone ()
 
virtual const char * GetName ()
 
 HOpObjectClash (HBaseView *view, int doRepeat=0, int doCapture=1)
 
virtual int OnKeyDown (HEventInfo &hevent)
 
virtual int OnLButtonDown (HEventInfo &hevent)
 
virtual int OnLButtonDownAndMove (HEventInfo &hevent)
 
virtual int OnLButtonUp (HEventInfo &hevent)
 
virtual void UpdateKeyList (void *data)
 
virtual ~HOpObjectClash ()
 The destructor restores the HBaseView's HSelectionSet to its state before this operator was initialized.
 
- Public Member Functions inherited from HOpObjectTranslate
 HOpObjectTranslate (HBaseView *view, int DoRepeat=0, int DoCapture=1)
 
virtual int OnLButtonDblClk (HEventInfo &hevent)
 
- Public Member Functions inherited from HBaseOperator
int Capture ()
 Returns whether we are currently in mouse capture mode. See this class' constructor for a more detailed description of what this means. This method has been deprecated.
 
HPoint const GetFirstPoint ()
 Returns the initial selection point.
 
HPoint const GetNewPoint ()
 Returns the current selection point.
 
HBaseViewGetView ()
 Returns a pointer to the view that this operator is associated with.
 
 HBaseOperator (HBaseView *view, int DoRepeat=0, int DoCapture=1)
 
virtual int OnKeyUp (HEventInfo &hevent)
 
virtual int OnLRButtonDownAndMove (HEventInfo &hevent)
 
virtual int OnMButtonDblClk (HEventInfo &hevent)
 
virtual int OnMButtonDown (HEventInfo &hevent)
 
virtual int OnMButtonDownAndMove (HEventInfo &hevent)
 
virtual int OnMButtonUp (HEventInfo &hevent)
 
virtual int OnMouseMove (HEventInfo &hevent)
 
virtual int OnMouseWheel (HEventInfo &hevent)
 
virtual int OnNoButtonDownAndMove (HEventInfo &hevent)
 
virtual int OnRButtonDblClk (HEventInfo &hevent)
 
virtual int OnRButtonDown (HEventInfo &hevent)
 
virtual int OnRButtonDownAndMove (HEventInfo &hevent)
 
virtual int OnRButtonUp (HEventInfo &hevent)
 
virtual int OnTimer (HEventInfo &hevent)
 
virtual int OnTouchesDown (HEventInfo &hevent)
 
virtual int OnTouchesMove (HEventInfo &hevent)
 
virtual int OnTouchesUp (HEventInfo &hevent)
 
virtual bool OperatorStarted ()
 Operator has been started if true, and has not been started if false.
 
int Repeat ()
 Returns whether the operation is repeatable. This method has been deprecated.
 
void SetFirstPoint (HPoint const &new_point)
 Sets the initial selection point.
 
void SetMapTouchesToMouseEvents (bool val)
 Touch Events are mapped to mouse events if true, and are not if false.
 
void SetNewPoint (HPoint const &new_point)
 Sets the current selection point.
 
void SetOperatorStarted (bool val)
 Operator has been started if true, and has not been started if false.
 
void SetView (HBaseView *new_view)
 Sets the view that this operator is associated with.
 

Protected Types

enum  HOOC_Result { HOOC_Unknown = -1, HOOC_In = 1, HOOC_Out = 2, HOOC_Clash = 3 }
 
enum  HOOC_SelectMode { HOOC_World = 1, HOOC_Screen = 2, HOOC_Shell = 3, HOOC_Enclosure = 4 }
 

Protected Member Functions

void ClashDetect (HEventInfo &hevent)
 
int GetScreenVolume (HC_KEY seg, HPoint &min, HPoint &max)
 
int GetWorldVolume (HC_KEY seg, HPoint &min, HPoint &max)
 
void GrabSelectionSet ()
 
int IntersectPolyline (HC_KEY key1, float *transformed_points1)
 
void ProcessSelectionResults (HC_KEY current_shell=HC_ERROR_KEY, float *transformed_points=0)
 
void RestoreSelectionSet ()
 
virtual int SelectByEnclosure (HSmartSelItem *sel_item)
 
virtual int SelectByScreenVolume (HSmartSelItem *sel_item)
 
virtual int SelectByShell (HSmartSelItem *sel_item)
 
virtual int SelectByWorldVolume (HSmartSelItem *sel_item)
 
void SetSelectMode (int mode)
 
int TestEnclosure (HC_KEY current_shell_key, float *transformed_points)
 
- Protected Member Functions inherited from HOpObjectTranslate
void Cleanup ()
 
int GetMatrix (HEventInfo &hevent, int key_count, HC_KEY const *full_path_keys, float matrix_out[])
 
void Init ()
 
int UpdateMousePos (HEventInfo &hevent)
 
- Protected Member Functions inherited from HBaseOperator
bool IsSpecialKey (HC_KEY key)
 

Protected Attributes

int m_IntersectPolylinesVisible
 
HSelectionSetm_pClashSelection
 
bool m_save_spriting_mode
 
int m_SelectMode
 
HC_KEY m_TempSegKey
 
- Protected Attributes inherited from HOpObjectTranslate
bool m_bInitialMatrix
 
bool m_bTemporarySelection
 
HKeyList * m_KeyList
 
HPoint m_ptLast
 
- Protected Attributes inherited from HBaseOperator
bool m_bMapTouchesToMouseEvents
 Indicates if touch events are mapped to mouse events.
 
bool m_bOpStarted
 Indicates whether the operator has already 'started'. More...
 
int m_doCapture
 Integer indicating whether to capture mouse on button down and release on button up. This parameter has been deprecated.
 
int m_doRepeat
 Integer indicating if the operator is repeatable . This parameter has been deprecated.
 
HPoint m_ptFirst
 Initial selection point.
 
HPoint m_ptNew
 Current selection point.
 
HBaseViewm_pView
 The HOOPS view corresponding to this operator.
 
HCutGeometryVisibility m_TempCutGeometryVisibility
 stores original cut geometry visibility
 
HShadowMode m_TempShadowMode
 stores original shadow mode
 

Additional Inherited Members

- Public Attributes inherited from HOpObjectTranslate
HPoint m_ptRecent
 
HPoint m_ptRecentVP
 

Detailed Description

The HOpObjectClash class detects and highlights objects that intersect a set of translated objects. The set of objects to be translated, a.k.a. "the part", is assumed to be selected at the segment level prior to activating this operator. The computation can be done in several ways as described in HOOC_SelectMode but the most important mode that this operator demonstrates is HOOC_Shell. In that mode, shells from the scene, a.k.a "the environment", are selected and highlighted if their faces cross the part's faces.

This operator currently makes the (sometimes false) assumption that shells in the part are affected only by modelling matrices in their ancestry, as opposed to via some include path.

HOpObjectClash employs the transform functionality of HOpObjectTranslate to move an object around a scene, and
extends two of the mouse event handlers defined on HOpObjectTranslate to perform clash detection. The operation consists of the following steps:

  1. Left Button Down: The operation is initiated. The translation objects are selected.
  2. Left Button Down and Drag: Clashed objects are highlighted.
  3. Left Button Up: The operation is ended. The clashed objects are deselected.

More Detailed Description: see event methods.

Member Enumeration Documentation

◆ HOOC_Result

HOOC_Result is the result code for the object clash calculation.

Enumerator
HOOC_Unknown 

The relationship between the objects is unknown.

HOOC_In 

The translated objects are completely enclosed by the highlighted object.

HOOC_Out 

The translated objects is not completely enclosed by the highlighted object.

HOOC_Clash 

The selected objects intersect wit the translated objects.

◆ HOOC_SelectMode

The selection can be computed in several different ways.

Enumerator
HOOC_World 

This selection mode computes the selection in world coordinates prior to the camera transformation and then looks for bounding box intersections. Use this mode for speed.

HOOC_Screen 

This selection mode computes the selection in screen coordinates and looks for bounding box intersections.

HOOC_Shell 

This selection mode looks for shells that intersect the faces of the current selection set in HBaseView. This is the default mode and is most accurate.

HOOC_Enclosure 

This selection mode detects if the selection is completely enclosed by the translated object.

Constructor & Destructor Documentation

◆ HOpObjectClash()

HOpObjectClash::HOpObjectClash ( HBaseView view,
int  doRepeat = 0,
int  doCapture = 1 
)

Constructs an HOpObjectClash object.

Parameters
viewA pointer to an HBaseView object,
DoRepeatAn integer denoting whether this is a repeatable operator. This parameter has been deprecated.
DoCaptureAn integer denoting whether the mouse state should be captured, which means that all mouse events should be received after a mousedown, even if it leaves the window.

Member Function Documentation

◆ ClashDetect()

void HOpObjectClash::ClashDetect ( HEventInfo hevent)
protected

This method performs a translation on the selected objects and then highlights objects that intersected with them.

Parameters
heventAn HEventInfo object containing information about the current event.

◆ Clone()

virtual HBaseOperator* HOpObjectClash::Clone ( )
virtual

Creates a new operator which is a copy of the current operator. The user is responsible for deleting the newly created operator.

Returns
A pointer to the newly created HOpObjectClash object.

Reimplemented from HOpObjectTranslate.

◆ GetName()

virtual const char* HOpObjectClash::GetName ( )
virtual
Returns
A pointer to a character string denoting the name of the operator which 'HOpObjectClash'.

Reimplemented from HOpObjectTranslate.

◆ GetScreenVolume()

int HOpObjectClash::GetScreenVolume ( HC_KEY  seg,
HPoint min,
HPoint max 
)
protected

This method gets the screen space volume of the given segment, as seen by driver in the current view.

Parameters
segThe key of segment in which you want to compute the bounding box.
minReturns the minimum point of the bounding box volume.
maxReturns the maximum point of the bounding box volume.
Returns
An HOperatorReturn indicating the status of the event.

◆ GetWorldVolume()

int HOpObjectClash::GetWorldVolume ( HC_KEY  seg,
HPoint min,
HPoint max 
)
protected

This method gets the world space volume of the given segment. This is a helper function to SelectByWorldVolume.

Parameters
segThe key of segment in which you want to compute the bounding box.
minReturns the minimum point of the bounding box volume.
maxReturns the maximum point of the bounding box volume.
Returns
An HOperatorReturn indicating the status of the event.

◆ GrabSelectionSet()

void HOpObjectClash::GrabSelectionSet ( )
protected

This method temporary "steals" the selection set from the HBaseView and replaces it with a new empty one.

◆ IntersectPolyline()

int HOpObjectClash::IntersectPolyline ( HC_KEY  key1,
float *  transformed_points1 
)
protected

This method computes the polyline of intersection between two shells.

Parameters
key1The key of the shell to find intersection with the selection shell.
transformed_points1The point list of the shell.
Returns
The total number of intersecting line segments.

◆ OnKeyDown()

virtual int HOpObjectClash::OnKeyDown ( HEventInfo hevent)
virtual

This method grabs the following hot keys and then passes the rest to HBaseOperator.

  • d : This hot key puts the operator into screen selection mode where it computes the selections in screen space and looks for bounding box intersections.
  • e : This hot key puts the operator into enclosure selection mode where it detect if the original shell completely encloses the selected shell.
  • p : This hot key toggles on and off the indicate whether to calculate the polylines of intersection between objects that we find clashing.
  • s : This hot key puts the operator into shell selection mode where it looks for shells that intersect the faces of the current selection set in HBaseView. Use shell selection mode for accuracy.
  • w : This hot key puts the operator into world selection mode where it computes the selections in world space prior to camera tranformations and looks for bounding box intersections. Use world selection mode for speed.
Parameters
heventAn HEventInfo object containing information about the current event.
Returns
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

◆ OnLButtonDown()

virtual int HOpObjectClash::OnLButtonDown ( HEventInfo hevent)
virtual

OnLButtonDown records the first pointer position and initializes the translation mechanism. It then calls through to ClashDetect. It "steals" the view's selection set and sets it as a member variable so that the objects with which collisions are detected can be put there.

Parameters
heventAn HEventInfo object containing information about the current event.
Returns
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

◆ OnLButtonDownAndMove()

virtual int HOpObjectClash::OnLButtonDownAndMove ( HEventInfo hevent)
virtual

This method calls through to ClashDetect to do most of its work.

Parameters
heventAn HEventInfo object containing information about the current event.
Returns
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

◆ OnLButtonUp()

virtual int HOpObjectClash::OnLButtonUp ( HEventInfo hevent)
virtual

OnLButtonUp deselects the highlighted objects.

Parameters
heventAn HEventInfo object containing information about the current event.
Returns
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

◆ ProcessSelectionResults()

void HOpObjectClash::ProcessSelectionResults ( HC_KEY  current_shell = HC_ERROR_KEY,
float *  transformed_points = 0 
)
protected

This method loops through the selected object and all of the results from #HC_Find_Related_Selection, and send them to the appropriate HSelectionSet.

Parameters
current_shellThe key of the shell we want to highlight.
transformed_pointsThe point list of the shell.

◆ RestoreSelectionSet()

void HOpObjectClash::RestoreSelectionSet ( )
protected

This method restores the selection set back to the HBaseView.

◆ SelectByEnclosure()

virtual int HOpObjectClash::SelectByEnclosure ( HSmartSelItem sel_item)
protectedvirtual

This method find if a given segment is fully enclosed by any other objects and then selects them. The selected items will be added to the current view's selection list and highlighted as usual.

Parameters
segThe key of the segment to select.
Returns
An HOperatorReturn indicating the status of the event.

◆ SelectByScreenVolume()

virtual int HOpObjectClash::SelectByScreenVolume ( HSmartSelItem sel_item)
protectedvirtual

This method finds if a given segment in screen space clashes with any other objects in the scene and then selects them. The selected items will be added to the current view's selection list and highlighted as usual.

Parameters
segThe key of the segment to perform clash detection on.
Returns
An HOperatorReturn indicating the status of the event.

◆ SelectByShell()

virtual int HOpObjectClash::SelectByShell ( HSmartSelItem sel_item)
protectedvirtual

This method finds if a given shell clashes with any other shells and selects them. After selection, the selection list will contain all shells in the model that intersect the faces of the shells in the segment given by "seg".

Parameters
segThe key of the segment to check for clashes with other shells.
Returns
An HOperatorReturn indicating the status of the event.

◆ SelectByWorldVolume()

virtual int HOpObjectClash::SelectByWorldVolume ( HSmartSelItem sel_item)
protectedvirtual

This method finds if a given segment in world space clashes with any other object in the scene and then selects them.
The selected items will be added to the current view's selection list and highlighted as usual.

Parameters
segThe key of the segment to select.
Returns
An HOperatorReturn indicating the status of the event.

◆ SetSelectMode()

void HOpObjectClash::SetSelectMode ( int  mode)
protected

This method sets the type of computing selection described in HOOC_SelectMode enum. HOOC_Shell is the default.

Parameters
modeThe mode in which you would like to perform selection and clash detection.

◆ TestEnclosure()

int HOpObjectClash::TestEnclosure ( HC_KEY  current_shell_key,
float *  transformed_points 
)
protected

This is a helper function for ProcessSelectionResults(). It tests if the hit object encloses the shell.

Parameters
current_shell_keyThe key of the shell that we want to test if it is enclosed by another object.
transformed_pointsThe point list of the shell.
Returns
An HOOC_Result describing if result of the enclosure test.

◆ UpdateKeyList()

virtual void HOpObjectClash::UpdateKeyList ( void *  data)
virtual

This method is used to update the list of keys to translate when the selection list changes.

Reimplemented from HOpObjectTranslate.

Member Data Documentation

◆ m_IntersectPolylinesVisible

int HOpObjectClash::m_IntersectPolylinesVisible
protected

A boolean to indicate whether or not to calculate the polylines of intersection between objects that we find clashing.

◆ m_pClashSelection

HSelectionSet* HOpObjectClash::m_pClashSelection
protected

The set of objects being dragged around.

◆ m_save_spriting_mode

bool HOpObjectClash::m_save_spriting_mode
protected

The spriting mode before this operator started up which is restored on deletion.

◆ m_SelectMode

int HOpObjectClash::m_SelectMode
protected

The type of computing selection described in HOOC_SelectMode enum. HOOC_Shell is the default.

◆ m_TempSegKey

HC_KEY HOpObjectClash::m_TempSegKey
protected

The key to the segment into which the text overlay, with a transparent window, is put.


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