]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
View Parameters dialog - initial version
authornkv <nkv@opencascade.com>
Fri, 30 May 2008 06:53:24 +0000 (06:53 +0000)
committernkv <nkv@opencascade.com>
Fri, 30 May 2008 06:53:24 +0000 (06:53 +0000)
13 files changed:
src/SVTK/Makefile.am
src/SVTK/SVTK_Event.h
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_InteractorStyle.h
src/SVTK/SVTK_MainWindow.cxx
src/SVTK/SVTK_MainWindow.h
src/SVTK/SVTK_ViewParameterDlg.cxx [new file with mode: 0755]
src/SVTK/SVTK_ViewParameterDlg.h [new file with mode: 0755]
src/SVTK/resources/SVTK_images.ts
src/SVTK/resources/SVTK_msg_en.ts
src/SVTK/resources/vtk_view_parallel.png [new file with mode: 0755]
src/SVTK/resources/vtk_view_parameters.png [new file with mode: 0755]
src/SVTK/resources/vtk_view_perspective.png [new file with mode: 0755]

index 427443d5fffc1c7659435e0117f06b68aa352238..f652ecb8c793d37c27aa51b106ec927343a653a0 100755 (executable)
@@ -52,6 +52,7 @@ salomeinclude_HEADERS= \
        SVTK_Event.h \
        SVTK_ViewModelBase.h \
        SVTK_SetRotationPointDlg.h \
+       SVTK_ViewParameterDlg.h \
        SVTK_Extension.h
 
 dist_libSVTK_la_SOURCES= \
@@ -79,6 +80,7 @@ dist_libSVTK_la_SOURCES= \
        SVTK_SpaceMouse.cxx \
        SVTK_Selector.cxx \
        SVTK_SetRotationPointDlg.cxx \
+       SVTK_ViewParameterDlg.cxx \
        SVTK_Extension.cxx
 
 EXTRA_DIST+= SVTK_SelectorDef.h SVTK_Trihedron.h
@@ -97,14 +99,18 @@ MOC_FILES= \
        SVTK_MainWindow_moc.cxx \
        SVTK_ViewModel_moc.cxx \
        SVTK_View_moc.cxx \
-       SVTK_SetRotationPointDlg_moc.cxx
+       SVTK_SetRotationPointDlg_moc.cxx \
+       SVTK_ViewParameterDlg_moc.cxx
 nodist_libSVTK_la_SOURCES= $(MOC_FILES)
 
 dist_salomeres_DATA=\
        resources/vtk_view_graduated_axes.png \
        resources/vtk_view_scaling.png \
        resources/vtk_view_update_rate.png \
-       resources/vtk_view_rotation_point.png
+       resources/vtk_view_rotation_point.png \
+       resources/vtk_view_parallel.png \
+       resources/vtk_view_perspective.png \
+       resources/vtk_view_parameters.png
 
 nodist_salomeres_DATA= \
        SVTK_msg_en.qm \
index 00a9e2c0fbb68da9c80937ebf60d3583729353cc..7006785de63dc47d954b9e7b83c72b4e0c8f7191 100644 (file)
@@ -62,12 +62,17 @@ namespace SVTK
     StartFitArea,
 
     SetRotateGravity,
-    StartPointSelection,
     SetRotateSelected,
+    StartPointSelection,
     
     BBCenterChanged,
     RotationPointChanged,
     ChangeRotationPoint,
+
+    SetFocalPointGravity,
+    SetFocalPointSelected,
+    StartFocalPointSelection,
+    FocalPointChanged,
         
     LastEvent
   };
index 4145322cd7dc7b391a59b799889099531bfb38d4..0f980090c6e7542e8ad7e41ee105990806861a08 100644 (file)
@@ -69,11 +69,9 @@ using namespace std;
 
 namespace
 {
-  inline 
-  void
-  GetEventPosition(vtkRenderWindowInteractor* theInteractor,
-                  int& theX, 
-                  int& theY)
+  inline void GetEventPosition(vtkRenderWindowInteractor* theInteractor,
+                              int& theX, 
+                              int& theY)
   {
     theInteractor->GetEventPosition(theX,theY);
     theY = theInteractor->GetSize()[1] - theY - 1;
@@ -87,15 +85,14 @@ vtkStandardNewMacro(SVTK_InteractorStyle);
 /*!
   Constructor
 */
-SVTK_InteractorStyle
-::SVTK_InteractorStyle():
+SVTK_InteractorStyle::SVTK_InteractorStyle():
   mySelectionEvent(new SVTK_SelectionEvent()),
   myPointPicker(vtkPointPicker::New()),
   myLastHighlitedActor(NULL),
   myLastPreHighlitedActor(NULL),
   myControllerIncrement(SVTK_ControllerIncrement::New()),
   myControllerOnKeyDown(SVTK_ControllerOnKeyDown::New()),
-  myHighlightRotationPointActor(SVTK_Actor::New()),
+  myHighlightSelectionPointActor(SVTK_Actor::New()),
   myRectBand(0)
 {
   myPointPicker->Delete();
@@ -123,14 +120,17 @@ SVTK_InteractorStyle
   myCurrRotationPointType = SVTK::SetRotateGravity;
   myPrevRotationPointType = myCurrRotationPointType;
 
-  myHighlightRotationPointActor->Delete();
-  myHighlightRotationPointActor->Initialize();
-  myHighlightRotationPointActor->PickableOff();
-  myHighlightRotationPointActor->SetVisibility( false );
+  myCurrFocalPointType = SVTK::SetFocalPointSelected;
+  myPrevFocalPointType = myCurrFocalPointType;
+
+  myHighlightSelectionPointActor->Delete();
+  myHighlightSelectionPointActor->Initialize();
+  myHighlightSelectionPointActor->PickableOff();
+  myHighlightSelectionPointActor->SetVisibility( false );
   
-  myHighlightRotationPointActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE+2);
-  myHighlightRotationPointActor->GetProperty()->SetLineWidth(SALOME_LINE_WIDTH+2);
-  myHighlightRotationPointActor->GetProperty()->SetRepresentationToPoints();
+  myHighlightSelectionPointActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE+2);
+  myHighlightSelectionPointActor->GetProperty()->SetLineWidth(SALOME_LINE_WIDTH+2);
+  myHighlightSelectionPointActor->GetProperty()->SetRepresentationToPoints();
 
   myBBFirstCheck = true;
 }
@@ -138,8 +138,7 @@ SVTK_InteractorStyle
 /*!
   Destructor
 */
-SVTK_InteractorStyle
-::~SVTK_InteractorStyle() 
+SVTK_InteractorStyle::~SVTK_InteractorStyle() 
 {
   endDrawRect();
 }
@@ -147,9 +146,7 @@ SVTK_InteractorStyle
 /*!
   \return widget for rendering
 */
-QWidget*
-SVTK_InteractorStyle
-::GetRenderWidget()
+QWidget* SVTK_InteractorStyle::GetRenderWidget()
 {
   return myInteractor->GetRenderWidget();
 }
@@ -157,9 +154,7 @@ SVTK_InteractorStyle
 /*!
   \return selector
 */
-SVTK_Selector*
-SVTK_InteractorStyle
-::GetSelector() 
+SVTK_Selector* SVTK_InteractorStyle::GetSelector() 
 {
   return myInteractor->GetSelector();
 }
@@ -167,9 +162,7 @@ SVTK_InteractorStyle
 /*!
   Generate special SVTK_SelectionEvent
 */
