+void HYDROGUI_Displayer::SaveCursorViewPosition( SUIT_ViewWindow* theViewWindow )
+{
+ myIsPositionSaved = false;
+ myXPosition = 0;
+ myYPosition = 0;
+
+ SUIT_ViewWindow* aViewWindow = theViewWindow;
+ if ( !theViewWindow ) {
+ SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager();
+ aViewWindow = aViewMgr ? aViewMgr->getActiveView() : 0;
+ if ( !aViewWindow )
+ return;
+ }
+
+ OCCViewer_ViewWindow* anOCCViewWindow =
+ dynamic_cast<OCCViewer_ViewWindow*>( aViewWindow );
+ if ( anOCCViewWindow ) {
+ // Get the selected point coordinates
+ OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
+ if ( aViewPort ) {
+ QPoint aViewPos = aViewPort->mapFromGlobal( QCursor::pos() );
+ myXPosition = aViewPos.x();
+ myYPosition = aViewPos.y();
+ myIsPositionSaved = true;
+ }
+ }
+ else {
+ SVTK_ViewWindow* aVTKViewWindow =
+ dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ if ( aVTKViewWindow ) {
+ vtkRenderer* aRen = aVTKViewWindow->getRenderer();
+ if ( aRen )
+ {
+ vtkCamera* aCamera = aRen->GetActiveCamera();
+ double* aNormal = aCamera->GetViewPlaneNormal();
+ vtkRenderWindowInteractor* anInteractor = aVTKViewWindow->getInteractor();
+ if ( anInteractor )
+ {
+ anInteractor->GetLastEventPosition( myXPosition, myYPosition );
+ myIsPositionSaved = true;
+ }
+ }
+ }
+ }
+ if (!myIsPositionSaved)
+ int aValue = 0;
+}
+