Salome HOME
Updated copyright comment
[modules/gui.git] / src / SVTK / SVTK_InteractorStyle.cxx
index 1f662ca7b49c96f8c3a96011dfbb931b31968f3a..1701d907e825839b032da7150a0318bfe4c9ca64 100644 (file)
@@ -1,34 +1,32 @@
-//  SALOME VTKViewer : build VTK viewer into Salome desktop
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
-//  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
+// Copyright (C) 2003-2007  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, or (at your option) any later version.
+//
+// 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
 //
+
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
 //  File   : 
 //  Author : 
-//  Module : SALOME
-//  $Header$
-
 
 #include "SVTK_InteractorStyle.h"
 
+#include "VTKViewer_Algorithm.h"
 #include "VTKViewer_Utilities.h"
 #include "SVTK_GenericRenderWindowInteractor.h"
 
@@ -41,6 +39,7 @@
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
 
+#include "SUIT_Tools.h"
 #include "SALOME_Actor.h"
 
 #include <vtkObjectFactory.h>
@@ -49,6 +48,7 @@
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkPointPicker.h>
+#include <vtkCellPicker.h>
 #include <vtkRenderWindow.h>
 #include <vtkRenderWindowInteractor.h>
 #include <vtkCallbackCommand.h>
 #include <vtkPerspectiveTransform.h> 
 #include <vtkMatrix4x4.h>
 
-#include <qapplication.h>
-#include <qpixmap.h>
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qpainter.h>
-#endif
-//VRV: porting on Qt 3.0.5
-#include <algorithm>
+#include <QtxRubberBand.h>
 
-#include <iostream>
+#include <QPixmap>
+#include <QWidget>
+#include <QPolygon>
 
-using namespace std;
+#include <algorithm>
+#include <iostream>
 
 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;
@@ -84,21 +78,25 @@ namespace
 }
 
 
-vtkStandardNewMacro(SVTK_InteractorStyle);
+vtkStandardNewMacro(SVTK_InteractorStyle)
 
 
 /*!
   Constructor
 */
-SVTK_InteractorStyle
-::SVTK_InteractorStyle():
-  mySelectionEvent(new SVTK_SelectionEvent()),
-  myPointPicker(vtkPointPicker::New()),
+SVTK_InteractorStyle::SVTK_InteractorStyle():
   myLastHighlitedActor(NULL),
   myLastPreHighlitedActor(NULL),
   myControllerIncrement(SVTK_ControllerIncrement::New()),
   myControllerOnKeyDown(SVTK_ControllerOnKeyDown::New()),
-  myHighlightRotationPointActor(SVTK_Actor::New())
+  mySelectionEvent(new SVTK_SelectionEvent()),
+  myHighlightSelectionPointActor(SVTK_Actor::New()),
+  myPointPicker(vtkPointPicker::New()),
+  myRectBand(0),
+  myPolygonBand(0),
+  myPoligonState(Disable),
+  myIsAdvancedZoomingEnabled(false),
+  myInteractivePoint{0.0, 0.0, 0.0}
 {
   myPointPicker->Delete();
 
@@ -125,14 +123,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;
 }
@@ -140,17 +141,16 @@ SVTK_InteractorStyle
 /*!
   Destructor
 */
-SVTK_InteractorStyle
-::~SVTK_InteractorStyle() 
+SVTK_InteractorStyle::~SVTK_InteractorStyle() 
 {
+  endDrawRect();
+  endDrawPolygon();
 }
 
 /*!
   \return widget for rendering
 */
-QWidget*
-SVTK_InteractorStyle
-::GetRenderWidget()
+QWidget* SVTK_InteractorStyle::GetRenderWidget()
 {
   return myInteractor->GetRenderWidget();
 }
@@ -158,19 +158,24 @@ SVTK_InteractorStyle
 /*!
   \return selector
 */
-SVTK_Selector*
-SVTK_InteractorStyle
-::GetSelector() 
+SVTK_Selector* SVTK_InteractorStyle::GetSelector() 
 {
   return myInteractor->GetSelector();
 }
 
+/*!
+  Realeaze actors
+*/
+void SVTK_InteractorStyle::FreeActors()
+{
+  myLastHighlitedActor = NULL;
+  myLastPreHighlitedActor = NULL;
+}
+
 /*!
   Generate special SVTK_SelectionEvent
 */
-SVTK_SelectionEvent*
-SVTK_InteractorStyle
-::GetSelectionEvent()
+SVTK_SelectionEvent* SVTK_InteractorStyle::GetSelectionEvent()
 {
   mySelectionEvent->mySelectionMode = GetSelector()->SelectionMode();
 
@@ -188,9 +193,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();
 
@@ -205,9 +208,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;
@@ -239,7 +240,7 @@ SVTK_InteractorStyle
 
   if ( myCurrRotationPointType == SVTK::SetRotateGravity )
   {
-    vtkFloatingPointType aCenter[3];
+    double aCenter[3];
     if ( ComputeBBCenter(GetCurrentRenderer(),aCenter) ) 
     {
       myRotationPointX = aCenter[0];
@@ -266,8 +267,8 @@ SVTK_InteractorStyle
   double ryf = double(dy) * aDeltaElevation * this->MotionFactor;
   vtkMatrix4x4* aMatrix = cam->GetViewTransformMatrix();
   const double anAxis[3] = {-aMatrix->GetElement(0,0), // mkr : 27.11.2006 : PAL14011 - Strange behaviour in rotation in VTK Viewer.
-                           -aMatrix->GetElement(0,1), 
-                           -aMatrix->GetElement(0,2)};
+                            -aMatrix->GetElement(0,1), 
+                            -aMatrix->GetElement(0,2)};
   
   aTransform->RotateWXYZ(ryf, anAxis);
             
@@ -276,26 +277,24 @@ SVTK_InteractorStyle
   // To apply the transformation
   cam->SetPosition(aTransform->TransformPoint(viewPos));
   cam->SetFocalPoint(aTransform->TransformPoint(viewFP));
+  aTransform->Delete();
 
   cam->OrthogonalizeViewUp();
 
   GetCurrentRenderer()->ResetCameraClippingRange(); 
 
   this->Render();
+  this->InvokeEvent(SVTK::OperationFinished,NULL);
 }
 
-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();
+  this->InvokeEvent(SVTK::OperationFinished,NULL);
 }
 
-
-void 
-SVTK_InteractorStyle
-::DollyXY(int dx, int dy)
+void SVTK_InteractorStyle::DollyXY(int dx, int dy)
 {
   if (GetCurrentRenderer() == NULL) 
     return;
@@ -306,19 +305,32 @@ SVTK_InteractorStyle
   double zoomFactor = pow((double)1.1, dxf + dyf);
   
   vtkCamera *aCam = GetCurrentRenderer()->GetActiveCamera();
-  if (aCam->GetParallelProjection())
+  if (aCam->GetParallelProjection()) {
+    int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
+    if( IsAdvancedZoomingEnabled() ) { // zoom relatively to the cursor
+      int* aSize = GetCurrentRenderer()->GetRenderWindow()->GetSize();
+      int w = aSize[0];
+      int h = aSize[1];
+      x0 = w / 2;
+      y0 = h / 2;
+      x1 = myOtherPoint.x();
+      y1 = h - myOtherPoint.y();
+      TranslateView( x0, y0, x1, y1 );
+    }
     aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+    if( IsAdvancedZoomingEnabled() )
+      TranslateView( x1, y1, x0, y0 );
+  }
   else{
-    aCam->Dolly(zoomFactor);
+    aCam->Dolly(zoomFactor); // Move camera in/out along projection direction
     GetCurrentRenderer()->ResetCameraClippingRange(); 
   }
 
   this->Render();
+  this->InvokeEvent(SVTK::OperationFinished,NULL);
 }
 
-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;
 
@@ -326,9 +338,9 @@ SVTK_InteractorStyle
     return;
 
   double newAngle = atan2((double)(y - GetCurrentRenderer()->GetCenter()[1]),
-                         (double)(x - GetCurrentRenderer()->GetCenter()[0]));
+                          (double)(x - GetCurrentRenderer()->GetCenter()[0]));
   double oldAngle = atan2((double)(oldY -GetCurrentRenderer()->GetCenter()[1]),
-                         (double)(oldX - GetCurrentRenderer()->GetCenter()[0]));
+                          (double)(oldX - GetCurrentRenderer()->GetCenter()[0]));
   
   newAngle *= this->RadianToDegree;
   oldAngle *= this->RadianToDegree;
@@ -338,15 +350,14 @@ SVTK_InteractorStyle
   cam->OrthogonalizeViewUp();
       
   this->Render();
+  this->InvokeEvent(SVTK::OperationFinished,NULL);
 }
 
 
 /*!
   To reset reset view
 */
-void
-SVTK_InteractorStyle
-::OnConfigure() 
+void SVTK_InteractorStyle::OnConfigure() 
 {
   this->FindPokedRenderer(0,0);
   this->GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
@@ -355,110 +366,131 @@ SVTK_InteractorStyle
 /*!
   To handle mouse move event
 */
-void
-SVTK_InteractorStyle
-::OnMouseMove() 
+void SVTK_InteractorStyle::OnMouseMove() 
 {
   int x, y;
   GetEventPosition( this->Interactor, x, y );
   this->OnMouseMove( this->Interactor->GetControlKey(),
-                    this->Interactor->GetShiftKey(),
-                    x, y );
+                     this->Interactor->GetShiftKey(),
+                     x, y );
 }
 
 /*!
   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 );
   this->OnLeftButtonDown( this->Interactor->GetControlKey(),
-                         this->Interactor->GetShiftKey(),
-                         x, y );
+                          this->Interactor->GetShiftKey(),
+                          x, y );
 }
 
 /*!
   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 );
   this->OnLeftButtonUp( this->Interactor->GetControlKey(),
-                       this->Interactor->GetShiftKey(),
-                       x, y );
+                        this->Interactor->GetShiftKey(),
+                        x, y );
 }
 
 /*!
   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 );
   this->OnMiddleButtonDown( this->Interactor->GetControlKey(),
-                           this->Interactor->GetShiftKey(),
-                           x, y );
+                            this->Interactor->GetShiftKey(),
+                            x, y );
 }
 
 /*!
   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 );
   this->OnMiddleButtonUp( this->Interactor->GetControlKey(),
-                         this->Interactor->GetShiftKey(),
-                         x, y );
+                          this->Interactor->GetShiftKey(),
+                          x, y );
 }
 
 /*!
   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 );
   this->OnRightButtonDown( this->Interactor->GetControlKey(),
-                          this->Interactor->GetShiftKey(),
-                          x, y );
+                           this->Interactor->GetShiftKey(),
+                           x, y );
 }
 
 /*!
   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 );
   this->OnRightButtonUp( this->Interactor->GetControlKey(),
-                        this->Interactor->GetShiftKey(),
-                        x, y );
+                         this->Interactor->GetShiftKey(),
+                         x, y );
 }
 
 /*!
-  To handle mouse move event
+  To handle mouse wheel forward event (reimplemented from #vtkInteractorStyle)
 */
-void
-SVTK_InteractorStyle
-::OnMouseMove(int vtkNotUsed(ctrl), 
-             int shift,
-             int x, int y) 
+void SVTK_InteractorStyle::OnMouseWheelForward()
 {
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  myOtherPoint = QPoint(x, y);
+}
+
+/*!
+  To handle mouse wheel backward event (reimplemented from #vtkInteractorStyle)
+*/
+void SVTK_InteractorStyle::OnMouseWheelBackward()
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  myOtherPoint = QPoint(x, y);
+}
+
+/*!
+  To handle mouse double click event
+*/
+void SVTK_InteractorStyle::OnMouseButtonDoubleClick()
+{
+  if( myPoligonState == InProcess ) {
+    onFinishOperation();
+    myPoligonState = Finished;
+  }
+}
+
+/*!
+  To handle mouse move event
+*/
+void SVTK_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl), 
+                                       int shift,
+                                       int x, int y) 
+{
+  if ( myPoligonState == Start ) {
+    // if right button was pressed and mouse is moved
+    // we can to draw a polygon for polygonal selection
+    myPoligonState = InProcess;
+    startOperation( VTK_INTERACTOR_STYLE_CAMERA_SELECT );
+  }
   myShiftState = shift;
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
     onOperation(QPoint(x, y));
@@ -469,15 +501,16 @@ 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)
     return;
 
+  if ( myPoligonState != Disable )
+    return;
+
   myShiftState = shift;
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
@@ -490,46 +523,109 @@ 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();
 
-      SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
+      bool isPicked = false;
+      vtkActorCollection* anActorCollection = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
       
