ProcessDragging method in AIS_InteractiveObject. Empty by default. Should be implemented if drag is used for the object.
myCTXPtr->Redisplay (this, Standard_False, AllModes);
}
+//=======================================================================
+//function : ProcessDragging
+//purpose :
+//=======================================================================
+Standard_Boolean AIS_InteractiveObject::ProcessDragging (const Handle(AIS_InteractiveContext)&,
+ const Handle(V3d_View)&,
+ const Handle(SelectMgr_EntityOwner)&,
+ const Graphic3d_Vec2i&,
+ const Graphic3d_Vec2i&,
+ const AIS_DragAction)
+{
+ return Standard_False;
+}
+
//=======================================================================
//function :
//purpose :
#define _AIS_InteractiveObject_HeaderFile
#include <AIS_KindOfInteractive.hxx>
+#include <AIS_DragAction.hxx>
#include <SelectMgr_SelectableObject.hxx>
class AIS_InteractiveContext;
class Graphic3d_MaterialAspect;
class Prs3d_BasicAspect;
class Bnd_Box;
+class V3d_View;
//! Defines a class of objects with display and selection services.
//! Entities which are visualized and selected are Interactive Objects.
//! This method removes the owner from the graphic entity.
void ClearOwner() { myOwner.Nullify(); }
+ //! Drag object in the viewer.
+ //! @param theCtx [in] interactive context
+ //! @param theView [in] active View
+ //! @param theOwner [in] the owner of detected entity
+ //! @param theDragFrom [in] drag start point
+ //! @param theDragTo [in] drag end point
+ //! @param theAction [in] drag action
+ //! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
+ Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Graphic3d_Vec2i& theDragFrom,
+ const Graphic3d_Vec2i& theDragTo,
+ const AIS_DragAction theAction);
+
public:
//! Returns the context pointer to the interactive context.
return Standard_False;
}
+//=======================================================================
+//function : ProcessDragging
+//purpose :
+//=======================================================================
+Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveContext)&,
+ const Handle(V3d_View)& theView,
+ const Handle(SelectMgr_EntityOwner)&,
+ const Graphic3d_Vec2i& theDragFrom,
+ const Graphic3d_Vec2i& theDragTo,
+ const AIS_DragAction theAction)
+{
+ switch (theAction)
+ {
+ case AIS_DragAction_Start:
+ {
+ if (HasActiveMode())
+ {
+ StartTransform (theDragFrom.x(), theDragFrom.y(), theView);
+ return Standard_True;
+ }
+ break;
+ }
+ case AIS_DragAction_Update:
+ {
+ Transform (theDragTo.x(), theDragTo.y(), theView);
+ return Standard_True;
+ }
+ case AIS_DragAction_Abort:
+ {
+ StopTransform (false);
+ return Standard_True;
+ }
+ case AIS_DragAction_Stop:
+ break;
+ }
+ return Standard_False;
+}
+
//=======================================================================
//function : StartTransform
//purpose :
}
public:
+ //! Drag object in the viewer.
+ //! @param theCtx [in] interactive context
+ //! @param theView [in] active View
+ //! @param theOwner [in] the owner of detected entity
+ //! @param theDragFrom [in] drag start point
+ //! @param theDragTo [in] drag end point
+ //! @param theAction [in] drag action
+ //! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
+ Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView,
+ const Handle(SelectMgr_EntityOwner)& theOwner,
+ const Graphic3d_Vec2i& theDragFrom,
+ const Graphic3d_Vec2i& theDragTo,
+ const AIS_DragAction theAction) Standard_OVERRIDE;
//! Init start (reference) transformation.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
#include <AIS_AnimationCamera.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_Manipulator.hxx>
#include <AIS_Point.hxx>
#include <AIS_RubberBand.hxx>
#include <AIS_XRTrackedDevice.hxx>
case AIS_DragAction_Start:
{
myDragObject.Nullify();
+ myDragOwner.Nullify();
if (!theCtx->HasDetected())
{
return;
}
- Handle(AIS_InteractiveObject) aPrs = theCtx->DetectedInteractive();
- if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (aPrs))
+ const Handle(SelectMgr_EntityOwner)& aDetectedOwner = theCtx->DetectedOwner();
+ Handle(AIS_InteractiveObject) aDetectedPrs = Handle(AIS_InteractiveObject)::DownCast (aDetectedOwner->Selectable());
+
+ if (aDetectedPrs->ProcessDragging (theCtx, theView, aDetectedOwner, myGL.Dragging.PointStart,
+ myGL.Dragging.PointTo, theAction))
{
- if (aManip->HasActiveMode())
- {
- myDragObject = aManip;
- aManip->StartTransform (myGL.Dragging.PointStart.x(), myGL.Dragging.PointStart.y(), theView);
- }
+ myDragObject = aDetectedPrs;
+ myDragOwner = aDetectedOwner;
}
return;
}
{
theCtx->SetSelectedState (aGlobOwner, true);
}
- if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
- {
- aManip->Transform (myGL.Dragging.PointTo.x(), myGL.Dragging.PointTo.y(), theView);
- }
+
+ myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
+ myGL.Dragging.PointTo, theAction);
theView->Invalidate();
return;
}
myGL.Dragging.PointTo = myGL.Dragging.PointStart;
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
- if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
- {
- aManip->StopTransform (false);
- }
+ myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
+ myGL.Dragging.PointTo, theAction);
Standard_FALLTHROUGH
}
case AIS_DragAction_Stop:
theCtx->SetSelectedState (aGlobOwner, false);
}
+ myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
+ myGL.Dragging.PointTo, theAction);
theView->Invalidate();
myDragObject.Nullify();
+ myDragOwner.Nullify();
return;
}
}
class AIS_RubberBand;
class AIS_XRTrackedDevice;
class Graphic3d_Camera;
+class SelectMgr_EntityOwner;
class V3d_View;
class WNT_HIDSpaceMouse;
Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
+ Handle(SelectMgr_EntityOwner) myDragOwner; //!< detected owner of currently dragged object
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation