Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OCCViewer_ClipPlaneInteractor Class Reference

The class provides mouse dragging operations with AIS_Plane: 1) Sliding plane by dragging it with point 2) Rotating plane around one or both of the rotation axes by dragging its point with "ctrl" key pressed.

#include <OCCViewer_ClipPlaneInteractor.h>

Inheritance diagram for OCCViewer_ClipPlaneInteractor:
Inheritance graph

Public Types

enum  DragOperation { DragOperation_Undef, DragOperation_Slide, DragOperation_Rotate }
 
typedef std::vector< Handle(AIS_Plane)> SeqOfPlanes
 

Signals

void planeClicked (const Handle_AIS_Plane &thePlane)
 
void planeDragged (const Handle_AIS_Plane &thePlane)
 

Public Member Functions

 OCCViewer_ClipPlaneInteractor (OCCViewer_ViewManager *, QObject *theParent)
 Constructor. More...
 
const SeqOfPlanesplanes () const
 Get sequence of planes to interact with. More...
 
void setPlanes (const SeqOfPlanes &)
 Sets sequence of planes allowed for interaction. More...
 
void setRotationCenter (const gp_Pnt &)
 Sets center of rotation for the scene. More...
 
void setMinMax (const Bnd_Box &)
 Sets minimum and maximum bounding of the scene. The sliding movements are limited to minimum and maximum bounds. More...
 
virtual void setEnabled (const bool)
 Enables or disables event processing within the viewer. More...
 
- Public Member Functions inherited from OCCViewer_ViewportInputFilter
 OCCViewer_ViewportInputFilter (OCCViewer_ViewManager *, QObject *)
 Constructor. More...
 
 ~OCCViewer_ViewportInputFilter ()
 Destructor. More...
 

Protected Member Functions

bool isClickable (const Handle(AIS_Plane)&thePlane)
 Checks whether the interactive plane can be clicked. More...
 
bool isDraggable (const Handle(AIS_Plane)&thePlane)
 Checks whether the interactive plane can be dragged. More...
 
bool isPerforming () const
 Checks whether the interactive operation is in progress. More...
 
bool startDragging (const QPoint &thePickPos, const QPoint &theDragPos, const DragOperation theOperation, const Handle(AIS_Plane)&thePlane, const Handle(V3d_View)&theView)
 Checks whether it is possible to start interaction with plane. More...
 
void performDragging (const QPoint &theDragPos, const DragOperation theOperation, const Handle(AIS_Plane)&thePlane, const Handle(V3d_View)&theView)
 Performs dragging operation on the passed interactive plane. More...
 
void adjustBounds (gp_Ax3 &, const Bnd_Box &)
 Adjusts min-max bounds of the plane. More...
 
virtual bool mouseMove (QMouseEvent *, OCCViewer_ViewPort3d *)
 Handle mouse move events. Performs dragging if interaction is in progress. More...
 
virtual bool mousePress (QMouseEvent *, OCCViewer_ViewPort3d *)
 Handle mouse press events. Starts interaction with detected plane. More...
 
virtual bool mouseRelease (QMouseEvent *, OCCViewer_ViewPort3d *)
 Handle mouse release events. Stops interaction. More...
 
virtual bool mouseDoubleClick (QMouseEvent *, OCCViewer_ViewPort3d *)
 Handle mouse double clicking events events. Stops the event propagation if interaction with plane is in progress. More...
 
virtual bool keyPress (QKeyEvent *, OCCViewer_ViewPort3d *)
 Handle key pressing events. Stops the event propagation if interaction with plane is in progress. More...
 
virtual bool keyRelease (QKeyEvent *, OCCViewer_ViewPort3d *)
 Handle key releasing events. Stops the event propagation if interaction with plane is in progress. More...
 
 Handle (AIS_Plane) myInteractedPlane
 
- Protected Member Functions inherited from OCCViewer_ViewportInputFilter
void connectView (SUIT_ViewWindow *)
 Connects view to event processing. More...
 
void disconnectView (SUIT_ViewWindow *)
 Disconnects view to event processing. More...
 