-      if ( anActor )
+      if( anActorCollection )
       {
-       myPointPicker->Pick( aSelectionEvent->myX,
-                            aSelectionEvent->myY, 
-                            0.0, 
-                            GetCurrentRenderer() );
-       int aVtkId = myPointPicker->GetPointId();
-       if ( aVtkId >= 0 )
-       {
-         int anObjId = anActor->GetNodeObjId( aVtkId );
-         vtkFloatingPointType* aCoords = anActor->GetNodeCoord(anObjId);
-         
-         myCurrRotationPointType = SVTK::SetRotateSelected;
-         
-         // invoke event for update coordinates in SVTK_SetRotationPointDlg
-         InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
-       }
-       else
-       {
-         // invoke event with no data (for SVTK_SetRotationPointDlg)
-         InvokeEvent(SVTK::RotationPointChanged,0);
-         myCurrRotationPointType = myPrevRotationPointType;
-       }
+        anActorCollection->InitTraversal();
+        while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
+        {
+          if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aVTKActor ) )
+          {
+               Selection_Mode aSelectionMode = GetSelector()->SelectionMode();
+               double* aCoords = NULL;
+               vtkIdType aVtkId;
+               bool isTrueType = false;
+               
+               if( myCurrFocalPointType == SVTK::StartFocalPointSelection ||
+                       ( myCurrRotationPointType == SVTK::StartPointSelection && aSelectionMode == NodeSelection ) )
+               {
+              SVTK::TPickLimiter aPickLimiter( myPointPicker, anActor );
+              myPointPicker->Pick( aSelectionEvent->myX,
+                                   aSelectionEvent->myY,
+                                   0.0,
+                                   GetCurrentRenderer() );
+              aVtkId = myPointPicker->GetPointId();
+              if ( aVtkId >= 0 )
+              {
+                vtkIdType anObjId = anActor->GetNodeObjId( aVtkId );
+                aCoords = anActor->GetNodeCoord(anObjId);
+                isTrueType = true;
+              }
+               }
+
+               if( aSelectionMode == EdgeSelection || aSelectionMode == FaceSelection ||  aSelectionMode == VolumeSelection )
+               {
+              vtkSmartPointer<vtkCellPicker> aCellPicker = vtkCellPicker::New();
+              aCellPicker->SetTolerance( 0.005 );
+              SVTK::TPickLimiter aPickLimiter( aCellPicker, anActor );
+              aCellPicker->Pick( aSelectionEvent->myX,
+                                 aSelectionEvent->myY,
+                                 0.0,
+                                 GetCurrentRenderer() );
+              aVtkId = aCellPicker->GetCellId();
+              vtkIdType aCellId = anActor->GetElemObjId( aVtkId );
+
+              if( aSelectionMode == EdgeSelection )
+               isTrueType = anActor->GetObjDimension( aCellId ) == 1;
+              else if( aSelectionMode == FaceSelection )
+               isTrueType = anActor->GetObjDimension( aCellId ) == 2;
+              else if( aSelectionMode == VolumeSelection )
+               isTrueType = anActor->GetObjDimension( aCellId ) == 3;
+
+              if ( aVtkId >= 0 && isTrueType )
+                aCoords = anActor->GetGravityCenter( aCellId );
+               }
+
+               if( aVtkId >= 0 )
+               {
+              if (myCurrRotationPointType == SVTK::StartPointSelection) {
+                myCurrRotationPointType = SVTK::SetRotateSelected;
+                // invoke event for update coordinates in SVTK_SetRotationPointDlg
+                if( isTrueType )
+                  InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
+                else
+                  InvokeEvent(SVTK::RotationPointChanged);
+                GetSelector()->SetSelectionMode(ActorSelection);
+              }
+              else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+                myCurrFocalPointType = SVTK::SetFocalPointSelected;
+                
+                // invoke event for update coordinates in SVTK_ViewParameterDlg
+                InvokeEvent(SVTK::FocalPointChanged,(void*)aCoords);
+              }
+
+              isPicked = true;
+              break;
+            }
+          }
+        }
       }
-      else
+
+      if( !isPicked )
       {
-       // 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;
+          GetSelector()->SetSelectionMode(ActorSelection);
+        }
+        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); 
     }
@@ -543,34 +639,50 @@ 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 x,
+                                          int y)
 {
   myShiftState = shift;
+  if( myPoligonState == InProcess ) { // add a new point of polygon
+    myPolygonPoints.append( QPoint( x, y ) );
+    this->Interactor->GetEventPosition( mySelectionEvent->myX, mySelectionEvent->myY );
+    mySelectionEvent->myPolygonPoints.append( QPoint( mySelectionEvent->myX, mySelectionEvent->myY ) );
+    return;
+  }
+  else if ( myPoligonState == Closed ) { // close polygon and apply a selection
+    onFinishOperation();
+    myPoligonState = Finished;
+    return;
+  }
+  else if( myPoligonState == Finished || myPoligonState == NotValid )
+    return;
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
     onFinishOperation();
+    int lastOperation = State;
     startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+    if (lastOperation == VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION) {
+      InvokeEvent(SVTK::InteractiveSelectionFinished, nullptr);
+    }
   }
 }
 
 /*!
   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)
     return;
 
+  if ( myPoligonState != Disable )
+    return;
+
   myShiftState = shift;
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
@@ -578,7 +690,8 @@ SVTK_InteractorStyle
     startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
   }
   myOtherPoint = myPoint = QPoint(x, y);
-  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE &&
+      ForcedState != VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION) {
     startOperation(ForcedState);
   }
   else {
@@ -591,13 +704,18 @@ 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))
+{
+  if( myPoligonState == InProcess ) { // delete a point of polygon
+    if ( myPolygonPoints.size() > 2 ) {
+      myPolygonPoints.remove( myPolygonPoints.size() - 1 );
+      mySelectionEvent->myPolygonPoints.remove( mySelectionEvent->myPolygonPoints.size() - 1 );
+    }
+    return;
+  }
   myShiftState = shift;
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
@@ -610,24 +728,29 @@ 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)
     return;
 
   myShiftState = shift;
+
+  if ( !ctrl ) {
+    myPoligonState = Start;
+    this->Interactor->GetEventPosition(mySelectionEvent->myX, mySelectionEvent->myY);
+    mySelectionEvent->myPolygonPoints.append( QPoint( mySelectionEvent->myX, mySelectionEvent->myY) );
+  }
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
     onFinishOperation();
     startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
   }
   myOtherPoint = myPoint = QPoint(x, y);
-  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE && 
+      ForcedState != VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION) {
     startOperation(ForcedState);
   }
   else {
@@ -639,13 +762,23 @@ 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))
+{
+  if( myPoligonState == Start ) { // if right button was pressed but mouse is not moved
+    myPoligonState = Disable;
+    mySelectionEvent->myPolygonPoints.clear();
+  }
+
+  if( myPoligonState != Disable ) {
+    endDrawPolygon();
+    myPoligonState = Finished;
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+    return;
+  }
+
   myShiftState = shift;
   // finishing current viewer operation
   if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
@@ -735,9 +868,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);
@@ -753,9 +884,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)
   {
@@ -770,9 +899,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)
   {
@@ -786,9 +913,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)
   {
@@ -799,22 +924,53 @@ SVTK_InteractorStyle
   ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ROTATE;
 }
 
+/*!
+  Starts Interactive Selection operation
+*/
+void SVTK_InteractorStyle::startInteractiveSelection()
+{
+       if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+       {
+               onFinishOperation();
+               startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+       }
+       ForcedState = VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION;
+}
+
+
 /*!
   Set rotation point selected by user
 */