-SVTK_SelectionEvent*
-SVTK_InteractorStyle
-::GetSelectionEvent()
+SVTK_SelectionEvent* SVTK_InteractorStyle::GetSelectionEvent()
 {
   mySelectionEvent->mySelectionMode = GetSelector()->SelectionMode();
 
@@ -187,9 +180,7 @@ SVTK_InteractorStyle
 /*!
   Generate special SVTK_SelectionEvent with flipped Y coordinate
 */
-SVTK_SelectionEvent*
-SVTK_InteractorStyle
-::GetSelectionEventFlipY()
+SVTK_SelectionEvent* SVTK_InteractorStyle::GetSelectionEventFlipY()
 {
   mySelectionEvent->mySelectionMode = GetSelector()->SelectionMode();
 
@@ -204,9 +195,7 @@ SVTK_InteractorStyle
   return mySelectionEvent.get();
 }
 
-void
-SVTK_InteractorStyle
-::RotateXY(int dx, int dy)
+void SVTK_InteractorStyle::RotateXY(int dx, int dy)
 {
   /*   if(GetCurrentRenderer() == NULL)
     return;
@@ -283,18 +272,13 @@ SVTK_InteractorStyle
   this->Render();
 }
 
-void
-SVTK_InteractorStyle
-::PanXY(int x, int y, int oldX, int oldY)
+void SVTK_InteractorStyle::PanXY(int x, int y, int oldX, int oldY)
 {
   TranslateView(x, y, oldX, oldY);   
   this->Render();
 }
 
-
-void 
-SVTK_InteractorStyle
-::DollyXY(int dx, int dy)
+void SVTK_InteractorStyle::DollyXY(int dx, int dy)
 {
   if (GetCurrentRenderer() == NULL) 
     return;
@@ -308,16 +292,14 @@ SVTK_InteractorStyle
   if (aCam->GetParallelProjection())
     aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
   else{
-    aCam->Dolly(zoomFactor);
+    aCam->Dolly(zoomFactor); // Move camera in/out along projection direction
     GetCurrentRenderer()->ResetCameraClippingRange(); 
   }
 
   this->Render();
 }
 
-void 
-SVTK_InteractorStyle
-::SpinXY(int x, int y, int oldX, int oldY)
+void SVTK_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY)
 {
   vtkCamera *cam;
 
@@ -343,9 +325,7 @@ SVTK_InteractorStyle
 /*!
   To reset reset view
 */
-void
-SVTK_InteractorStyle
-::OnConfigure() 
+void SVTK_InteractorStyle::OnConfigure() 
 {
   this->FindPokedRenderer(0,0);
   this->GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
@@ -354,9 +334,7 @@ SVTK_InteractorStyle
 /*!
   To handle mouse move event
 */
-void
-SVTK_InteractorStyle
-::OnMouseMove() 
+void SVTK_InteractorStyle::OnMouseMove() 
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -368,9 +346,7 @@ SVTK_InteractorStyle
 /*!
   To handle left mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnLeftButtonDown()
+void SVTK_InteractorStyle::OnLeftButtonDown()
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -382,9 +358,7 @@ SVTK_InteractorStyle
 /*!
   To handle left mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnLeftButtonUp()
+void SVTK_InteractorStyle::OnLeftButtonUp()
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -396,9 +370,7 @@ SVTK_InteractorStyle
 /*!
   To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnMiddleButtonDown() 
+void SVTK_InteractorStyle::OnMiddleButtonDown() 
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -410,9 +382,7 @@ SVTK_InteractorStyle
 /*!
   To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnMiddleButtonUp()
+void SVTK_InteractorStyle::OnMiddleButtonUp()
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -424,9 +394,7 @@ SVTK_InteractorStyle
 /*!
   To handle right mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnRightButtonDown() 
+void SVTK_InteractorStyle::OnRightButtonDown() 
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -438,9 +406,7 @@ SVTK_InteractorStyle
 /*!
   To handle right mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnRightButtonUp()
+void SVTK_InteractorStyle::OnRightButtonUp()
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
@@ -452,11 +418,9 @@ SVTK_InteractorStyle
 /*!
   To handle mouse move event
 */
-void
-SVTK_InteractorStyle
-::OnMouseMove(int vtkNotUsed(ctrl), 
-             int shift,
-             int x, int y) 
+void SVTK_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl), 
+                                      int shift,
+                                      int x, int y) 
 {
   myShiftState = shift;
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
@@ -468,10 +432,8 @@ SVTK_InteractorStyle
 /*!
   To handle left mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnLeftButtonDown(int ctrl, int shift, 
-                  int x, int y) 
+void SVTK_InteractorStyle::OnLeftButtonDown(int ctrl, int shift, 
+                                           int x, int y) 
 {
   this->FindPokedRenderer(x, y);
   if(GetCurrentRenderer() == NULL)
@@ -489,7 +451,8 @@ SVTK_InteractorStyle
   } else {
     if (ctrl)
       startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
-    else if ( myCurrRotationPointType == SVTK::StartPointSelection )
+    else if ( myCurrRotationPointType == SVTK::StartPointSelection ||
+             myCurrFocalPointType == SVTK::StartFocalPointSelection )
     {
       SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
 
@@ -507,28 +470,50 @@ SVTK_InteractorStyle
          int anObjId = anActor->GetNodeObjId( aVtkId );
          vtkFloatingPointType* aCoords = anActor->GetNodeCoord(anObjId);
          
-         myCurrRotationPointType = SVTK::SetRotateSelected;
+         if (myCurrRotationPointType == SVTK::StartPointSelection) {
+           myCurrRotationPointType = SVTK::SetRotateSelected;
          
-         // invoke event for update coordinates in SVTK_SetRotationPointDlg
-         InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
+           // invoke event for update coordinates in SVTK_SetRotationPointDlg
+           InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
+         }
+         else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+           myCurrFocalPointType = SVTK::SetFocalPointSelected;
+         
+           // invoke event for update coordinates in SVTK_ViewParameterDlg
+           InvokeEvent(SVTK::FocalPointChanged,(void*)aCoords);
+         }
        }
        else
        {
-         // invoke event with no data (for SVTK_SetRotationPointDlg)
-         InvokeEvent(SVTK::RotationPointChanged,0);
-         myCurrRotationPointType = myPrevRotationPointType;
+         if (myCurrRotationPointType == SVTK::StartPointSelection) {
+           // invoke event with no data (for SVTK_SetRotationPointDlg)
+           InvokeEvent(SVTK::RotationPointChanged,0);
+           myCurrRotationPointType = myPrevRotationPointType;
+         }
+         else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+           // invoke event with no data (for SVTK_ViewParameterDlg)
+           InvokeEvent(SVTK::FocalPointChanged,0);
+           myCurrFocalPointType = myPrevFocalPointType;
+         }
        }
       }
       else
       {
-       // invoke event with no data (for SVTK_SetRotationPointDlg)
-       InvokeEvent(SVTK::RotationPointChanged,0);
-       myCurrRotationPointType = myPrevRotationPointType;
+       if (myCurrRotationPointType == SVTK::StartPointSelection) {
+         // invoke event with no data (for SVTK_SetRotationPointDlg)
+         InvokeEvent(SVTK::RotationPointChanged,0);
+         myCurrRotationPointType = myPrevRotationPointType;
+       }
+       else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+         // invoke event with no data (for SVTK_ViewParameterDlg)
+         InvokeEvent(SVTK::FocalPointChanged,0);
+         myCurrFocalPointType = myPrevFocalPointType;
+       }
       }
     
-      myHighlightRotationPointActor->SetVisibility( false );
+      myHighlightSelectionPointActor->SetVisibility( false );
       if(GetCurrentRenderer() != NULL)
-       GetCurrentRenderer()->RemoveActor( myHighlightRotationPointActor.GetPointer() );
+       GetCurrentRenderer()->RemoveActor( myHighlightSelectionPointActor.GetPointer() );
 
       GetRenderWidget()->setCursor(myDefCursor); 
     }
@@ -542,12 +527,10 @@ SVTK_InteractorStyle
 /*!
   To handle left mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnLeftButtonUp(int vtkNotUsed(ctrl),
-                int shift, 
-                int vtkNotUsed(x),
-                int vtkNotUsed(y))
+void SVTK_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl),
+                                         int shift, 
+                                         int vtkNotUsed(x),
+                                         int vtkNotUsed(y))
 {
   myShiftState = shift;
   // finishing current viewer operation
@@ -560,11 +543,9 @@ SVTK_InteractorStyle
 /*!
   To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnMiddleButtonDown(int ctrl,
-                    int shift, 
-                    int x, int y) 
+void SVTK_InteractorStyle::OnMiddleButtonDown(int ctrl,
+                                             int shift, 
+                                             int x, int y) 
 {
   this->FindPokedRenderer(x, y);
   if(GetCurrentRenderer() == NULL)
@@ -590,12 +571,10 @@ SVTK_InteractorStyle
 /*!
   To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnMiddleButtonUp(int vtkNotUsed(ctrl),
-                  int shift, 
-                  int vtkNotUsed(x),
-                  int vtkNotUsed(y))
+void SVTK_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl),
+                                           int shift, 
+                                           int vtkNotUsed(x),
+                                           int vtkNotUsed(y))
 {
   myShiftState = shift;
   // finishing current viewer operation
@@ -609,11 +588,9 @@ SVTK_InteractorStyle
 /*!
   To handle right mouse button down event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnRightButtonDown(int ctrl,
-                   int shift, 
-                   int x, int y) 
+void SVTK_InteractorStyle::OnRightButtonDown(int ctrl,
+                                            int shift, 
+                                            int x, int y) 
 {
   this->FindPokedRenderer(x, y);
   if(GetCurrentRenderer() == NULL)
@@ -638,12 +615,10 @@ SVTK_InteractorStyle
 /*!
   To handle right mouse button up event (reimplemented from vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnRightButtonUp(int vtkNotUsed(ctrl),
-                 int shift, 
-                 int vtkNotUsed(x),
-                 int vtkNotUsed(y))
+void SVTK_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl),
+                                          int shift, 
+                                          int vtkNotUsed(x),
+                                          int vtkNotUsed(y))
 {
   myShiftState = shift;
   // finishing current viewer operation
@@ -734,9 +709,7 @@ const char* imageRotateCursor[] = {
 /*!
   loads cursors for viewer operations - zoom, pan, etc...
 */
-void
-SVTK_InteractorStyle
-::loadCursors()
+void SVTK_InteractorStyle::loadCursors()
 {
   myDefCursor       = QCursor(Qt::ArrowCursor);
   myHandCursor      = QCursor(Qt::PointingHandCursor);
@@ -752,9 +725,7 @@ SVTK_InteractorStyle
 /*!
   Starts Zoom operation (e.g. through menu command)
 */
-void
-SVTK_InteractorStyle
-::startZoom()
+void SVTK_InteractorStyle::startZoom()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -769,9 +740,7 @@ SVTK_InteractorStyle
 /*!
   Starts Pan operation (e.g. through menu command)
 */
-void
-SVTK_InteractorStyle
-::startPan()
+void SVTK_InteractorStyle::startPan()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -785,9 +754,7 @@ SVTK_InteractorStyle
 /*!
   Starts Rotate operation (e.g. through menu command)
 */
-void 
-SVTK_InteractorStyle
-::startRotate()
+void SVTK_InteractorStyle::startRotate()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -801,19 +768,36 @@ SVTK_InteractorStyle
 /*!
   Set rotation point selected by user
 */
-void 
-SVTK_InteractorStyle
-::startPointSelection()
+void SVTK_InteractorStyle::startPointSelection()
 {
   myCurrRotationPointType = SVTK::StartPointSelection;
 
   if(GetCurrentRenderer() != NULL) {
-    GetCurrentRenderer()->AddActor( myHighlightRotationPointActor.GetPointer() );
+    GetCurrentRenderer()->AddActor( myHighlightSelectionPointActor.GetPointer() );
     vtkFloatingPointType aColor[3];
     GetCurrentRenderer()->GetBackground( aColor );
-    myHighlightRotationPointActor->GetProperty()->SetColor(1. - aColor[0],
-                                                          1. - aColor[1],
-                                                          1. - aColor[2]);
+    myHighlightSelectionPointActor->GetProperty()->SetColor(1. - aColor[0],
+                                                           1. - aColor[1],
+                                                           1. - aColor[2]);
+  }
+
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+}
+
+/*!
+  Set focal point selected by user
+*/
+void SVTK_InteractorStyle::startFocalPointSelection()
+{
+  myCurrFocalPointType = SVTK::StartFocalPointSelection;
+
+  if(GetCurrentRenderer() != NULL) {
+    GetCurrentRenderer()->AddActor( myHighlightSelectionPointActor.GetPointer() );
+    vtkFloatingPointType aColor[3];
+    GetCurrentRenderer()->GetBackground( aColor );
+    myHighlightSelectionPointActor->GetProperty()->SetColor(1. - aColor[0],
+                                                           1. - aColor[1],
+                                                           1. - aColor[2]);
   }
 
   setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
@@ -822,9 +806,7 @@ SVTK_InteractorStyle
 /*! 
   Starts Spin operation (e.g. through menu command)
 */
-void
-SVTK_InteractorStyle
-::startSpin()
+void SVTK_InteractorStyle::startSpin()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -840,9 +822,7 @@ SVTK_InteractorStyle
 /*!
   Starts Fit Area operation (e.g. through menu command)
 */
-void
-SVTK_InteractorStyle
-::startFitArea()
+void SVTK_InteractorStyle::startFitArea()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -857,9 +837,7 @@ SVTK_InteractorStyle
 /*!
   Starts Global Panning operation (e.g. through menu command)
 */
-void
-SVTK_InteractorStyle
-::startGlobalPan()
+void SVTK_InteractorStyle::startGlobalPan()
 {
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
   {
@@ -881,12 +859,10 @@ SVTK_InteractorStyle
 /*!
   Fits viewer contents to rect
 */
-void
-SVTK_InteractorStyle
-::fitRect(const int left, 
-         const int top, 
-         const int right, 
-         const int bottom)
+void SVTK_InteractorStyle::fitRect(const int left, 
+                                  const int top, 
+                                  const int right, 
+                                  const int bottom)
 {
   if (GetCurrentRenderer() == NULL) 
     return;
@@ -919,9 +895,7 @@ SVTK_InteractorStyle
 /*!
   Starts viewer operation (!internal usage!)
 */
-void
-SVTK_InteractorStyle
-::startOperation(int operation)
+void SVTK_InteractorStyle::startOperation(int operation)
 {
   switch(operation)
   { 
@@ -951,9 +925,7 @@ SVTK_InteractorStyle
 /*!
   Sets proper cursor for window when viewer operation is activated
 */
-void
-SVTK_InteractorStyle
-::setCursor(const int operation)
+void SVTK_InteractorStyle::setCursor(const int operation)
 {
   if (!GetRenderWidget()) return;
   switch (operation)
@@ -985,7 +957,8 @@ SVTK_InteractorStyle
       break;
     case VTK_INTERACTOR_STYLE_CAMERA_NONE:
     default:
-      if ( myCurrRotationPointType == SVTK::StartPointSelection )
+      if ( myCurrRotationPointType == SVTK::StartPointSelection ||
+          myCurrFocalPointType == SVTK::StartFocalPointSelection )
        GetRenderWidget()->setCursor(myHandCursor);
       else
        GetRenderWidget()->setCursor(myDefCursor); 
@@ -998,9 +971,7 @@ SVTK_InteractorStyle
 /*!
   Called when viewer operation started (!put necessary initialization here!)
 */
-void
-SVTK_InteractorStyle
-::onStartOperation()
+void SVTK_InteractorStyle::onStartOperation()
 {
   if (!GetRenderWidget()) 
     return;
@@ -1029,9 +1000,7 @@ SVTK_InteractorStyle
 /*!
   Called when viewer operation finished (!put necessary post-processing here!)
 */
-void
-SVTK_InteractorStyle
-::onFinishOperation() 
+void SVTK_InteractorStyle::onFinishOperation() 
 {
   if (!GetRenderWidget()) 
     return;
@@ -1137,9 +1106,7 @@ SVTK_InteractorStyle
 /*!
   Called during viewer operation when user moves mouse (!put necessary processing here!)
 */
-void
-SVTK_InteractorStyle
-::onOperation(QPoint mousePos) 
+void SVTK_InteractorStyle::onOperation(QPoint mousePos) 
 {
   if (!GetRenderWidget()) 
     return;
@@ -1191,9 +1158,7 @@ SVTK_InteractorStyle
   Called when user moves mouse inside viewer window and there is no active viewer operation 
   (!put necessary processing here!)
 */
-void
-SVTK_InteractorStyle
-::onCursorMove(QPoint mousePos) 
+void SVTK_InteractorStyle::onCursorMove(QPoint mousePos) 
 {
   // processing highlighting
   SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
@@ -1203,9 +1168,10 @@ SVTK_InteractorStyle
 
   SALOME_Actor *anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
 
-  if ( myCurrRotationPointType == SVTK::StartPointSelection )
+  if ( myCurrRotationPointType == SVTK::StartPointSelection ||
+       myCurrFocalPointType == SVTK::StartFocalPointSelection )
   {
-    myHighlightRotationPointActor->SetVisibility( false );
+    myHighlightSelectionPointActor->SetVisibility( false );
 
     if ( anActor )
     {
@@ -1216,9 +1182,9 @@ SVTK_InteractorStyle
 
        TColStd_IndexedMapOfInteger aMapIndex;
        aMapIndex.Add( anObjId );
-       myHighlightRotationPointActor->MapPoints( anActor, aMapIndex );
+       myHighlightSelectionPointActor->MapPoints( anActor, aMapIndex );
 
-       myHighlightRotationPointActor->SetVisibility( true );
+       myHighlightSelectionPointActor->SetVisibility( true );
        anIsChanged = true;
       }
     }
@@ -1242,9 +1208,7 @@ SVTK_InteractorStyle
 /*!
   Called on finsh GlobalPan operation 
 */
-void
-SVTK_InteractorStyle
-::Place(const int theX, const int theY) 
+void SVTK_InteractorStyle::Place(const int theX, const int theY) 
 {
   if (GetCurrentRenderer() == NULL)
     return;
@@ -1269,9 +1233,7 @@ SVTK_InteractorStyle
 /*!
   Translates view from Point to Point
 */
-void
-SVTK_InteractorStyle
-::TranslateView(int toX, int toY, int fromX, int fromY)
+void SVTK_InteractorStyle::TranslateView(int toX, int toY, int fromX, int fromY)
 {
   vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
   double viewFocus[4], focalDepth, viewPoint[3];
@@ -1302,23 +1264,17 @@ SVTK_InteractorStyle
                   motionVector[2] + viewPoint[2]);
 }
 
-void
-SVTK_InteractorStyle
-::IncrementalPan( const int incrX, const int incrY )
+void SVTK_InteractorStyle::IncrementalPan( const int incrX, const int incrY )
 {
   this->PanXY( incrX, incrY, 0, 0 );
 }
 
-void
-SVTK_InteractorStyle
-::IncrementalZoom( const int incr )
+void SVTK_InteractorStyle::IncrementalZoom( const int incr )
 {
   this->DollyXY( incr, incr );
 }
 
-void
-SVTK_InteractorStyle
-::IncrementalRotate( const int incrX, const int incrY )
+void SVTK_InteractorStyle::IncrementalRotate( const int incrX, const int incrY )
 {
   this->RotateXY( incrX, -incrY );
 }
@@ -1326,9 +1282,7 @@ SVTK_InteractorStyle
 /*!
   Redefined in order to add an observer (callback) for custorm event (space mouse event)
 */
-void
-SVTK_InteractorStyle
-::SetInteractor( vtkRenderWindowInteractor* theInteractor )
+void SVTK_InteractorStyle::SetInteractor( vtkRenderWindowInteractor* theInteractor )
 {
   // register EventCallbackCommand as observer of standard events (keypress, mousemove, etc)
   Superclass::SetInteractor( theInteractor );
@@ -1367,15 +1321,17 @@ SVTK_InteractorStyle
     theInteractor->AddObserver( SVTK::StartPointSelection, EventCallbackCommand, Priority );
 
     theInteractor->AddObserver( SVTK::ChangeRotationPoint, EventCallbackCommand, Priority );
+
+    theInteractor->AddObserver( SVTK::SetFocalPointGravity, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartFocalPointSelection, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::SetFocalPointSelected, EventCallbackCommand, Priority );
   }
 }
 
 /*!
   To implement cached rendering
 */
-void
-SVTK_InteractorStyle
-::OnTimer() 
+void SVTK_InteractorStyle::OnTimer() 
 {
   //vtkInteractorStyle::OnTimer();
   this->Interactor->Render();
@@ -1408,16 +1364,12 @@ SVTK_InteractorStyle
 /*!
   To invoke #vtkRenderWindowInteractor::CreateTimer
 */
-void
-SVTK_InteractorStyle
-::Render() 
+void SVTK_InteractorStyle::Render() 
 {
   this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
 }
 
-void
-SVTK_InteractorStyle
-::onSpaceMouseMove( double* data )
+void SVTK_InteractorStyle::onSpaceMouseMove( double* data )
 {
   // general things, do SetCurrentRenderer() within FindPokedRenderer() 
   int x, y;
@@ -1430,9 +1382,7 @@ SVTK_InteractorStyle
   IncrementalRotate( (int)data[3], 0  );   // 5. tilt the control forward/backward = rotate around X axis (Z axis of local coordinate system of space mouse)
 }
 
-void
-SVTK_InteractorStyle
-::onSpaceMouseButton( int button )
+void SVTK_InteractorStyle::onSpaceMouseButton( int button )
 {
   if( mySMDecreaseSpeedBtn == button ) {   
     ControllerIncrement()->Decrease();
@@ -1444,9 +1394,7 @@ SVTK_InteractorStyle
     DominantCombinedSwitch();
 }
 
-void
-SVTK_InteractorStyle
-::DominantCombinedSwitch()
+void SVTK_InteractorStyle::DominantCombinedSwitch()
 {
   printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" );
 }
@@ -1454,9 +1402,7 @@ SVTK_InteractorStyle
 /*!
   Draws rectangle by starting and current points
 */
-void
-SVTK_InteractorStyle
-::drawRect()
+void SVTK_InteractorStyle::drawRect()
 {
   if ( !myRectBand ) {
     myRectBand = new QRubberBand( QRubberBand::Rectangle, GetRenderWidget() );
@@ -1474,9 +1420,7 @@ SVTK_InteractorStyle
 /*!
   \brief Delete rubber band on the end on the dragging operation.
 */
-void
-SVTK_InteractorStyle
-::endDrawRect()
+void SVTK_InteractorStyle::endDrawRect()
 {
   if ( myRectBand ) myRectBand->hide();
 
@@ -1487,12 +1431,10 @@ SVTK_InteractorStyle
 /*!
   Main process event method (reimplemented from #vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::ProcessEvents( vtkObject* object,
-                unsigned long event,
-                void* clientData, 
-                void* callData )
+void SVTK_InteractorStyle::ProcessEvents( vtkObject* object,
+                                         unsigned long event,
+                                         void* clientData, 
+                                         void* callData )
 {
   if ( clientData ) {
     vtkObject* anObject = reinterpret_cast<vtkObject*>( clientData );
@@ -1577,9 +1519,9 @@ SVTK_InteractorStyle
       case SVTK::SetRotateGravity:
        if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
        {
-         self->myHighlightRotationPointActor->SetVisibility( false );
+         self->myHighlightSelectionPointActor->SetVisibility( false );
          if( self->GetCurrentRenderer() != NULL )
-           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
          self->GetRenderWidget()->setCursor(self->myDefCursor); 
        }
        self->myPrevRotationPointType = self->myCurrRotationPointType;
@@ -1595,9 +1537,9 @@ SVTK_InteractorStyle
       case SVTK::ChangeRotationPoint:
        if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
        {
-         self->myHighlightRotationPointActor->SetVisibility( false );
+         self->myHighlightSelectionPointActor->SetVisibility( false );
          if( self->GetCurrentRenderer() != NULL )
-           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
          self->GetRenderWidget()->setCursor(self->myDefCursor); 
        }
        self->myPrevRotationPointType = self->myCurrRotationPointType;
@@ -1607,6 +1549,36 @@ SVTK_InteractorStyle
        self->myRotationPointY = aSelectedPoint[1];
        self->myRotationPointZ = aSelectedPoint[2];
        return;
+
+      case SVTK::SetFocalPointGravity:
+       if ( self->myCurrFocalPointType == SVTK::StartPointSelection )
+       {
+         self->myHighlightSelectionPointActor->SetVisibility( false );
+         if( self->GetCurrentRenderer() != NULL )
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+         self->GetRenderWidget()->setCursor(self->myDefCursor); 
+       }
+       self->myCurrFocalPointType = SVTK::SetFocalPointGravity;
+       if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) {
+         // invoke event for update coordinates in SVTK_ViewParameterDlg
+         self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
+       }
+       return;
+      case SVTK::StartFocalPointSelection:
+       self->startFocalPointSelection();
+       return;
+
+      case SVTK::SetFocalPointSelected:
+       if ( self->myCurrFocalPointType == SVTK::StartFocalPointSelection )
+       {
+         self->myHighlightSelectionPointActor->SetVisibility( false );
+         if( self->GetCurrentRenderer() != NULL )
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+         self->GetRenderWidget()->setCursor(self->myDefCursor); 
+       }
+       self->myPrevFocalPointType = self->myCurrFocalPointType;
+       self->myCurrFocalPointType = SVTK::SetFocalPointSelected;
+       return;
       }
     }
   }
index b02941bfb72d25a64e02092d26dc6248d925338b..c1985352d636e5a41945ce2e585bee0171a8705f 100644 (file)
@@ -283,6 +283,7 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle
   void startSpin();
 
   void startPointSelection();
+  void startFocalPointSelection();
 
  protected:
   void loadCursors();
@@ -336,11 +337,14 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle
   unsigned long                   myCurrRotationPointType;
   unsigned long                   myPrevRotationPointType;
 
+  unsigned long                   myCurrFocalPointType;
+  unsigned long                   myPrevFocalPointType;
+
   double                          myRotationPointX;
   double                          myRotationPointY;
   double                          myRotationPointZ;
 
-  vtkSmartPointer<SVTK_Actor>     myHighlightRotationPointActor;
+  vtkSmartPointer<SVTK_Actor>     myHighlightSelectionPointActor;
   vtkSmartPointer<vtkPointPicker> myPointPicker;
   
   vtkFloatingPointType            myBBCenter[3];
index edfeb787a23d3d92dedc2181a927c6fd336f284b..f8a026ec2fc0e2e10d64d878fedd0db5806aa0dd 100644 (file)
@@ -48,6 +48,7 @@
 #include "SVTK_UpdateRateDlg.h"
 #include "SVTK_CubeAxesDlg.h"
 #include "SVTK_SetRotationPointDlg.h"
+#include "SVTK_ViewParameterDlg.h"
 #include "SVTK_MainWindow.h"
 #include "SVTK_Event.h"
 #include "SVTK_Renderer.h"
@@ -97,6 +98,8 @@ SVTK_MainWindow
   myCubeAxesDlg = new SVTK_CubeAxesDlg( action( GraduatedAxes ), this, "SVTK_CubeAxesDlg" );
   mySetRotationPointDlg = new SVTK_SetRotationPointDlg
     ( action( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" );
+  myViewParameterDlg = new SVTK_ViewParameterDlg
+    ( action( ViewParametersId ), this, "SVTK_ViewParameterDlg" );
 }
 
 /*!
@@ -538,6 +541,15 @@ SVTK_MainWindow
   connect(anAction, SIGNAL(activated()), this, SLOT(onRightView()));
   mgr->registerAction( anAction, RightId );
 
+  // View Parameters
+  anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PARAMETERS" ) ),
+                          tr( "MNU_VIEWPARAMETERS_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_VIEWPARAMETERS_VIEW"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onViewParameters(bool)));
+  mgr->registerAction( anAction, ViewParametersId );
+
   // Reset
   anAction = new QtxAction(tr("MNU_RESET_VIEW"), 
                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
@@ -624,6 +636,8 @@ SVTK_MainWindow
 
   mgr->append( ResetId, myToolBar );
 
+  mgr->append( ViewParametersId, myToolBar );
+
   mgr->append( UpdateRate, myToolBar );
   mgr->append( NonIsometric, myToolBar );
   mgr->append( GraduatedAxes, myToolBar );
@@ -725,6 +739,46 @@ SVTK_MainWindow
   myEventDispatcher->InvokeEvent(SVTK::StartPointSelection,0);
 }
 
+/*!
+  Modify view parameters
+*/
+void
+SVTK_MainWindow
+::onViewParameters(bool theIsActivate)
+{
+  if(theIsActivate){
+    myViewParameterDlg->addObserver();
+    myViewParameterDlg->show();
+  }else
+    myViewParameterDlg->hide();
+}
+
+/*!
+  Set the gravity center as a focal point
+*/
+void SVTK_MainWindow::activateSetFocalPointGravity()
+{
+  myEventDispatcher->InvokeEvent(SVTK::SetFocalPointGravity, 0);
+}
+
+/*!
+  Set the selected point as a focal point
+*/
+void SVTK_MainWindow::activateSetFocalPointSelected()
+{
+  myEventDispatcher->InvokeEvent(SVTK::SetFocalPointSelected, 0);
+}
+
+/*!
+  Set the point selected by user as a focal point
+*/
+void
+SVTK_MainWindow
+::activateStartFocalPointSelection()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartFocalPointSelection,0);
+}
+
 /*!
   Starts global panning transformation
 */
index 510266f7336d6c7078649d437561f844110631f6..7bdba4a78a3f33a225f74e3e49dd83d49762418e 100644 (file)
@@ -48,6 +48,7 @@ class SVTK_UpdateRateDlg;
 class SVTK_CubeAxesActor2D;
 class SVTK_CubeAxesDlg;
 class SVTK_SetRotationPointDlg;
+class SVTK_ViewParameterDlg;
 class SVTK_Renderer;
 class SVTK_Selector;
 
@@ -222,6 +223,12 @@ public:
   void onResetView();     
   void onFitAll();
 
+  void onViewParameters(bool theIsActivate);
+
+  void activateSetFocalPointGravity();
+  void activateSetFocalPointSelected();
+  void activateStartFocalPointSelection();
+
   void onViewTrihedron(); 
   void onViewCubeAxes();
 
@@ -252,7 +259,8 @@ public:
   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, 
         ChangeRotationPointId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, 
-        ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate};
+        ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
+        ViewParametersId };
 
   SUIT_ViewWindow* myViewWindow;
 
@@ -260,6 +268,7 @@ public:
   SVTK_UpdateRateDlg* myUpdateRateDlg;
   SVTK_CubeAxesDlg* myCubeAxesDlg;
   SVTK_SetRotationPointDlg* mySetRotationPointDlg;
+  SVTK_ViewParameterDlg* myViewParameterDlg;
 
   vtkSmartPointer<vtkObject> myEventDispatcher;
   int myToolBar;
diff --git a/src/SVTK/SVTK_ViewParameterDlg.cxx b/src/SVTK/SVTK_ViewParameterDlg.cxx
new file mode 100755 (executable)
index 0000000..057c1ae
--- /dev/null
@@ -0,0 +1,735 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header: 
+
+#include "SVTK_ViewParameterDlg.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_Event.h"
+#include "SVTK_InteractorStyle.h"
+
+#include "VTKViewer_Utilities.h"
+
+#include "QtxAction.h"
+
+#include <QLineEdit>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QDoubleValidator>
+#include <QCheckBox>
+#include <QRadioButton>
+#include <QButtonGroup>
+
+#include <vtkCallbackCommand.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+using namespace std;
+
+/*!
+  Constructor
+*/
+SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
+                                            SVTK_MainWindow* theParent,
+                                            const char* theName):
+  SVTK_DialogBase(theAction, theParent, theName),
+  myMainWindow(theParent),
+  myPriority(0.0),
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myRWInteractor(theParent->GetInteractor())
+{
+  setWindowTitle(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  // Top layout
+  QVBoxLayout* aTopLayout = new QVBoxLayout(this);
+  aTopLayout->setSpacing(6);
+  aTopLayout->setMargin(11);
+
+  // Projection mode
+  QGroupBox* aGroupBoxMode = new QGroupBox(tr("PROJECTION_MODE"), this);
+  QHBoxLayout* aLayout1 = new QHBoxLayout(aGroupBoxMode);
+
+  QRadioButton* aOrtho = new QRadioButton(tr("ORTHOGONAL_MODE"), aGroupBoxMode);
+  QRadioButton* aPersp = new QRadioButton(tr("PERSPECTIVE_MODE"), aGroupBoxMode);
+
+  aLayout1->addWidget(aOrtho);
+  aLayout1->addWidget(aPersp);
+
+  myProjectionMode = new QButtonGroup(aGroupBoxMode);
+  myProjectionMode->addButton(aOrtho, 0);
+  myProjectionMode->addButton(aPersp, 1);
+  connect(myProjectionMode, SIGNAL(buttonClicked(int)), SLOT(onProjectionModeChanged(int)));
+
+  // Focal point
+  QGroupBox* aGroupBoxFocal = new QGroupBox(tr("FOCAL_POINT"), this);
+  QVBoxLayout* aLayout2 = new QVBoxLayout(aGroupBoxFocal);
+
+  /*
+  myIsBBCenter = new QCheckBox(tr("USE_BBCENTER"), aGroupBoxFocal);
+  aLayout2->addWidget(myIsBBCenter);
+  connect(myIsBBCenter, SIGNAL(stateChanged(int)), SLOT(onBBCenterChecked()));
+  */
+
+  myToBBCenter = new QPushButton(aGroupBoxFocal);
+  myToBBCenter->setText(tr("LBL_TOBBCENTER"));
+  aLayout2->addWidget(myToBBCenter);
+  connect(myToBBCenter, SIGNAL(clicked()), this, SLOT(onToBBCenter()));
+
+  myToOrigin = new QPushButton(aGroupBoxFocal);
+  myToOrigin->setText(tr("LBL_TOORIGIN"));
+  aLayout2->addWidget(myToOrigin);
+  connect(myToOrigin, SIGNAL(clicked()), this, SLOT(onToOrigin()));
+
+  mySelectPoint = new QPushButton(aGroupBoxFocal);
+  mySelectPoint->setText(tr("LBL_SELECTPOINT"));
+  mySelectPoint->setCheckable(true);
+  aLayout2->addWidget(mySelectPoint);
+  connect(mySelectPoint, SIGNAL(clicked()), this, SLOT(onSelectPoint()));
+
+  // Focal point coordinates
+  myFocalCoords = new QFrame(aGroupBoxFocal);
+  myFocalCoords->setObjectName("FocalPointCoordinates");
+
+  QHBoxLayout* aCoordLayout = new QHBoxLayout(myFocalCoords);
+  aCoordLayout->setSpacing(6);
+  aCoordLayout->setMargin(0);
+  
+  QLabel* aLabelX = new QLabel(tr("LBL_X"), myFocalCoords);
+  aLabelX->setFixedWidth(25);
+  myFocalX = new QLineEdit(myFocalCoords);
+  myFocalX->setValidator(new QDoubleValidator(myFocalX));
+  myFocalX->setText(QString::number(0.0));
+  connect(myFocalX, SIGNAL(textChanged(const QString&)), SLOT(onFocalCoordChanged()));
+  
+  QLabel* aLabelY = new QLabel(tr("LBL_Y"), myFocalCoords);
+  aLabelY->setFixedWidth(25);
+  myFocalY = new QLineEdit(myFocalCoords);
+  myFocalY->setValidator(new QDoubleValidator(myFocalY));
+  myFocalY->setText(QString::number(0.0));
+  connect(myFocalY, SIGNAL(textChanged(const QString&)), SLOT(onFocalCoordChanged()));
+
+  QLabel* aLabelZ = new QLabel(tr("LBL_Z"), myFocalCoords);
+  aLabelZ->setFixedWidth(25);
+  myFocalZ = new QLineEdit(myFocalCoords);
+  myFocalZ->setValidator(new QDoubleValidator(myFocalZ));
+  myFocalZ->setText(QString::number(0.0));
+  connect(myFocalZ, SIGNAL(textChanged(const QString&)), SLOT(onFocalCoordChanged()));
+
+  aCoordLayout->addWidget(aLabelX);
+  aCoordLayout->addWidget(myFocalX);
+  aCoordLayout->addWidget(aLabelY);
+  aCoordLayout->addWidget(myFocalY);
+  aCoordLayout->addWidget(aLabelZ);
+  aCoordLayout->addWidget(myFocalZ);
+  aLayout2->addWidget(myFocalCoords);
+
+  // Camera position
+  QGroupBox* aGroupBoxCamera = new QGroupBox(tr("CAMERA_POSITION"), this);
+  QVBoxLayout* aLayout3 = new QVBoxLayout(aGroupBoxCamera);
+
+  QRadioButton* aWorld = new QRadioButton(tr("WORLD_COORDINATES"), aGroupBoxCamera);
+  QRadioButton* aRelative = new QRadioButton(tr("FOCAL_RELATIVE"), aGroupBoxCamera);
+
+  QHBoxLayout* aHLayout = new QHBoxLayout;
+  aHLayout->addWidget(aWorld);
+  aHLayout->addWidget(aRelative);
+  aLayout3->addLayout(aHLayout);
+
+  myCameraPositionMode = new QButtonGroup(aGroupBoxCamera);
+  myCameraPositionMode->addButton(aWorld, 0);
+  myCameraPositionMode->addButton(aRelative, 1);
+  connect(myCameraPositionMode, SIGNAL(buttonClicked(int)), SLOT(onPositionModeChanged(int)));
+
+  // Camera coordinates
+  myCameraCoords = new QFrame(aGroupBoxCamera);
+  myCameraCoords->setObjectName("CameraCoordinates");
+
+  aCoordLayout = new QHBoxLayout(myCameraCoords);
+  aCoordLayout->setSpacing(6);
+  aCoordLayout->setMargin(0);
+
+  aLabelX = new QLabel(tr("LBL_X"), myCameraCoords);
+  aLabelX->setFixedWidth(25);
+  myCameraX = new QLineEdit(myCameraCoords);
+  myCameraX->setValidator(new QDoubleValidator(myCameraX));
+  myCameraX->setText(QString::number(0.0));
+  connect(myCameraX, SIGNAL(textChanged(const QString&)), SLOT(onCameraCoordChanged()));
+
+  aLabelY = new QLabel(tr("LBL_Y"), myCameraCoords);
+  aLabelY->setFixedWidth(25);
+  myCameraY = new QLineEdit(myCameraCoords);
+  myCameraY->setValidator(new QDoubleValidator(myCameraY));
+  myCameraY->setText(QString::number(0.0));
+  connect(myCameraY, SIGNAL(textChanged(const QString&)), SLOT(onCameraCoordChanged()));
+
+  aLabelZ = new QLabel(tr("LBL_Z"), myCameraCoords);
+  aLabelZ->setFixedWidth(25);
+  myCameraZ = new QLineEdit(myCameraCoords);
+  myCameraZ->setValidator(new QDoubleValidator(myCameraZ));
+  myCameraZ->setText(QString::number(1.0));
+  connect(myCameraZ, SIGNAL(textChanged(const QString&)), SLOT(onCameraCoordChanged()));
+
+  aCoordLayout->addWidget(aLabelX);
+  aCoordLayout->addWidget(myCameraX);
+  aCoordLayout->addWidget(aLabelY);
+  aCoordLayout->addWidget(myCameraY);
+  aCoordLayout->addWidget(aLabelZ);
+  aCoordLayout->addWidget(myCameraZ);
+  aLayout3->addWidget(myCameraCoords);
+
+  // Projection direction
+  QFrame* line1 = new QFrame(aGroupBoxCamera);
+  line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+  aLayout3->addWidget(line1);
+
+  QLabel* aLabel = new QLabel(tr("PROJECTION_DIRECTION"), aGroupBoxCamera);
+  aLayout3->addWidget(aLabel);
+
+  myProjDirection = new QFrame(aGroupBoxCamera);
+  myProjDirection->setObjectName("ProjectionDirection");
+
+  aCoordLayout = new QHBoxLayout(myProjDirection);
+  aCoordLayout->setSpacing(6);
+  aCoordLayout->setMargin(0);
+
+  aLabelX = new QLabel(tr("LBL_DX"), myProjDirection);
+  aLabelX->setFixedWidth(25);
+  myProjDirX = new QLineEdit(myProjDirection);
+  myProjDirX->setValidator(new QDoubleValidator(myProjDirX));
+  myProjDirX->setText(QString::number(0.0));
+  connect(myProjDirX, SIGNAL(textChanged(const QString&)), SLOT(onDirectionChanged()));
+
+  aLabelY = new QLabel(tr("LBL_DY"), myProjDirection);
+  aLabelY->setFixedWidth(25);
+  myProjDirY = new QLineEdit(myProjDirection);
+  myProjDirY->setValidator(new QDoubleValidator(myProjDirY));
+  myProjDirY->setText(QString::number(0.0));
+  connect(myProjDirY, SIGNAL(textChanged(const QString&)), SLOT(onDirectionChanged()));
+
+  aLabelZ = new QLabel(tr("LBL_DZ"), myProjDirection);
+  aLabelZ->setFixedWidth(25);
+  myProjDirZ = new QLineEdit(myProjDirection);
+  myProjDirZ->setValidator(new QDoubleValidator(myProjDirZ));
+  myProjDirZ->setText(QString::number(-1.0));
+  connect(myProjDirZ, SIGNAL(textChanged(const QString&)), SLOT(onDirectionChanged()));
+
+  aCoordLayout->addWidget(aLabelX);
+  aCoordLayout->addWidget(myProjDirX);
+  aCoordLayout->addWidget(aLabelY);
+  aCoordLayout->addWidget(myProjDirY);
+  aCoordLayout->addWidget(aLabelZ);
+  aCoordLayout->addWidget(myProjDirZ);
+  aLayout3->addWidget(myProjDirection);
+
+  // Distance to focal point
+  QHBoxLayout* aHorLayout = new QHBoxLayout;
+  aHorLayout->setSpacing(6);
+
+  aLabel = new QLabel(tr("FOCAL_DISTANCE"), aGroupBoxCamera);
+  myDistance = new QLineEdit(aGroupBoxCamera);
+  QDoubleValidator* aVal = new QDoubleValidator(myDistance);
+  aVal->setBottom(0.0002); // VTK minimal distance
+  myDistance->setValidator(aVal);
+  myDistance->setText(QString::number(1.0));
+  connect(myDistance, SIGNAL(textChanged(const QString&)), SLOT(onDistanceChanged()));
+  
+  aHorLayout->addWidget(aLabel);
+  aHorLayout->addWidget(myDistance);
+  aLayout3->addLayout(aHorLayout);
+
+  // View Up direction
+  QFrame* line2 = new QFrame(aGroupBoxCamera);
+  line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+  aLayout3->addWidget(line2);
+
+  aLabel = new QLabel(tr("VIEW_UP_DIRECTION"), aGroupBoxCamera);
+  aLayout3->addWidget(aLabel);
+
+  myViewDirection = new QFrame(aGroupBoxCamera);
+  myViewDirection->setObjectName("ViewUpDirection");
+  aLayout3->addWidget(myViewDirection);
+
+  aCoordLayout = new QHBoxLayout(myViewDirection);
+  aCoordLayout->setSpacing(6);
+  aCoordLayout->setMargin(0);
+
+  aLabelX = new QLabel(tr("LBL_DX"), myViewDirection);
+  aLabelX->setFixedWidth(25);
+  myViewDirX = new QLineEdit(myViewDirection);
+  myViewDirX->setValidator(new QDoubleValidator(myViewDirX));
+  myViewDirX->setText(QString::number(0.0));
+  connect(myViewDirX, SIGNAL(textChanged(const QString&)), SLOT(onViewDirectionChanged()));
+
+  aLabelY = new QLabel(tr("LBL_DY"), myViewDirection);
+  aLabelY->setFixedWidth(25);
+  myViewDirY = new QLineEdit(myViewDirection);
+  myViewDirY->setValidator(new QDoubleValidator(myViewDirY));
+  myViewDirY->setText(QString::number(1.0));
+  connect(myViewDirY, SIGNAL(textChanged(const QString&)), SLOT(onViewDirectionChanged()));
+
+  aLabelZ = new QLabel(tr("LBL_DZ"), myViewDirection);
+  aLabelZ->setFixedWidth(25);
+  myViewDirZ = new QLineEdit(myViewDirection);
+  myViewDirZ->setValidator(new QDoubleValidator(myViewDirZ));
+  myViewDirZ->setText(QString::number(0.0));
+  connect(myViewDirZ, SIGNAL(textChanged(const QString&)), SLOT(onViewDirectionChanged()));
+
+  aCoordLayout->addWidget(aLabelX);
+  aCoordLayout->addWidget(myViewDirX);
+  aCoordLayout->addWidget(aLabelY);
+  aCoordLayout->addWidget(myViewDirY);
+  aCoordLayout->addWidget(aLabelZ);
+  aCoordLayout->addWidget(myViewDirZ);
+
+  // Zooming
+  QGroupBox* aGroupBoxZoom = new QGroupBox(tr("ZOOMING"), this);
+  QVBoxLayout* aLayout4 = new QVBoxLayout(aGroupBoxZoom);
+
+  // Parallel scale
+  myScaleBox = new QFrame(aGroupBoxZoom);
+  myScaleBox->setObjectName("ScaleValue");
+
+  aHorLayout = new QHBoxLayout(myScaleBox);
+  aHorLayout->setSpacing(6);
+  aHorLayout->setMargin(0);
+
+  aLabel = new QLabel(tr("LBL_SCALE"), myScaleBox);
+  myScale = new QLineEdit(myScaleBox);
+  QDoubleValidator* aVal2 = new QDoubleValidator(myScale);
+  aVal2->setBottom(0.000001); // VTK minimal scale
+  myScale->setValidator(aVal2);
+  myScale->setText(QString::number(1.0));
+  connect(myScale, SIGNAL(textChanged(const QString&)), SLOT(onZoomChanged()));
+
+  aHorLayout->addWidget(aLabel);
+  aHorLayout->addWidget(myScale);
+  aLayout4->addWidget(myScaleBox);
+
+  // View Angle
+  myViewAngleBox = new QFrame(aGroupBoxZoom);
+  myViewAngleBox->setObjectName("ViewAngle");
+
+  aHorLayout = new QHBoxLayout(myViewAngleBox);
+  aHorLayout->setSpacing(6);
+  aHorLayout->setMargin(0);
+
+  aLabel = new QLabel(tr("LBL_VIEW_ANGLE"), myViewAngleBox);
+  myViewAngle = new QLineEdit(myViewAngleBox);
+  QDoubleValidator* aVal3 = new QDoubleValidator(myViewAngle);
+  aVal3->setBottom(0.000001); // VTK minimal scale
+  aVal3->setTop(179); // VTK minimal scale
+  myViewAngle->setValidator(aVal3);
+  myViewAngle->setText(QString::number(30.0));
+  connect(myViewAngle, SIGNAL(textChanged(const QString&)), SLOT(onZoomChanged()));
+
+  aHorLayout->addWidget(aLabel);
+  aHorLayout->addWidget(myViewAngle);
+  aLayout4->addWidget(myViewAngleBox);
+
+  // "Close" button
+  QGroupBox* aGroupBox = new QGroupBox(this);
+  QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox);
+  aHBoxLayout2->setMargin(11);
+  aHBoxLayout2->setSpacing(6);
+
+  QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
+  m_bClose->setObjectName("m_bClose");
+  m_bClose->setAutoDefault(TRUE);
+  m_bClose->setFixedSize(m_bClose->sizeHint());
+  connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
+
+  // Layout buttons
+  aHBoxLayout2->addWidget(m_bClose);
+
+  // Layout top level widgets
+  aTopLayout->addWidget(aGroupBoxMode);
+  aTopLayout->addWidget(aGroupBoxFocal);
+  aTopLayout->addWidget(aGroupBoxCamera);
+  aTopLayout->addWidget(aGroupBoxZoom);
+  aTopLayout->addWidget(aGroupBox);
+  aTopLayout->addStretch();
+
+  // initial state
+  myProjectionMode->button(0)->setChecked(true);
+  myCameraPositionMode->button(0)->setChecked(true);
+
+  setEnabled(myCameraCoords, myCameraPositionMode->checkedId() == 0);
+
+  myScaleBox->setVisible(myProjectionMode->checkedId() == 0);
+  myViewAngleBox->setVisible(myProjectionMode->checkedId() == 1);
+
+  updateData();
+
+  this->resize(400, this->sizeHint().height());
+
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this);
+  myEventCallbackCommand->SetCallback(SVTK_ViewParameterDlg::ProcessEvents);
+  myIsObserverAdded = false;
+  myBusy = false;
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+SVTK_ViewParameterDlg::~SVTK_ViewParameterDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void SVTK_ViewParameterDlg::addObserver()
+{
+  if ( !myIsObserverAdded ) {
+    vtkInteractorStyle* aIStyle = myRWInteractor->GetInteractorStyle();
+    aIStyle->AddObserver(SVTK::BBCenterChanged, myEventCallbackCommand.GetPointer(), myPriority);
+    aIStyle->AddObserver(SVTK::FocalPointChanged, myEventCallbackCommand.GetPointer(), myPriority);
+
+    vtkRenderer *aRenderer = myRWInteractor->getRenderer();
+    aRenderer->AddObserver(vtkCommand::EndEvent, myEventCallbackCommand.GetPointer(), myPriority);
+
+    myIsObserverAdded = true;
+  }
+}
+
+/*!
+  Processes events
+*/
+void SVTK_ViewParameterDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+                                         unsigned long theEvent,
+                                         void* theClientData, 
+                                         void* theCallData)
+{
+  SVTK_ViewParameterDlg* self = reinterpret_cast<SVTK_ViewParameterDlg*>(theClientData);
+  vtkFloatingPointType* aCoord;
+  switch ( theEvent ) {
+  case SVTK::BBCenterChanged:
+    if ( theCallData )
+    {
+      aCoord = (vtkFloatingPointType*)theCallData;
+      self->myBusy = true;
+      self->myFocalX->setText( QString::number(aCoord[0]) );
+      self->myFocalY->setText( QString::number(aCoord[1]) );
+      self->myFocalZ->setText( QString::number(aCoord[2]) );
+      self->myBusy = false;
+      self->onFocalCoordChanged();
+    }
+    break;
+  case SVTK::FocalPointChanged:
+    if ( theCallData )
+    {
+      aCoord = (vtkFloatingPointType*)theCallData;
+      self->myBusy = true;
+      self->myFocalX->setText( QString::number(aCoord[0]) );
+      self->myFocalY->setText( QString::number(aCoord[1]) );
+      self->myFocalZ->setText( QString::number(aCoord[2]) );
+      self->myBusy = false;
+      self->onFocalCoordChanged();
+    }
+    break;
+  case vtkCommand::EndEvent:
+    if ( self->myRWInteractor->getRenderer()->GetActiveCamera()->GetMTime() > self->myCameraMTime )
+      self->updateData();
+    break;
+  }
+}
+
+void SVTK_ViewParameterDlg::updateData()
+{
+  myBusy = true;
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+
+  int aParallel = aCamera->GetParallelProjection();
+  myProjectionMode->button(aParallel?0:1)->setChecked(true);
+
+  double focal[3], pos[3], vup[3], proj[3], dist, scale, angle;
+
+  aCamera->GetFocalPoint(focal);
+  myFocalX->setText(QString::number(focal[0]));
+  myFocalY->setText(QString::number(focal[1]));
+  myFocalZ->setText(QString::number(focal[2]));
+
+  aCamera->GetPosition(pos);
+  myCameraX->setText(QString::number(pos[0]));
+  myCameraY->setText(QString::number(pos[1]));
+  myCameraZ->setText(QString::number(pos[2]));
+
+  aCamera->GetDirectionOfProjection(proj);
+  myProjDirX->setText(QString::number(proj[0]));
+  myProjDirY->setText(QString::number(proj[1]));
+  myProjDirZ->setText(QString::number(proj[2]));
+
+  aCamera->GetViewUp(vup);
+  myViewDirX->setText(QString::number(vup[0]));
+  myViewDirY->setText(QString::number(vup[1]));
+  myViewDirZ->setText(QString::number(vup[2]));
+
+  dist = aCamera->GetDistance();
+  myDistance->setText(QString::number(dist));
+
+  scale = aCamera->GetParallelScale();
+  myScale->setText(QString::number(scale));
+
+  angle = aCamera->GetViewAngle();
+  myViewAngle->setText(QString::number(angle));
+
+  myCameraMTime.Modified();
+  myBusy = false;
+}
+
+void SVTK_ViewParameterDlg::setEnabled(QFrame* theWidget, const bool theState)
+{
+  QObjectList aChildren(theWidget->children());
+  QObject* anObj;
+  for(int i = 0; i < aChildren.size(); i++)
+  {
+    anObj = aChildren.at(i);
+    if (anObj !=0 && anObj->inherits("QLineEdit"))
+      ((QLineEdit*)anObj)->setReadOnly(!theState);
+    if (anObj !=0 && anObj->inherits("QPushButton"))
+      ((QLineEdit*)anObj)->setEnabled(theState);
+  }
+  
+}
+
+void SVTK_ViewParameterDlg::onProjectionModeChanged(int mode)
+{
+  int aBtn = myProjectionMode->checkedId();
+
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+  aCamera->SetParallelProjection(aBtn == 0);
+  myRWInteractor->getRenderer()->Render();
+
+  myScaleBox->setVisible(aBtn == 0);
+  myViewAngleBox->setVisible(aBtn == 1);
+}
+
+void SVTK_ViewParameterDlg::onPositionModeChanged(int mode)
+{
+  setEnabled(myCameraCoords, myCameraPositionMode->checkedId() == 0);
+}
+
+void SVTK_ViewParameterDlg::onToBBCenter()
+{
+  if ( mySelectPoint->isChecked() )
+    mySelectPoint->toggle();
+
+  myMainWindow->activateSetFocalPointGravity();
+}
+
+void SVTK_ViewParameterDlg::onToOrigin()
+{
+  if ( mySelectPoint->isChecked() )
+    mySelectPoint->toggle();
+
+  myBusy = true;
+  myFocalX->setText(QString::number(0.0));
+  myFocalY->setText(QString::number(0.0));
+  myFocalZ->setText(QString::number(0.0));
+  myBusy = false;
+
+  onFocalCoordChanged();
+}
+
+void SVTK_ViewParameterDlg::onSelectPoint()
+{
+  if ( mySelectPoint->isChecked() )
+    myMainWindow->activateStartFocalPointSelection();
+  else
+    mySelectPoint->toggle();
+}
+
+void SVTK_ViewParameterDlg::onFocalCoordChanged()
+{
+  if ( myBusy ) return;
+
+  if ( mySelectPoint->isChecked() )
+    mySelectPoint->toggle();
+
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+  aCamera->SetFocalPoint(myFocalX->text().toDouble(),
+                        myFocalY->text().toDouble(),
+                        myFocalZ->text().toDouble());
+  myRWInteractor->getRenderer()->Render();
+
+  myMainWindow->activateSetFocalPointSelected();
+
+  //updateProjection();
+}
+
+void SVTK_ViewParameterDlg::onCameraCoordChanged()
+{
+  if ( myBusy ) return;
+
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+  aCamera->SetPosition(myCameraX->text().toDouble(),
+                      myCameraY->text().toDouble(),
+                      myCameraZ->text().toDouble());
+
+  //updateProjection();
+}
+
+void SVTK_ViewParameterDlg::onDirectionChanged()
+{
+  if ( myBusy ) return;
+
+  updateCoordinates();
+}
+
+void SVTK_ViewParameterDlg::onDistanceChanged()
+{
+  if ( myBusy ) return;
+
+  updateCoordinates();
+}
+
+void SVTK_ViewParameterDlg::onViewDirectionChanged()
+{
+  if ( myBusy ) return;
+
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+  aCamera->SetViewUp(myViewDirX->text().toDouble(),
+                    myViewDirY->text().toDouble(),
+                    myViewDirZ->text().toDouble());
+  myRWInteractor->getRenderer()->Render();
+}
+
+void SVTK_ViewParameterDlg::onZoomChanged()
+{
+  if ( myBusy ) return;
+
+  vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
+
+  switch( myProjectionMode->checkedId() ) {
+  case 0:
+    aCamera->SetParallelScale(myScale->text().toDouble());
+    break;
+  case 1:
+    aCamera->SetViewAngle(myViewAngle->text().toDouble());
+    break;
+  }
+  myRWInteractor->getRenderer()->Render();
+}
+
+void SVTK_ViewParameterDlg::onClickClose()
+{
+  reject();
+}
+
+void SVTK_ViewParameterDlg::updateProjection()
+{
+  double pnt[3], pos[3], dir[3], dist;
+
+  pnt[0] = myFocalX->text().toDouble();
+  pnt[1] = myFocalY->text().toDouble();
+  pnt[2] = myFocalZ->text().toDouble();
+
+  pos[0] = myCameraX->text().toDouble();
+  pos[1] = myCameraY->text().toDouble();
+  pos[2] = myCameraZ->text().toDouble();
+
+  dir[0] = pnt[0] - pos[0];
+  dir[1] = pnt[1] - pos[1];
+  dir[2] = pnt[2] - pos[2];
+
+  dist = sqrt( dir[0]*dir[0] + dir[1]*dir[1] + dir[2]*dir[2] );
+
+  if ( dist > 0.0002 ) {
+    dir[0] = dir[0] / dist;
+    dir[1] = dir[1] / dist;
+    dir[2] = dir[2] / dist;
+  }
+
+  myBusy = true;
+  myProjDirX->setText(QString::number(dir[0]));
+  myProjDirY->setText(QString::number(dir[1]));
+  myProjDirZ->setText(QString::number(dir[2]));
+
+  myDistance->setText(QString::number(dist));
+  myBusy = false;
+}
+
+void SVTK_ViewParameterDlg::updateCoordinates()
+{
+  double pnt[3], pos[3], dir[3], dist;
+
+  pnt[0] = myFocalX->text().toDouble();
+  pnt[1] = myFocalY->text().toDouble();
+  pnt[2] = myFocalZ->text().toDouble();
+
+  pos[0] = myCameraX->text().toDouble();
+  pos[1] = myCameraY->text().toDouble();
+  pos[2] = myCameraZ->text().toDouble();
+
+  dir[0] = myProjDirX->text().toDouble();
+  dir[1] = myProjDirY->text().toDouble();
+  dir[2] = myProjDirZ->text().toDouble();
+
+  dist = myDistance->text().toDouble();
+
+  if (myCameraPositionMode->checkedId() == 1) {
+    // recompute camera position
+    dir[0] = -dir[0]; dir[1] = -dir[1]; dir[2] = -dir[2];
+    if (computePoint(pnt, dir, dist, pos)) {
+      myBusy = true;
+      myCameraX->setText(QString::number(pos[0]));
+      myCameraY->setText(QString::number(pos[1]));
+      myCameraZ->setText(QString::number(pos[2]));
+      myBusy = false;
+      onCameraCoordChanged();
+    }
+  }
+  else {
+    // recompute focal point
+    if (computePoint(pos, dir, dist, pnt)) {
+      if (mySelectPoint->isChecked())
+       mySelectPoint->toggle();
+      myBusy = true;
+      myFocalX->setText(QString::number(pnt[0]));
+      myFocalY->setText(QString::number(pnt[1]));
+      myFocalZ->setText(QString::number(pnt[2]));
+      myBusy = false;
+      onFocalCoordChanged();
+    }
+  }
+}
+
+bool SVTK_ViewParameterDlg::computePoint(const double start[3], 
+                                        const double dir[3], 
+                                        const double dist, 
+                                        double result[3])
+{
+  double d = sqrt(dir[0]*dir[0]+dir[1]*dir[1]+dir[2]*dir[2]);
+  if ( d < 0.0002 ) return false;
+
+  for (int i = 0; i < 3; i++)
+    result[i] = start[i] + dir[i] * dist / d;
+
+  return true;
+}
diff --git a/src/SVTK/SVTK_ViewParameterDlg.h b/src/SVTK/SVTK_ViewParameterDlg.h
new file mode 100755 (executable)
index 0000000..c5722ec
--- /dev/null
@@ -0,0 +1,153 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header:
+
+#ifndef SVTK_VIEWPARAMETERDLG_H
+#define SVTK_VIEWPARAMETERDLG_H
+
+#include "SVTK.h"
+
+#include "SVTK_DialogBase.h"
+
+#include <vtkSmartPointer.h>
+#include <vtkTimeStamp.h>
+
+class SVTK_MainWindow;
+class SVTK_RenderWindowInteractor;
+
+class QtxAction;
+
+class QLineEdit;
+class QPushButton;
+class QFrame;
+class QCheckBox;
+class QButtonGroup;
+
+class vtkCallbackCommand;
+class vtkObject;
+
+class SVTK_EXPORT SVTK_ViewParameterDlg : public SVTK_DialogBase
+{
+  Q_OBJECT;
+
+public:
+  SVTK_ViewParameterDlg(QtxAction* theAction,
+                       SVTK_MainWindow* theParent,
+                       const char* theName);
+
+  ~SVTK_ViewParameterDlg();
+  
+  void addObserver();
+  
+protected:
+  SVTK_MainWindow *myMainWindow;
+  SVTK_RenderWindowInteractor* myRWInteractor;
+  bool myIsObserverAdded;
+  bool myBusy;
+  
+  QButtonGroup* myProjectionMode;
+
+  QPushButton*  myToBBCenter;
+  QPushButton*  myToOrigin;
+  QPushButton*  mySelectPoint;
+
+  QFrame*       myFocalCoords;
+  QLineEdit*    myFocalX;
+  QLineEdit*    myFocalY;
+  QLineEdit*    myFocalZ;
+  
+  QButtonGroup* myCameraPositionMode;
+
+  QFrame*       myCameraCoords;
+  QLineEdit*    myCameraX;
+  QLineEdit*    myCameraY;
+  QLineEdit*    myCameraZ;
+
+  QFrame*       myProjDirection;
+  QLineEdit*    myProjDirX;
+  QLineEdit*    myProjDirY;
+  QLineEdit*    myProjDirZ;
+
+  QLineEdit*    myDistance;
+
+  QFrame*       myViewDirection;
+  QLineEdit*    myViewDirX;
+  QLineEdit*    myViewDirY;
+  QLineEdit*    myViewDirZ;
+
+  QFrame*       myScaleBox;
+  QLineEdit*    myScale;
+
+  QFrame*       myViewAngleBox;
+  QLineEdit*    myViewAngle;
+
+  void setEnabled(QFrame* theWidget, const bool theState);
+  bool computePoint(const double start[3], const double dir[3], 
+                   const double dist, double result[3]);
+  void updateProjection();
+  void updateCoordinates();
+
+  void updateData();
+
+  //----------------------------------------------------------------------------
+  // Priority at which events are processed
+  vtkFloatingPointType myPriority;
+
+  // Used to process events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Used to update camera
+  vtkTimeStamp myCameraMTime;
+
+  // Description:
+  // Main process event method
+  static void ProcessEvents(vtkObject* object, 
+                            unsigned long event,
+                            void* clientdata, 
+                            void* calldata);
+
+protected slots:
+  void onProjectionModeChanged(int);
+  void onPositionModeChanged(int);
+  
+  void onToBBCenter();
+  void onToOrigin();
+  void onSelectPoint();
+
+  void onFocalCoordChanged();
+  void onCameraCoordChanged();
+  void onDirectionChanged();
+  void onDistanceChanged();
+  void onViewDirectionChanged();
+
+  void onZoomChanged();
+
+  void onClickClose();
+
+};
+
+#endif // SVTK_VIEWPARAMETERDLG_H
index 060908a75f144b90f4f8816f40bdab651e652c67..62c3d318ab8df26c24bb5c653a4bb79ea5b7d1e2 100644 (file)
         <source>ICON_SVTK_UPDATE_RATE</source>
         <translation>vtk_view_update_rate.png</translation>
     </message>
+    <message>
+        <source>ICON_SVTK_VIEW_PARAMETERS</source>
+        <translation>vtk_view_parameters.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_VIEW_PARALLEL</source>
+        <translation>vtk_view_parallel.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_VIEW_PERSPECTIVE</source>
+        <translation>vtk_view_perspective.png</translation>
+    </message>
 </context>
 </TS>
index dad1d0226b45caa75c31f3edfe7323db438b278a..58b41d087721571e0a2043e478288b8d3864e01d 100644 (file)
         <source>SVTK_IMAGE_FILES</source>
         <translation>Images Files (*.bmp *.png *.jpg *.jpeg *.pdf *.ps *.eps)</translation>
     </message>
+    <message>
+        <source>MNU_VIEWPARAMETERS_VIEW</source>
+        <translation>Change View Parameters</translation>
+    </message>
+    <message>
+        <source>DSC_VIEWPARAMETERS_VIEW</source>
+        <translation>Change the parameters of the view</translation>
+    </message>
 </context>
 <context>
     <name>SVTK_AxisWidget</name>
         <translation>Set Rotation Point</translation>
     </message>
 </context>
+<context>
+    <name>SVTK_ViewParameterDlg</name>
+    <message>
+        <source>LBL_X</source>
+        <translation>X :</translation>
+    </message>
+    <message>
+        <source>LBL_Y</source>
+        <translation>Y :</translation>
+    </message>
+    <message>
+        <source>LBL_Z</source>
+        <translation>Z :</translation>
+    </message>
+    <message>
+        <source>LBL_DX</source>
+        <translation>DX :</translation>
+    </message>
+    <message>
+        <source>LBL_DY</source>
+        <translation>DY :</translation>
+    </message>
+    <message>
+        <source>LBL_DZ</source>
+        <translation>DZ :</translation>
+    </message>
+    <message>
+        <source>PROJECTION_MODE</source>
+        <translation>Projection Mode</translation>
+    </message>
+    <message>
+        <source>ORTHOGONAL_MODE</source>
+        <translation>Orthogonal</translation>
+    </message>
+    <message>
+        <source>PERSPECTIVE_MODE</source>
+        <translation>Perspective</translation>
+    </message>
+    <message>
+        <source>USE_BBCENTER</source>
+        <translation>Use Bounding Box Center</translation>
+    </message>
+    <message>
+        <source>LBL_TOBBCENTER</source>
+        <translation>Set to Bounding Box Center</translation>
+    </message>
+      <message>
+        <source>LBL_TOORIGIN</source>
+        <translation>Set to Origin</translation>
+    </message>
+  <message>
+        <source>LBL_SELECTPOINT</source>
+        <translation>Select Point from View</translation>
+    </message>
+    <message>
+        <source>FOCAL_POINT</source>
+        <translation>Focal Point</translation>
+    </message>
+    <message>
+        <source>CAMERA_POSITION</source>
+        <translation>Camera Position</translation>
+    </message>
+    <message>
+        <source>WORLD_COORDINATES</source>
+        <translation>World Coordinates</translation>
+    </message>
+    <message>
+        <source>FOCAL_RELATIVE</source>
+        <translation>Relative to Focal Point</translation>
+    </message>
+    <message>
+        <source>PROJECTION_DIRECTION</source>
+        <translation>Projection Direction :</translation>
+    </message>
+    <message>
+        <source>FOCAL_DISTANCE</source>
+        <translation>Focal Distance :</translation>
+    </message>
+    <message>
+        <source>VIEW_UP_DIRECTION</source>
+        <translation>View Up Direction :</translation>
+    </message>
+    <message>
+        <source>ZOOMING</source>
+        <translation>Zooming</translation>
+    </message>
+    <message>
+        <source>LBL_SCALE</source>
+        <translation>Scale</translation>
+    </message>
+    <message>
+        <source>LBL_VIEW_ANGLE</source>
+        <translation>View Angle</translation>
+    </message>
+    <message>
+        <source>DLG_TITLE</source>
+        <translation>View Parameters</translation>
+    </message>
+</context>
 <context>
     <name>SVTK_UpdateRateDlg</name>
     <message>
diff --git a/src/SVTK/resources/vtk_view_parallel.png b/src/SVTK/resources/vtk_view_parallel.png
new file mode 100755 (executable)
index 0000000..dd7a676
Binary files /dev/null and b/src/SVTK/resources/vtk_view_parallel.png differ
diff --git a/src/SVTK/resources/vtk_view_parameters.png b/src/SVTK/resources/vtk_view_parameters.png
new file mode 100755 (executable)
index 0000000..0eee8cc
Binary files /dev/null and b/src/SVTK/resources/vtk_view_parameters.png differ
diff --git a/src/SVTK/resources/vtk_view_perspective.png b/src/SVTK/resources/vtk_view_perspective.png
new file mode 100755 (executable)
index 0000000..36cdd4c
Binary files /dev/null and b/src/SVTK/resources/vtk_view_perspective.png differ