bool eventFilter (QObject *, QEvent *)
 Base-level implementation of event filtering. Routes user input events to associated implementation methods. More...
 

Protected Attributes

gp_Ax3 myPlaneReferenceCS
 
gp_Ax1 myRotationAxis
 
gp_Pln myMouseDragPln
 
QPoint myDragPos
 
QPoint myPickPos
 
DragOperation myPerformingOp
 
gp_Pnt myRotationCenter
 
Bnd_Box myMinMax
 
SeqOfPlanes myPlanes
 
bool myIsDraggable
 
bool myIsClickable
 
- Protected Attributes inherited from OCCViewer_ViewportInputFilter
OCCViewer_ViewManagermyVM
 
OCCViewer_ViewermyViewer
 
bool myIsEnabled
 

Additional Inherited Members

- Protected Slots inherited from OCCViewer_ViewportInputFilter
void onViewCreated (SUIT_ViewWindow *)
 Connects newly created within viewer to event processing. More...
 
void onViewRemoved (SUIT_ViewWindow *)
 Disconnects view being removed from viewer. More...
 

Member Typedef Documentation

typedef std::vector<Handle(AIS_Plane)> OCCViewer_ClipPlaneInteractor::SeqOfPlanes

Member Enumeration Documentation

Enumerator
DragOperation_Undef 
DragOperation_Slide 
DragOperation_Rotate 

Constructor & Destructor Documentation

OCCViewer_ClipPlaneInteractor::OCCViewer_ClipPlaneInteractor ( OCCViewer_ViewManager theVM,
QObject theParent 
)
Parameters
theVM[in] the view manager.
theParent[in] the parent object.

Member Function Documentation

void OCCViewer_ClipPlaneInteractor::adjustBounds ( gp_Ax3 &  thePlane,
const Bnd_Box &  theMinMax 
)
protected
Parameters
thePlane[in/out] the plane.
theMinMax[in] the min max bounds
OCCViewer_ClipPlaneInteractor::Handle ( AIS_Plane  )
protected
bool OCCViewer_ClipPlaneInteractor::isClickable ( const Handle(AIS_Plane)&  thePlane)
protected
Returns
true if the click interaction is supported for the plane.

References Handle(), isFound(), myPlanes, and OCCViewer_ViewportInputFilter::myViewer.

bool OCCViewer_ClipPlaneInteractor::isDraggable ( const Handle(AIS_Plane)&  thePlane)
protected
Returns
true if the dragging interaction is supported for the plane.

References Handle(), isFound(), myPlanes, and OCCViewer_ViewportInputFilter::myViewer.