-void 
-SVTK_InteractorStyle
-::startPointSelection()
+void SVTK_InteractorStyle::startPointSelection()
 {
   myCurrRotationPointType = SVTK::StartPointSelection;
 
   if(GetCurrentRenderer() != NULL) {
-    GetCurrentRenderer()->AddActor( myHighlightRotationPointActor.GetPointer() );
-    vtkFloatingPointType aColor[3];
+    GetCurrentRenderer()->AddActor( myHighlightSelectionPointActor.GetPointer() );
+    double aColor[3];
+    GetCurrentRenderer()->GetBackground( aColor );
+    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() );
+    double 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);
@@ -823,9 +979,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)
   {
@@ -841,9 +995,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)
   {
@@ -858,9 +1010,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)
   {
@@ -882,12 +1032,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;
@@ -920,9 +1068,7 @@ SVTK_InteractorStyle
 /*!
   Starts viewer operation (!internal usage!)
 */
-void
-SVTK_InteractorStyle
-::startOperation(int operation)
+void SVTK_InteractorStyle::startOperation(int operation)
 {
   switch(operation)
   { 
@@ -933,6 +1079,7 @@ SVTK_InteractorStyle
   case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
   case VTK_INTERACTOR_STYLE_CAMERA_FIT:
   case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+  case VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION:
     if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
       startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
     State = operation;
@@ -952,9 +1099,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)
@@ -986,10 +1131,11 @@ SVTK_InteractorStyle
       break;
     case VTK_INTERACTOR_STYLE_CAMERA_NONE:
     default:
-      if ( myCurrRotationPointType == SVTK::StartPointSelection )
-       GetRenderWidget()->setCursor(myHandCursor);
+      if ( myCurrRotationPointType == SVTK::StartPointSelection ||
+           myCurrFocalPointType == SVTK::StartFocalPointSelection )
+        GetRenderWidget()->setCursor(myHandCursor);
       else
-       GetRenderWidget()->setCursor(myDefCursor); 
+        GetRenderWidget()->setCursor(myDefCursor); 
       myCursorState = false;
       break;
   }
@@ -999,9 +1145,7 @@ SVTK_InteractorStyle
 /*!
   Called when viewer operation started (!put necessary initialization here!)
 */
-void
-SVTK_InteractorStyle
-::onStartOperation()
+void SVTK_InteractorStyle::onStartOperation()
 {
   if (!GetRenderWidget()) 
     return;
@@ -1014,10 +1158,15 @@ SVTK_InteractorStyle
     case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
     case VTK_INTERACTOR_STYLE_CAMERA_FIT:
     {
-      QPainter p(GetRenderWidget());
-      p.setPen(Qt::lightGray);
-      p.setRasterOp(Qt::XorROP);
-      p.drawRect(QRect(myPoint, myOtherPoint));
+      if ( myPoligonState == InProcess )
+        drawPolygon();
+      else
+        drawRect();
+      break;
+    }
+    case VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION:
+    {
+      InteractiveSelection();
       break;
     }
     case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
@@ -1033,9 +1182,7 @@ SVTK_InteractorStyle
 /*!
   Called when viewer operation finished (!put necessary post-processing here!)
 */
-void
-SVTK_InteractorStyle
-::onFinishOperation() 
+void SVTK_InteractorStyle::onFinishOperation() 
 {
   if (!GetRenderWidget()) 
     return;
@@ -1050,12 +1197,9 @@ SVTK_InteractorStyle
     case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
     case VTK_INTERACTOR_STYLE_CAMERA_FIT:
     {
-      QPainter aPainter(GetRenderWidget());
-      aPainter.setPen(Qt::lightGray);
-      aPainter.setRasterOp(Qt::XorROP);
+      endDrawRect();
       QRect aRect(myPoint, myOtherPoint);
-      aPainter.drawRect(aRect);
-      aRect = aRect.normalize();
+      aRect = aRect.normalized();
 
       if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
         // making fit rect opeation 
@@ -1069,64 +1213,91 @@ SVTK_InteractorStyle
       }
       else {
         if (myPoint == myOtherPoint)
-         {
-           // process point selection
-           this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
-           Interactor->StartPickCallback();
-           
-           SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
-           
-           aSelectionEvent->myIsRectangle = false;
-
-           if(!myShiftState)
-             GetSelector()->ClearIObjects();
-
-           if(anActor)
-             {
-               anActor->Highlight( this, aSelectionEvent, true );
-             }
-           else
-             {
-               if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != anActor)
-                 myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
-               myLastHighlitedActor = anActor;
-             }
-         } 
-       else 
-         {
-           //processing rectangle selection
-           Interactor->StartPickCallback();
-           GetSelector()->StartPickCallback();
-           aSelectionEvent->myIsRectangle = true;
-
-           if(!myShiftState)
-             GetSelector()->ClearIObjects();
-
-           vtkActorCollection* aListActors = GetCurrentRenderer()->GetActors();
-           aListActors->InitTraversal();
-           while(vtkActor* aActor = aListActors->GetNextActor())
-             {
-               if(aActor->GetVisibility())
-                 {
-                   if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor))
-                     {
-                       if(aSActor->hasIO())
-                         aSActor->Highlight( this, aSelectionEvent, true );
-                     }
-                 }
-             }
-         }
-       Interactor->EndPickCallback();
-       GetSelector()->EndPickCallback();
+        {
+          // process point selection
+          this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
+          Interactor->StartPickCallback();
+            
+          SALOME_Actor* aHighlightedActor = NULL;
+          vtkActorCollection* anActorCollection = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
+
+          aSelectionEvent->myIsRectangle = false;
+          aSelectionEvent->myIsPolygon = false;
+          if(!myShiftState)
+            GetSelector()->ClearIObjects();
+
+          if( anActorCollection )
+          {
+           if( !myShiftState && 
+               anActorCollection->GetNumberOfItems () > 1 && 
+               myLastHighlitedActor.GetPointer() ) {
+             anActorCollection->RemoveItem ( myLastHighlitedActor.GetPointer() );
+           }
+            anActorCollection->InitTraversal();
+            while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
+            {
+              if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aVTKActor ) )
+              {
+                if( anActor->Highlight( this, aSelectionEvent, true ) )
+                {
+                  aHighlightedActor = anActor;
+                  break;
+                }
+              }
+            }
+          }
+
+          if( !aHighlightedActor )
+          {
+            if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != aHighlightedActor)
+              myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
+          }
+          myLastHighlitedActor = aHighlightedActor;
+        }
+        else
+        {
+          if ( myPoligonState == InProcess || myPoligonState == Closed )
+            aSelectionEvent->myIsPolygon = true;
+          else
+            aSelectionEvent->myIsRectangle = true;
+
+          //processing polygonal selection
+          Interactor->StartPickCallback();
+          GetSelector()->StartPickCallback();
+
+          if(!myShiftState)
+            GetSelector()->ClearIObjects();
+
+          VTK::ActorCollectionCopy aCopy(GetCurrentRenderer()->GetActors());
+          vtkActorCollection* aListActors = aCopy.GetActors();
+          aListActors->InitTraversal();
+          while(vtkActor* aActor = aListActors->GetNextActor())
+          {
+            if(aActor->GetVisibility())
+            {
+              if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor))
+              {
+                if(aSActor->hasIO())
+                  aSActor->Highlight( this, aSelectionEvent, true );
+              }
+            }
+          }
+        }
+        aSelectionEvent->myIsRectangle = false;
+        aSelectionEvent->myIsPolygon = false;
+        aSelectionEvent->myPolygonPoints.clear();
+        endDrawPolygon();
+        Interactor->EndPickCallback();
+        GetSelector()->EndPickCallback();
       } 
