#include "VVTK_InteractorStyle.h"
+#include "VISU_GaussPtsSettings.h"
#include "SVTK_Selector.h"
#include "VVTK_Event.h"
myIsMidButtonDown( false ),
myIsLeftButtonDown( false ),
mySMDecreaseMagnificationBtn(10),
- mySMIncreaseMagnificationBtn(11)
+ mySMIncreaseMagnificationBtn(11),
+ myPickingSettings(NULL)
{
}
aNbObjNow=GetSelector()->IObjectCount();
if (aNbObjWas+aNbObjNow==1){
- double aScale, aCoeff;
- vtkRenderer *aRenderer=GetCurrentRenderer();
- vtkCamera *aCamera = aRenderer->GetActiveCamera();
- //
- aCoeff=0.667;
- aScale = aCamera->GetParallelScale();
- //
+ vtkCamera *aCamera = GetCurrentRenderer()->GetActiveCamera();
+ float aZoomFactor = myPickingSettings->GetZoomFactor();
+ double aScale = aCamera->GetParallelScale();
if (!aNbObjWas && aNbObjNow) {
- aCamera->SetParallelScale(aScale*aCoeff);
+ aCamera->SetParallelScale(aScale/aZoomFactor);
}
else {
- aCoeff=1./aCoeff;
- aCamera->SetParallelScale(aScale*aCoeff);
+ aCamera->SetParallelScale(aScale*aZoomFactor);
}
}
}
}
}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+ myPickingSettings = thePickingSettings;
+}
+
+
//----------------------------------------------------------------------------
void
VVTK_InteractorStyle
#include "SVTK_InteractorStyle.h"
+class VISU_PickingSettings;
+
+
class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
{
public:
void
SetInteractor( vtkRenderWindowInteractor* );
+ void
+ SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
protected:
VVTK_InteractorStyle();
~VVTK_InteractorStyle();
// SpaceMouse short cuts
int mySMDecreaseMagnificationBtn;
int mySMIncreaseMagnificationBtn;
+
+ VISU_PickingSettings* myPickingSettings;
bool myIsMidButtonDown;
bool myIsLeftButtonDown;
::~VVTK_MainWindow()
{}
+VVTK_InteractorStyle*
+VVTK_MainWindow
+::GetVInteractorStyle()
+{
+ return myInteractorStyle.GetPointer();
+}
+
//----------------------------------------------------------------------------
void
myRenderer = theRenderer;
VVTK_MainWindow::Initialize(theInteractor);
mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() );
+ GetVInteractorStyle()->SetPickingSettings( GetPickingSettings() );
}
VVTK_MainWindow1
const char* theName,
SUIT_ResourceMgr* theResourceMgr)
{
- return new VVTK_MainWindow2(theParent,
- theName,
- theResourceMgr,
- this,
- myStyleSwitchAction,
- myPickingDlg);
+ VVTK_MainWindow2* aMainWindow2 = new VVTK_MainWindow2(theParent,
+ theName,
+ theResourceMgr,
+ this,
+ myStyleSwitchAction,
+ myPickingDlg);
+ aMainWindow2->GetVInteractorStyle()->SetPickingSettings(GetPickingSettings());
+ return aMainWindow2;
}
return myRenderer->GetImplicitFunctionWidget();
}
+VISU_PickingSettings*
+VVTK_MainWindow1
+::GetPickingSettings()
+{
+ return myPickingDlg->GetPickingSettings();
+}
+
+
//----------------------------------------------------------------------------
QSize
VVTK_MainWindow1
class VISU_ImplicitFunctionWidget;
class VVTK_SegmentationCursorDlg;
+class VISU_PickingSettings;
+class VVTK_InteractorStyle;
class VVTK_PickingDlg;
class VVTK_MainWindow2;
class VVTK_Renderer1;
virtual
~VVTK_MainWindow();
+ VVTK_InteractorStyle*
+ GetVInteractorStyle();
+
public slots:
virtual
void
action( const int );
protected:
- vtkSmartPointer<vtkInteractorStyle> myInteractorStyle;
+ vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
};
VISU_ImplicitFunctionWidget*
GetImplicitFunctionWidget();
+ VISU_PickingSettings*
+ GetPickingSettings();
+
virtual
QSize
sizeHint() const;
onClickApply();
}
+
+VISU_PickingSettings*
+VVTK_PickingDlg
+::GetPickingSettings()
+{
+ return myPickingSettings.GetPointer();
+}
+
void VVTK_PickingDlg::onClickApply()
{
myPickingSettings->SetInitial( false );
void Update();
+ VISU_PickingSettings* GetPickingSettings();
+
protected:
virtual void closeEvent( QCloseEvent* );