bool OCCViewer_ClipPlaneInteractor::isPerforming ( ) const
protected
Returns
true if the interaction is performed on IO object meaning that no other operations in viewer should be processed.
bool OCCViewer_ClipPlaneInteractor::keyPress ( QKeyEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
Parameters
theEvent[in] the user event.
theViewPort[in] the viewport.

Implements OCCViewer_ViewportInputFilter.

References DragOperation_Rotate, DragOperation_Slide, DragOperation_Undef, isDraggable(), isPerforming(), myIsDraggable, myPerformingOp, and myPickPos.

bool OCCViewer_ClipPlaneInteractor::keyRelease ( QKeyEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
Parameters
theEvent[in] the user event.
theViewPort[in] the viewport.

Implements OCCViewer_ViewportInputFilter.

References DragOperation_Rotate, DragOperation_Slide, DragOperation_Undef, isDraggable(), isPerforming(), myIsDraggable, myPerformingOp, and myPickPos.

bool OCCViewer_ClipPlaneInteractor::mouseDoubleClick ( QMouseEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
Parameters
theEvent[in] the user event.
theViewPort[in] the viewport.

Implements OCCViewer_ViewportInputFilter.

References isPerforming().

bool OCCViewer_ClipPlaneInteractor::mouseMove ( QMouseEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
bool OCCViewer_ClipPlaneInteractor::mousePress ( QMouseEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
Parameters
theEvent[in] the user event.
theViewPort[in] the viewport.

Implements OCCViewer_ViewportInputFilter.

References Handle(), isClickable(), isDraggable(), myIsClickable, myIsDraggable, myPickPos, OCCViewer_ViewportInputFilter::myViewer, and planeClicked().

bool OCCViewer_ClipPlaneInteractor::mouseRelease ( QMouseEvent *  theEvent,
OCCViewer_ViewPort3d theViewPort 
)
protectedvirtual
Parameters
theEvent[in] the user event.
theViewPort[in] the viewport.

Implements OCCViewer_ViewportInputFilter.

References DragOperation_Undef, isPerforming(), myDragPos, myIsClickable, myIsDraggable, myMouseDragPln, myPerformingOp, and myPickPos.

void OCCViewer_ClipPlaneInteractor::performDragging ( const QPoint &  theDragPos,
const DragOperation  theDragOp,
const Handle(AIS_Plane)&  thePlane,
const Handle(V3d_View)&  theView 
)
protected
Parameters
theDragPos[in] the position of mouse dragging.
theDragOp[in] the drag operation to start.
thePlane[in] the operated plane.
theView[in] the view.

References adjustBounds(), DragOperation_Rotate, DragOperation_Slide, Handle(), myMinMax, myMouseDragPln, myPlaneReferenceCS, myRotationAxis, myRotationCenter, and OCCViewer_ViewportInputFilter::myViewer.

void OCCViewer_ClipPlaneInteractor::planeClicked ( const Handle_AIS_Plane &  thePlane)
signal
void OCCViewer_ClipPlaneInteractor::planeDragged ( const Handle_AIS_Plane &  thePlane)
signal
const OCCViewer_ClipPlaneInteractor::SeqOfPlanes & OCCViewer_ClipPlaneInteractor::planes ( ) const
Returns
the sequence of accepted planes.

References myPlanes.

void OCCViewer_ClipPlaneInteractor::setEnabled ( const bool  theIsEnabled)
virtual
void OCCViewer_ClipPlaneInteractor::setMinMax ( const Bnd_Box &  theMinMax)
Parameters
theMinMax[in] the minimum and maximum bounds.

References myMinMax.

void OCCViewer_ClipPlaneInteractor::setPlanes ( const SeqOfPlanes thePlanes)
Parameters
thePlanes[in] the sequence of accepted planes.

References myPlanes.

void OCCViewer_ClipPlaneInteractor::setRotationCenter ( const gp_Pnt &  theCenter)
Parameters
theCenter[in] the center of rotation.

References myRotationCenter.

bool OCCViewer_ClipPlaneInteractor::startDragging ( const QPoint &  thePickPos,
const QPoint &  theDragPos,
const DragOperation  theDragOp,
const Handle(AIS_Plane)&  thePlane,
const Handle(V3d_View)&  theView 
)
protected
Parameters
thePickPos[in] the position of mouse picking.
theDragPos[in] the position of initial mouse dragging.
theDragOp[in] the drag operation to start.
thePlane[in] the detected plane.
theView[in] the view.

References DragOperation_Rotate, DragOperation_Slide, Handle(), myMouseDragPln, myPlaneReferenceCS, myRotationAxis, and myRotationCenter.

Member Data Documentation

QPoint OCCViewer_ClipPlaneInteractor::myDragPos
protected
bool OCCViewer_ClipPlaneInteractor::myIsClickable
protected
bool OCCViewer_ClipPlaneInteractor::myIsDraggable
protected
Bnd_Box OCCViewer_ClipPlaneInteractor::myMinMax
protected
gp_Pln OCCViewer_ClipPlaneInteractor::myMouseDragPln
protected
DragOperation OCCViewer_ClipPlaneInteractor::myPerformingOp
protected
QPoint OCCViewer_ClipPlaneInteractor::myPickPos
protected
gp_Ax3 OCCViewer_ClipPlaneInteractor::myPlaneReferenceCS
protected
SeqOfPlanes OCCViewer_ClipPlaneInteractor::myPlanes
protected
gp_Ax1 OCCViewer_ClipPlaneInteractor::myRotationAxis
protected
gp_Pnt OCCViewer_ClipPlaneInteractor::myRotationCenter
protected

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