-    } 
-    break;
-  case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
-  case VTK_INTERACTOR_STYLE_CAMERA_PAN:
-  case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
-  case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
-    break;
-  case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: 
+      break;
+    }
+    case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+    case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+    case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+    case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
     {
       int w, h, x, y;
       Interactor->GetSize(w, h);
@@ -1144,9 +1315,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;
@@ -1184,17 +1353,18 @@ SVTK_InteractorStyle
     {
       if (!myCursorState)
         setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
-    }
+    } // fall through!
   case VTK_INTERACTOR_STYLE_CAMERA_FIT:
     {
-      QPainter p(GetRenderWidget());
-      p.setPen(Qt::lightGray);
-      p.setRasterOp(Qt::XorROP);
-      p.drawRect(QRect(myPoint, myOtherPoint));
       myOtherPoint = mousePos;
-      p.drawRect(QRect(myPoint, myOtherPoint));
+      if ( myPoligonState == InProcess || myPoligonState == Closed || myPoligonState == NotValid )
+        drawPolygon();
+      else if ( myPoligonState != Finished )
+        drawRect();
       break;
     }
+  case VTK_INTERACTOR_STYLE_CAMERA_INTERACTIVE_SELECTION:
+         this->InteractiveSelection();
   }
 }
 
@@ -1202,49 +1372,73 @@ 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*/) 
 {
+  if ( !GetSelector()->IsPreSelectionEnabled() ) 
+    return;
+
   // processing highlighting
-   SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
+  SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
   this->FindPokedRenderer(aSelectionEvent->myX,aSelectionEvent->myY);
 
   bool anIsChanged = false;
 
-  SALOME_Actor *anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
-  
-  if ( myCurrRotationPointType == SVTK::StartPointSelection )
+  SALOME_Actor* aPreHighlightedActor = NULL;
+  vtkActorCollection* anActorCollection = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
+
+  if ( myCurrFocalPointType == SVTK::StartFocalPointSelection )
   {
-    myHighlightRotationPointActor->SetVisibility( false );
+    myHighlightSelectionPointActor->SetVisibility( false );
 
-    if ( anActor )
+    if( anActorCollection )
     {
-      myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() );
-      int aVtkId = myPointPicker->GetPointId();
-      if ( aVtkId >= 0 ) {
-       int anObjId = anActor->GetNodeObjId( aVtkId );
-
-       TColStd_IndexedMapOfInteger aMapIndex;
-       aMapIndex.Add( anObjId );
-       myHighlightRotationPointActor->MapPoints( anActor, aMapIndex );
-
-       myHighlightRotationPointActor->SetVisibility( true );
-       anIsChanged = true;
+      anActorCollection->InitTraversal();
+      while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
+      {
+        if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aVTKActor ) )
+        {
+          SVTK::TPickLimiter aPickLimiter( myPointPicker, anActor );
+          myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() );
+          vtkIdType aVtkId = myPointPicker->GetPointId();
+          if ( aVtkId >= 0 ) {
+            vtkIdType anObjId = anActor->GetNodeObjId( aVtkId );
+
+            SVTK_TIndexedMapOfVtkId aMapIndex;
+            aMapIndex.Add( anObjId );
+            myHighlightSelectionPointActor->MapPoints( anActor, aMapIndex );
+
+            myHighlightSelectionPointActor->SetVisibility( true );
+            anIsChanged = true;
+            break;
+          }
+        }
       }
     }
   }
   else {
-    if (anActor){
-      anIsChanged |= anActor->PreHighlight( this, aSelectionEvent, true );
+    if( anActorCollection )
+    {
+      anActorCollection->InitTraversal();
+      while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
+      {
+        if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aVTKActor ) )
+        {
+          anIsChanged = anActor->PreHighlight( this, aSelectionEvent, true );
+          if( anActor->isPreselected() )
+          {
+            aPreHighlightedActor = anActor;
+            break;
+          }
+        }
+      }
     }
 
-    if(myLastPreHighlitedActor.GetPointer() && myLastPreHighlitedActor.GetPointer() != anActor)
+    if(myLastPreHighlitedActor.GetPointer() && myLastPreHighlitedActor.GetPointer() != aPreHighlightedActor)
       anIsChanged |= myLastPreHighlitedActor->PreHighlight( this, aSelectionEvent, false );   
 
   }
   
-  myLastPreHighlitedActor = anActor;
+  myLastPreHighlitedActor = aPreHighlightedActor;
 
   if(anIsChanged)
     this->Render();
@@ -1253,9 +1447,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;
@@ -1280,23 +1472,24 @@ 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)
 {
+  if (GetCurrentRenderer() == NULL)
+    return;
+
   vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
   double viewFocus[4], focalDepth, viewPoint[3];
-  vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3];
+  double newPickPoint[4], oldPickPoint[4], motionVector[3];
   cam->GetFocalPoint(viewFocus);
 
   this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
-                             viewFocus[2], viewFocus);
+                              viewFocus[2], viewFocus);
   focalDepth = viewFocus[2];
 
   this->ComputeDisplayToWorld(double(toX), double(toY),
-                             focalDepth, newPickPoint);
+                              focalDepth, newPickPoint);
   this->ComputeDisplayToWorld(double(fromX),double(fromY),
-                             focalDepth, oldPickPoint);
+                              focalDepth, oldPickPoint);
   
   // camera motion is reversed
   motionVector[0] = oldPickPoint[0] - newPickPoint[0];
@@ -1306,40 +1499,49 @@ SVTK_InteractorStyle
   cam->GetFocalPoint(viewFocus);
   cam->GetPosition(viewPoint);
   cam->SetFocalPoint(motionVector[0] + viewFocus[0],
-                    motionVector[1] + viewFocus[1],
-                    motionVector[2] + viewFocus[2]);
+                     motionVector[1] + viewFocus[1],
+                     motionVector[2] + viewFocus[2]);
   cam->SetPosition(motionVector[0] + viewPoint[0],
-                  motionVector[1] + viewPoint[1],
-                  motionVector[2] + viewPoint[2]);
+                   motionVector[1] + viewPoint[1],
+                   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 );
 }
 
