if ( myIsLeftButtonDown )
OnLeftButtonDown( ctrl, shift, x, y );
}
-
-//----------------------------------------------------------------------------
-void
-VVTK_InteractorStyle
-::OnKeyDown()
-{
- if( GetSelector()->SelectionMode() != GaussPointSelection )
- return;
-
- char key = Interactor->GetKeyCode();
-
- if ( key == 'S' ) {
- // current mouse position (from last mouse move event or any other event)
- int x, y;
- Interactor->GetEventPosition( x, y );
- FindPokedRenderer( x, y ); // calls SetCurrentRenderer
-
- myOtherPoint = myPoint = QPoint(x, y);
-
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
-}
-
//----------------------------------------------------------------------------
void VVTK_InteractorStyle::onFinishOperation()
{
{
Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL);
}
-
-vtkStandardNewMacro(VVTK_InteractorStyleController);
+//============================================================================
+//
+// Controllers
+//
+vtkStandardNewMacro(VVTK_ControllerIncrement);
//----------------------------------------------------------------------------
-VVTK_InteractorStyleController::VVTK_InteractorStyleController()
+VVTK_ControllerIncrement::VVTK_ControllerIncrement()
{
myIncrement=10;
}
//----------------------------------------------------------------------------
-VVTK_InteractorStyleController::~VVTK_InteractorStyleController()
+VVTK_ControllerIncrement::~VVTK_ControllerIncrement()
{
}
//----------------------------------------------------------------------------
-int VVTK_InteractorStyleController::IncrementIncrease()
+int VVTK_ControllerIncrement::Increase()
{
myIncrement*=2;
return myIncrement;
}
//----------------------------------------------------------------------------
-int VVTK_InteractorStyleController::IncrementDecrease()
+int VVTK_ControllerIncrement::Decrease()
{
myIncrement/=2;
if (!myIncrement){
}
return myIncrement;
}
+//
+vtkStandardNewMacro(VVTK_ControllerOnKeyDown);
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::~VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+bool VVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
+{
+ SVTK_InteractorStyle *pIS=dynamic_cast<SVTK_InteractorStyle *>(theIS);
+ if (pIS){
+ if(pIS->GetSelector()->SelectionMode()==GaussPointSelection){
+ char key = pIS->GetInteractor()->GetKeyCode();
+ //
+ if (key == 'S') {
+ pIS->ActionPicking();
+ return false;
+ }
+ }
+ }
+ return Superclass::OnKeyDown(theIS);
+}
#include "SVTK_InteractorStyle.h"
//
+//-------------------------------------------
//! Control the value of increment in new style of interaction.
/*!
This class controls of value of increment,
for pan/rotate/zoom operations in new style
of interaction
*/
-class VVTK_InteractorStyleController : public SVTK_InteractorStyleController {
+class VVTK_ControllerIncrement : public SVTK_ControllerIncrement {
public:
- vtkTypeMacro(VVTK_InteractorStyleController,SVTK_InteractorStyleController);
- static VVTK_InteractorStyleController* New();
+ vtkTypeMacro(VVTK_ControllerIncrement,SVTK_ControllerIncrement);
+ static VVTK_ControllerIncrement* New();
//! Increace the increment value by multiplying on 2
- virtual int IncrementIncrease();
+ virtual int Increase();
//! Decreace the increment value by division on 2
- virtual int IncrementDecrease();
+ virtual int Decrease();
protected:
- VVTK_InteractorStyleController();
- virtual ~VVTK_InteractorStyleController();
+ VVTK_ControllerIncrement();
+ virtual ~VVTK_ControllerIncrement();
//
private:
- VVTK_InteractorStyleController(const VVTK_InteractorStyleController&); //Not implemented
- void operator=(const VVTK_InteractorStyleController&); //Not implemented
+ VVTK_ControllerIncrement(const VVTK_ControllerIncrement&); //Not implemented
+ void operator=(const VVTK_ControllerIncrement&); //Not implemented
+};
+//
+//-------------------------------------------
+//! Control the behaviour of KeyDown event in new style of interaction.
+/*!
+ This class controls of behaviour of of KeyDown event
+ in new style of interaction.
+*/
+class VVTK_ControllerOnKeyDown : public SVTK_ControllerOnKeyDown{
+ public:
+ vtkTypeMacro(VVTK_ControllerOnKeyDown, SVTK_ControllerOnKeyDown);
+ static VVTK_ControllerOnKeyDown* New();
+
+ //! Provides the action on event
+ virtual bool OnKeyDown(vtkInteractorStyle* );
+
+ protected:
+ VVTK_ControllerOnKeyDown();
+ virtual ~VVTK_ControllerOnKeyDown();
+
+ private:
+ VVTK_ControllerOnKeyDown(const VVTK_ControllerOnKeyDown&);//Not implemented
+ void operator=(const VVTK_ControllerOnKeyDown&); //Not implemented
};
class VISU_PickingSettings;
//! To share the VISU_PickingSettings
void
SetPickingSettings(VISU_PickingSettings* thePickingSettings);
-
+
+
protected:
VVTK_InteractorStyle();
~VVTK_InteractorStyle();
//! Redefine SVTK_InteractorStyle::OnMiddleButtonUp
virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
- //! Redefine vtkInteractorStyle::OnKeyDown
- virtual void OnKeyDown();
-
//! Redefine SVTK_InteractorStyle::onFinishOperation
virtual void onFinishOperation();
SUIT_ResourceMgr* theResourceMgr):
SVTK_MainWindow(theParent,theName,theResourceMgr),
myInteractorStyle(VVTK_InteractorStyle::New()),
- myInteractorStyleController(VVTK_InteractorStyleController::New())
+ myControllerIncrement(VVTK_ControllerIncrement::New()),
+ myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New())
{
- myInteractorStyle->SetController(myInteractorStyleController.GetPointer());
- myInteractorStyleController->Delete();
+ myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+ myControllerIncrement->Delete();
+
+ myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+ myControllerOnKeyDown->Delete();
+
myInteractorStyle->Delete();
moveDockWindow(myToolBar,Qt::DockLeft);
myActionsMap[NonIsometric]->removeFrom(myToolBar);
}
+//----------------------------------------------------------------------------
void
VVTK_MainWindow
::Initialize(SVTK_RenderWindowInteractor* theInteractor)
vtkInteractorStyle* pVIS=theInteractor->GetInteractorStyle();
SVTK_InteractorStyle *pInteractorStyle=dynamic_cast<SVTK_InteractorStyle*>(pVIS);
if (pInteractorStyle){
- pInteractorStyle->SetController(myInteractorStyleController.GetPointer());
+ pInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+ pInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
}
SVTK_MainWindow::Initialize(theInteractor);
}
+//----------------------------------------------------------------------------
VVTK_MainWindow
::~VVTK_MainWindow()
{}
class VISU_OutsideCursorSettings;
class VISU_PickingSettings;
class VVTK_InteractorStyle;
-class VVTK_InteractorStyleController;
+class VVTK_ControllerIncrement;
+class VVTK_ControllerOnKeyDown;
class VVTK_PickingDlg;
class VVTK_MainWindow2;
class VVTK_Renderer1;
protected:
vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
- vtkSmartPointer<VVTK_InteractorStyleController> myInteractorStyleController;
+ vtkSmartPointer<VVTK_ControllerIncrement> myControllerIncrement;
+ vtkSmartPointer<VVTK_ControllerOnKeyDown> myControllerOnKeyDown;
};