+void SVTK_InteractorStyle::InteractiveSelection() 
+{
+  if (vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera()) {
+    int posX, posY;
+    this->Interactor->GetEventPosition(posX, posY);
+    double viewFocus[3], z;
+    double* focalPointWorld = cam->GetFocalPoint();
+         this->ComputeWorldToDisplay(focalPointWorld[0], focalPointWorld[1],
+                 focalPointWorld[2], viewFocus);
+         z = viewFocus[2];
+
+         this->ComputeDisplayToWorld(double(posX), double(posY),
+               z, this->myInteractivePoint);
+         InvokeEvent(SVTK::InteractiveSelectionChanged, (void*)this->myInteractivePoint);
+  }
+}
+
 /*!
   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 );
@@ -1378,39 +1580,46 @@ 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 );
+         theInteractor->AddObserver( SVTK::StartInteractiveSelection, EventCallbackCommand, Priority);
+    theInteractor->AddObserver( SVTK::StopCurrentOperation, EventCallbackCommand, Priority);
   }
 }
 
 /*!
   To implement cached rendering
 */
-void
-SVTK_InteractorStyle
-::OnTimer() 
+void SVTK_InteractorStyle::OnTimer() 
 {
   //vtkInteractorStyle::OnTimer();
   this->Interactor->Render();
   // check if bounding box was changed
   if ( GetCurrentRenderer() )
   {
-    vtkFloatingPointType aCurrBBCenter[3];
+#ifdef VGL_WORKAROUND
+    GetCurrentRenderer()->Render();
+#endif
+    double aCurrBBCenter[3];
     if ( ComputeBBCenter(GetCurrentRenderer(),aCurrBBCenter) )
     {
       if ( !myBBFirstCheck )
       {
-       if ( fabs(aCurrBBCenter[0]-myBBCenter[0]) > 1e-38 ||
-            fabs(aCurrBBCenter[1]-myBBCenter[1]) > 1e-38 ||
-            fabs(aCurrBBCenter[2]-myBBCenter[2]) > 1e-38 ) {
-         // bounding box was changed => send SVTK::RotationPointChanged event
-         // invoke event for update coordinates in SVTK_SetRotationPointDlg
-         InvokeEvent(SVTK::BBCenterChanged,(void*)aCurrBBCenter);
-         for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
-       }
+        if ( fabs(aCurrBBCenter[0]-myBBCenter[0]) > 1e-38 ||
+             fabs(aCurrBBCenter[1]-myBBCenter[1]) > 1e-38 ||
+             fabs(aCurrBBCenter[2]-myBBCenter[2]) > 1e-38 ) {
+          // bounding box was changed => send SVTK::RotationPointChanged event
+          // invoke event for update coordinates in SVTK_SetRotationPointDlg
+          InvokeEvent(SVTK::BBCenterChanged,(void*)aCurrBBCenter);
+          for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+        }
       }
       else 
       {
-       for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
-       myBBFirstCheck = false;
+        for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+        myBBFirstCheck = false;
       }
     }
   }
@@ -1419,16 +1628,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;
@@ -1441,9 +1646,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();
@@ -1455,136 +1658,336 @@ SVTK_InteractorStyle
     DominantCombinedSwitch();
 }
 
-void
-SVTK_InteractorStyle
-::DominantCombinedSwitch()
+void SVTK_InteractorStyle::DominantCombinedSwitch()
 {
   printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" );
 }
 
+/*!
+  Draws rectangle by starting and current points
+*/
+void SVTK_InteractorStyle::drawRect()
+{
+  if ( !myRectBand )
+    myRectBand = new QtxRectRubberBand( GetRenderWidget() );
+
+  myRectBand->setUpdatesEnabled ( false );
+  QRect aRect = SUIT_Tools::makeRect(myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y());
+  myRectBand->initGeometry( aRect );
+
+  if ( !myRectBand->isVisible() )
+    myRectBand->show();
+
+  myRectBand->setUpdatesEnabled ( true );
+}
+
+/*!
+  \brief Delete rubber band on the end on the dragging operation.
+*/
+void SVTK_InteractorStyle::endDrawRect()
+{
+  if ( myRectBand ) {
+    myRectBand->clearGeometry();
+    myRectBand->hide();
+  }
+}
+
+bool isIntersect( const QPoint& theStart1, const QPoint& theEnd1,
+                  const QPoint& theStart2, const QPoint& theEnd2 )
+{
+  if ( ( theStart1 == theStart2 && theEnd1 == theEnd2 ) ||
+       ( theStart1 == theEnd2 && theEnd1 == theStart2 ) )
+    return true;
+
+  if ( theStart1 == theStart2 || theStart2 == theEnd1 ||
+      theStart1 == theEnd2 || theEnd1 == theEnd2 )
+    return false;
+
+  double x11 = theStart1.x() * 1.0;
+  double x12 = theEnd1.x() * 1.0;
+  double y11 = theStart1.y() * 1.0;
+  double y12 = theEnd1.y() * 1.0;
+
+  double x21 = theStart2.x() * 1.0;
+  double x22 = theEnd2.x() * 1.0;
+  double y21 = theStart2.y() * 1.0;
+  double y22 = theEnd2.y() * 1.0;
+
+  double k1 = x12 == x11 ? 0 : ( y12 - y11 ) / ( x12 - x11 );
+  double k2 = x22 == x21 ? 0 : ( y22 - y21 ) / ( x22 - x21 );
+
+  double b1 = y11 - k1 * x11;
+  double b2 = y21 - k2 * x21;
+
+  if ( k1 == k2 )
+  {
+    if ( b1 != b2 )
+      return false;
+    else
+      return !( ( qMax( x11, x12 ) <= qMin( x21, x22 ) ||
+                  qMin( x11, x12 ) >= qMax( x21, x22 ) ) &&
+                ( qMax( y11, y12 ) <= qMin( y21, y22 ) ||
+                  qMin( y11, y12 ) >= qMax( y21, y22 ) ) );
+  }
+  else
+  {
+    double x0 = ( b2 - b1 ) / ( k1 - k2 );
+    double y0 = ( k1 * b2 - k2 * b1 ) / ( k1 - k2 );
+
+    if ( qMin( x11, x12 ) < x0 && x0 < qMax( x11, x12 ) &&
+         qMin( y11, y12 ) < y0 && y0 < qMax( y11, y12 ) &&
+         qMin( x21, x22 ) < x0 && x0 < qMax( x21, x22 ) &&
+         qMin( y21, y22 ) < y0 && y0 < qMax( y21, y22 ) )
+      return true;
+  }
+  return false;
+}
+
+bool isValid( const QPolygon* thePoints, const QPoint& theCurrent )
+{
+  if ( !thePoints->count() )
+    return true;
+
+  if ( thePoints->count() == 1 && thePoints->point( 0 ) == theCurrent )
+    return false;
+
+  const QPoint& aLast = thePoints->point( thePoints->count() - 1 );
+
+  if ( aLast == theCurrent )
+    return true;
+
+  bool res = true;
+  for ( int i = 0; i < thePoints->count() - 1 && res; i++ )
+  {
+    const QPoint& aStart = thePoints->point( i );
+    const QPoint& anEnd  = thePoints->point( i + 1 );
+    res = !isIntersect( aStart, anEnd, theCurrent, aLast );
+  }
+  return res;
+}
+
+/*!
+  Draws polygon
+*/
+void SVTK_InteractorStyle::drawPolygon()
+{
+  QSize aToler( 5, 5 );
+  if ( !myPolygonBand ) {
+    myPolygonBand = new QtxPolyRubberBand( GetRenderWidget() );
+    QPalette palette;
+    palette.setColor( myPolygonBand->foregroundRole(), Qt::white );
+    myPolygonBand->setPalette( palette );
+    myPolygonPoints.append( QPoint( myPoint.x(), myPoint.y() ) );
+  }
+  myPolygonBand->hide();
+
+  bool closed = false;
+  bool valid = GetRenderWidget()->rect().contains( QPoint( myOtherPoint.x(), myOtherPoint.y() ) );
+  if ( !myPolygonPoints.at(0).isNull() )
+  {
+    QRect aRect( myPolygonPoints.at(0).x() - aToler.width(), myPolygonPoints.at(0).y() - aToler.height(),
+                 2 * aToler.width(), 2 * aToler.height() );
+    closed = aRect.contains( QPoint( myOtherPoint.x(), myOtherPoint.y() ) );
+  }
+
+  QPolygon* points = new QPolygon( myPolygonPoints );
+  valid = valid && isValid( points, QPoint( myOtherPoint.x(), myOtherPoint.y() ) );
+  myPoligonState = valid ? InProcess : NotValid;
+  delete points;
+  if ( closed && !valid )
+    closed = false;
+
+  if ( closed && myPolygonPoints.size() > 2 ) {
+    GetRenderWidget()->setCursor( Qt::CrossCursor );
+    myPoligonState = Closed;
+  }
+  else if ( valid )
+    GetRenderWidget()->setCursor( Qt::PointingHandCursor );
+  else
+    GetRenderWidget()->setCursor( Qt::ForbiddenCursor );
+
+  myPolygonPoints.append( QPoint( myOtherPoint.x(), myOtherPoint.y() ) );
+
+  QPolygon aPolygon( myPolygonPoints );
+  myPolygonBand->initGeometry( aPolygon );
+  myPolygonBand->setVisible( true );
+
+  if ( myPolygonPoints.size() > 1 ) {
+    myPolygonPoints.remove( myPolygonPoints.size() - 1 );
+  }
+}
+
+/*!
+  \brief Delete rubber band on the end on the dragging operation.
+*/
+void SVTK_InteractorStyle::endDrawPolygon()
+{
+  if ( myPolygonBand ) myPolygonBand->hide();
+
+  // RNV fix for : #19204 [CEA][Windows] VTK Viewer - Access violation while right clicking
+  //delete myPolygonBand;
+  myPolygonBand->deleteLater();
+  myPolygonBand = 0;
+
+  myPolygonPoints.clear();
+}
+
 /*!
   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 );
     SVTK_InteractorStyle* self = dynamic_cast<SVTK_InteractorStyle*>( anObject );
     int aSpeedIncrement=self->ControllerIncrement()->Current();
-    vtkFloatingPointType aCenter[3];
-    vtkFloatingPointType* aSelectedPoint;
+    double aCenter[3];
+    double* aSelectedPoint;
     if ( self ) {
       switch ( event ) {
       case SVTK::SpaceMouseMoveEvent : 
-       self->onSpaceMouseMove( (double*)callData ); 
-       return;
+        self->onSpaceMouseMove( (double*)callData ); 
+        return;
       case SVTK::SpaceMouseButtonEvent : 
-       self->onSpaceMouseButton( *((int*)callData) ); 
-       return;
+        self->onSpaceMouseButton( *((int*)callData) ); 
+        return;
       case SVTK::PanLeftEvent: 
-       self->IncrementalPan(-aSpeedIncrement, 0);
-       return;
+        self->IncrementalPan(-aSpeedIncrement, 0);
+        return;
       case SVTK::PanRightEvent:
-       self->IncrementalPan(aSpeedIncrement, 0);
-       return;
+        self->IncrementalPan(aSpeedIncrement, 0);
+        return;
       case SVTK::PanUpEvent:
-       self->IncrementalPan(0, aSpeedIncrement);
-       return;
+        self->IncrementalPan(0, aSpeedIncrement);
+        return;
       case SVTK::PanDownEvent:
-       self->IncrementalPan(0, -aSpeedIncrement);
-       return;
+        self->IncrementalPan(0, -aSpeedIncrement);
+        return;
       case SVTK::ZoomInEvent:
-       self->IncrementalZoom(aSpeedIncrement);
-       return;
+        self->IncrementalZoom(aSpeedIncrement);
+        return;
       case SVTK::ZoomOutEvent:
-       self->IncrementalZoom(-aSpeedIncrement);
-       return;
+        self->IncrementalZoom(-aSpeedIncrement);
+        return;
       case SVTK::RotateLeftEvent: 
-       self->IncrementalRotate(-aSpeedIncrement, 0);
-       return;
+        self->IncrementalRotate(-aSpeedIncrement, 0);
+        return;
       case SVTK::RotateRightEvent:
-       self->IncrementalRotate(aSpeedIncrement, 0);
-       return;
+        self->IncrementalRotate(aSpeedIncrement, 0);
+        return;
       case SVTK::RotateUpEvent:
-       self->IncrementalRotate(0, -aSpeedIncrement);
-       return;
+        self->IncrementalRotate(0, -aSpeedIncrement);
+        return;
       case SVTK::RotateDownEvent:
-       self->IncrementalRotate(0, aSpeedIncrement);
-       return;
+        self->IncrementalRotate(0, aSpeedIncrement);
+        return;
       case SVTK::PlusSpeedIncrementEvent:
-       self->ControllerIncrement()->Increase();
-       return;
+        self->ControllerIncrement()->Increase();
+        return;
       case SVTK::MinusSpeedIncrementEvent:
-       self->ControllerIncrement()->Decrease();
-       return;
+        self->ControllerIncrement()->Decrease();
+        return;
       case SVTK::SetSpeedIncrementEvent:
-       self->ControllerIncrement()->SetStartValue(*((int*)callData));
-       return;
+        self->ControllerIncrement()->SetStartValue(*((int*)callData));
+        return;
 
       case SVTK::SetSMDecreaseSpeedEvent:
-       self->mySMDecreaseSpeedBtn = *((int*)callData);
-       return;
+        self->mySMDecreaseSpeedBtn = *((int*)callData);
+        return;
       case SVTK::SetSMIncreaseSpeedEvent:
-       self->mySMIncreaseSpeedBtn = *((int*)callData);
-       return;
+        self->mySMIncreaseSpeedBtn = *((int*)callData);
+        return;
       case SVTK::SetSMDominantCombinedSwitchEvent:
-       self->mySMDominantCombinedSwitchBtn = *((int*)callData);
-       return;
+        self->mySMDominantCombinedSwitchBtn = *((int*)callData);
+        return;
 
       case SVTK::StartZoom:
-       self->startZoom();
-       return;
+        self->startZoom();
+        return;
       case SVTK::StartPan:
-       self->startPan();
-       return;
+        self->startPan();
+        return;
       case SVTK::StartRotate:
-       self->startRotate();
-       return;
+        self->startRotate();
+        return;
       case SVTK::StartGlobalPan:
-       self->startGlobalPan();
-       return;
+        self->startGlobalPan();
+        return;
       case SVTK::StartFitArea:
-       self->startFitArea();
-       return;
+        self->startFitArea();
+        return;
 
       case SVTK::SetRotateGravity:
-       if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
-       {
-         self->myHighlightRotationPointActor->SetVisibility( false );
-         if( self->GetCurrentRenderer() != NULL )
-           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
-         self->GetRenderWidget()->setCursor(self->myDefCursor); 
-       }
-       self->myPrevRotationPointType = self->myCurrRotationPointType;
-       self->myCurrRotationPointType = SVTK::SetRotateGravity;
-       if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) 
-         // invoke event for update coordinates in SVTK_SetRotationPointDlg
-         self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
-       return;
+        if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+        {
+          self->myHighlightSelectionPointActor->SetVisibility( false );
+          if( self->GetCurrentRenderer() != NULL )
+            self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+          self->GetRenderWidget()->setCursor(self->myDefCursor); 
+        }
+        self->myPrevRotationPointType = self->myCurrRotationPointType;
+        self->myCurrRotationPointType = SVTK::SetRotateGravity;
+        if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) 
+          // invoke event for update coordinates in SVTK_SetRotationPointDlg
+          self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
+        return;
       case SVTK::StartPointSelection:
-       self->startPointSelection();
-       return;
+        self->startPointSelection();
+        return;
 
       case SVTK::ChangeRotationPoint:
-       if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
-       {
-         self->myHighlightRotationPointActor->SetVisibility( false );
-         if( self->GetCurrentRenderer() != NULL )
-           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
-         self->GetRenderWidget()->setCursor(self->myDefCursor); 
-       }
-       self->myPrevRotationPointType = self->myCurrRotationPointType;
-       self->myCurrRotationPointType = SVTK::SetRotateSelected;
-       aSelectedPoint = (vtkFloatingPointType*)callData;
-       self->myRotationPointX = aSelectedPoint[0];
-       self->myRotationPointY = aSelectedPoint[1];
-       self->myRotationPointZ = aSelectedPoint[2];
-       return;
+        if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+        {
+          self->myHighlightSelectionPointActor->SetVisibility( false );
+          if( self->GetCurrentRenderer() != NULL )
+            self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+          self->GetRenderWidget()->setCursor(self->myDefCursor); 
+        }
+        self->myPrevRotationPointType = self->myCurrRotationPointType;
+        self->myCurrRotationPointType = SVTK::SetRotateSelected;
+        aSelectedPoint = (double*)callData;
+        self->myRotationPointX = aSelectedPoint[0];
+        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::FocalPointChanged,(void*)aCenter);
+        }
+        return;
+      case SVTK::StartFocalPointSelection:
+        self->startFocalPointSelection();
+        return;
+      case SVTK::StartInteractiveSelection:
+        self->startInteractiveSelection();
+        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;
+      case SVTK::StopCurrentOperation:
+        self->onFinishOperation();
+        self->startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
       }
     }
   }
@@ -1597,6 +2000,11 @@ SVTK_InteractorStyle
 */
 void SVTK_InteractorStyle::OnChar()
 {
+  char key = GetInteractor()->GetKeyCode();
+  switch ( key ) {
+  case '+': ControllerIncrement()->Increase(); break;
+  case '-': ControllerIncrement()->Decrease(); break;
+  }
 }
 
 /*!
@@ -1643,13 +2051,29 @@ SVTK_ControllerOnKeyDown* SVTK_InteractorStyle::ControllerOnKeyDown()
 }
 
 /*!
-  To get current increment controller
+  To set current increment controller
 */
 void SVTK_InteractorStyle::SetControllerIncrement(SVTK_ControllerIncrement* theController)
 {
   myControllerIncrement=theController;
 }
 
+/*!
+  To modify current increment controller
+*/
+void SVTK_InteractorStyle::SetIncrementSpeed(const int theValue, const int theMode)
+{
+  SVTK_ControllerIncrement* c = 0;
+  switch (theMode) {
+  case 0: c = SVTK_ControllerIncrement::New(); break;
+  case 1: c = SVTK_GeomControllerIncrement::New(); break;
+  }
+  c->SetStartValue(theValue);
+
+  SetControllerIncrement(c);
+  c->Delete();
+}
+
 /*!
   To get current increment controller 
 */
@@ -1658,7 +2082,7 @@ SVTK_ControllerIncrement* SVTK_InteractorStyle::ControllerIncrement()
   return myControllerIncrement.GetPointer();
 }
 
-vtkStandardNewMacro(SVTK_ControllerIncrement);
+vtkStandardNewMacro(SVTK_ControllerIncrement)
 SVTK_ControllerIncrement::SVTK_ControllerIncrement()
 {
   myIncrement=10;
@@ -1687,7 +2111,28 @@ int SVTK_ControllerIncrement::Decrease()
   return myIncrement;
 }
 
-vtkStandardNewMacro(SVTK_ControllerOnKeyDown);
+vtkStandardNewMacro(SVTK_GeomControllerIncrement)
+SVTK_GeomControllerIncrement::SVTK_GeomControllerIncrement()
+{
+}
+SVTK_GeomControllerIncrement::~SVTK_GeomControllerIncrement()
+{
+}
+int SVTK_GeomControllerIncrement::Increase()
+{
+  myIncrement*=2;
+  return myIncrement;
+}
+int SVTK_GeomControllerIncrement::Decrease()
+{
+  myIncrement/=2;
+  if (myIncrement<1){
+    myIncrement=1;
+  }
+  return myIncrement;
+}
+
+vtkStandardNewMacro(SVTK_ControllerOnKeyDown)
 
 /*!
   Constructor
@@ -1703,7 +2148,7 @@ SVTK_ControllerOnKeyDown::~SVTK_ControllerOnKeyDown()
 {
 }
 
-bool SVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
+bool SVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* /*theIS*/)
 {
   return true;
 }