Salome HOME
Chanel Create\Edit operation.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 5af8b51b14ea634b8efbad12096e3883dbdd2a21..8c8396d6624b33cc60e44e61f42c8f56f2aaec70 100644 (file)
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
 #include "HYDROGUI_Shape.h"
+#include "HYDROGUI_VTKPrs.h"
+#include "HYDROGUI_VTKPrsDisplayer.h"
+#include "HYDROGUI_AbstractDisplayer.h"
+#include "HYDROGUI_PolylineOp.h"
 
 #include <HYDROData_Image.h>
+#include <HYDROData_Profile.h>
 #include <HYDROData_Lambert93.h>
 #include <HYDROData_Tool.h>
 
 #include <SUIT_Study.h>
 #include <SUIT_ViewManager.h>
 
+#include <SVTK_ViewManager.h>
+#include <SVTK_ViewModel.h>
+#include <SVTK_Selector.h>
+
+#include <OCCViewer_ViewPort3d.h>
+
+#include <GEOMUtils.hxx>
+
 #include <QAction>
 #include <QApplication>
 #include <QGraphicsSceneMouseEvent>
 #include <QMenu>
+#include <QMouseEvent>
+#include <QStatusBar>
 
 static int ViewManagerId = 0;
 
@@ -118,6 +133,7 @@ void HYDROGUI_Module::initialize( CAM_Application* theApp )
 
   myDisplayer = new HYDROGUI_Displayer( this );
   myOCCDisplayer = new HYDROGUI_OCCDisplayer( this );
+  myVTKDisplayer = new HYDROGUI_VTKPrsDisplayer( this );
 }
 
 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
@@ -144,6 +160,21 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
   connect( anApp, SIGNAL( operationFinished( const QString&, const QString&, const QStringList& ) ), 
            this, SLOT( onExternalOperationFinished( const QString&, const QString&, const QStringList& ) ) );
 
+  HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, false );
+
+  ViewManagerList anOCCViewManagers;
+  anApp->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
+  foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
+    connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+             this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+    foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() ) {
+      OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWindow );
+      if ( aViewFrame && aViewFrame->getViewPort() ) {
+        aViewFrame->getViewPort()->installEventFilter( this );
+      }
+    }
+  }
+
   return aRes;
 }
 
@@ -155,8 +186,16 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
       getApp()->removeViewManager( aViewManager );
   myViewManagerMap.clear();
 
+  ViewManagerList anOCCViewManagers;
+  getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
+  foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
+    disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+                this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+  }
+
   myObjectStateMap.clear();
   myShapesMap.clear();
+  myVTKPrsMap.clear();
 
   // clear the data model's list of copying objects
   HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() );
@@ -169,6 +208,8 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
   disconnect( getApp(), SIGNAL( operationFinished( const QString&, const QString&, const QStringList& ) ), 
               this, SLOT( onExternalOperationFinished( const QString&, const QString&, const QStringList& ) ) );
 
+  HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
+
   return LightApp_Module::deactivateModule( theStudy );
 }
 
@@ -196,7 +237,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType();
   bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type();
   bool anIsOCCView = theClient == OCCViewer_Viewer::Type();
-  if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView )
+  bool anIsVTKView = theClient == SVTK_Viewer::Type();
+  if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView && !anIsVTKView )
     return;
 
   size_t anActiveViewId = HYDROGUI_Tool::GetActiveViewId( this );
@@ -213,12 +255,19 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsSplittedImage = false;
   bool anIsMustBeUpdatedImage = false;
   bool anIsPolyline = false;
+  bool anIsPolyline3D = false;
+  bool anIsProfile = false;
+  bool anIsValidProfile = false;
+  bool anAllAreProfiles = false;
+  bool anIsBathymetry = false;
   bool anIsCalculation = false;
   bool anIsImmersibleZone = false;
   bool anIsVisualState = false;
   bool anIsRegion = false;
   bool anIsZone = false;
   bool anIsObstacle = false;
+  bool anIsStream = false;
+  bool anIsChannel = false;
   bool anIsGeomObject = false;
 
   // check the selected GEOM objects
@@ -229,6 +278,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   // check the selected data model objects
   HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
+  int aNbOfSelectedProfiles = 0;
   for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
@@ -240,13 +290,14 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       anIsVisibleInSelection |= aVisibility;
       anIsHiddenInSelection |= !aVisibility;
 
-      if( anObject->GetKind() == KIND_IMAGE )
+      ObjectKind anObjectKind = anObject->GetKind();
+      if( anObjectKind == KIND_IMAGE )
       {
         anIsImage = true;
         Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
         if( !anImage.IsNull() )
         {
-          anIsImportedImage = anImage->HasLocalPoints() && !anImage->IsSelfSplitted();
+          anIsImportedImage = anImage->HasLocalPoints();
           anIsImageHasRefs = anImage->HasReferences();
           if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
           {
@@ -267,25 +318,48 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
           }
         }
       }
-      else if( anObject->GetKind() == KIND_POLYLINE )
+      else if( anObjectKind == KIND_POLYLINEXY )
         anIsPolyline = true;
-      else if( anObject->GetKind() == KIND_CALCULATION )
+      else if( anObjectKind == KIND_POLYLINE )
+        anIsPolyline3D = true;
+      else if( anObjectKind == KIND_PROFILE )
+      {
+        anIsProfile = true;
+        aNbOfSelectedProfiles++;
+
+        Handle(HYDROData_Profile) aProfile = 
+          Handle(HYDROData_Profile)::DownCast( anObject );
+        if( !aProfile.IsNull() && aProfile->IsValid() ) {
+          anIsValidProfile = true;
+        }
+      }
+      else if( anObjectKind == KIND_CALCULATION )
         anIsCalculation = true;
-      else if( anObject->GetKind() == KIND_IMMERSIBLE_ZONE )
+      else if( anObjectKind == KIND_IMMERSIBLE_ZONE )
         anIsImmersibleZone = true;
-      else if( anObject->GetKind() == KIND_VISUAL_STATE )
+      else if( anObjectKind == KIND_VISUAL_STATE )
         anIsVisualState = true;
-      else if( anObject->GetKind() == KIND_REGION )
+      else if( anObjectKind == KIND_REGION )
         anIsRegion = true;
-      else if( anObject->GetKind() == KIND_ZONE )
+      else if( anObjectKind == KIND_ZONE )
         anIsZone = true;
-      else if( anObject->GetKind() == KIND_OBSTACLE )
+      else if( anObjectKind == KIND_BATHYMETRY )
+        anIsBathymetry = true;
+      else if( anObjectKind == KIND_OBSTACLE )
         anIsObstacle = true;
+      else if( anObjectKind == KIND_STREAM )
+        anIsStream = true;
+      else if( anObjectKind == KIND_CHANNEL )
+        anIsChannel = true;
     }
 
     anIsGeomObject = HYDROData_Tool::IsGeometryObject( anObject );
   }
 
+  // Check if all selected objects are profiles
+  anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
+                     ( aNbOfSelectedProfiles == aSeq.Length() );
+
   // check the selected partitions
   if( !anIsSelectedDataObjects && anIsObjectBrowser )
   {
@@ -297,26 +371,38 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         case KIND_IMAGE:
           theMenu->addAction( action( ImportImageId ) );
           break;
-        case KIND_POLYLINE:
-          theMenu->addAction( action( CreatePolylineId ) );
-          break;
-        case KIND_VISUAL_STATE:
-          theMenu->addAction( action( SaveVisualStateId ) );
-          break;
         case KIND_BATHYMETRY:
           theMenu->addAction( action( ImportBathymetryId ) );
           break;
-        case KIND_CALCULATION:
-          theMenu->addAction( action( CreateCalculationId ) );
+        case KIND_ARTIFICIAL_OBJECT:
+          theMenu->addAction( action( CreateChannelId ) );
           break;
-        case KIND_IMMERSIBLE_ZONE:
+        case KIND_NATURAL_OBJECT:
           theMenu->addAction( action( CreateImmersibleZoneId ) );
+          theMenu->addAction( action( CreateStreamId ) );
           break;
         case KIND_OBSTACLE:
           theMenu->addAction( action( ImportObstacleFromFileId ) );
           theMenu->addAction( action( CreateBoxId ) );
           theMenu->addAction( action( CreateCylinderId ) );
           break;
+        case KIND_CALCULATION:
+          theMenu->addAction( action( CreateCalculationId ) );
+          break;
+        case KIND_POLYLINEXY:
+          theMenu->addAction( action( CreatePolylineId ) );
+          break;
+        case KIND_POLYLINE:
+          theMenu->addAction( action( CreatePolyline3DId ) );
+          break;
+        case KIND_PROFILE:
+          theMenu->addAction( action( CreateProfileId ) );
+          theMenu->addAction( action( ImportProfilesId ) );
+          theMenu->addAction( action( AllGeoreferencementId ) );
+          break;
+        case KIND_VISUAL_STATE:
+          theMenu->addAction( action( SaveVisualStateId ) );
+          break;
       }
       theMenu->addSeparator();
     }
@@ -366,6 +452,17 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( EditPolylineId ) );
         theMenu->addSeparator();
       }
+      else if( anIsPolyline3D )
+      {
+        theMenu->addAction( action( EditPolyline3DId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsProfile )
+      {
+        theMenu->addAction( action( EditProfileId ) );
+        theMenu->addAction( action( SelectedGeoreferencementId ) );
+        theMenu->addSeparator();
+      }
       else if( anIsCalculation )
       {
         theMenu->addAction( action( EditCalculationId ) );
@@ -377,6 +474,16 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( EditImmersibleZoneId ) );
         theMenu->addSeparator();
       }
+      else if( anIsStream )
+      {
+        theMenu->addAction( action( EditStreamId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsChannel )
+      {
+        theMenu->addAction( action( EditChannelId ) );
+        theMenu->addSeparator();
+      }
       else if( anIsVisualState && anIsObjectBrowser )
       {
         theMenu->addAction( action( SaveVisualStateId ) );
@@ -390,12 +497,18 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( SetColorId ) );
         theMenu->addSeparator();
       }
+    } else if ( anAllAreProfiles ) {
+      theMenu->addAction( action( SelectedGeoreferencementId ) );
+      theMenu->addSeparator();
     }
 
     theMenu->addAction( action( DeleteId ) );
     theMenu->addSeparator();
 
-    if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion || anIsObstacle )
+    if( anIsImage || anIsPolyline || anIsPolyline3D || 
+        anIsImmersibleZone || anIsZone || anIsRegion ||
+        anIsBathymetry || anIsObstacle || anIsStream ||
+        anIsChannel || anIsValidProfile )
     {
       if( anIsHiddenInSelection )
         theMenu->addAction( action( ShowId ) );
@@ -406,7 +519,15 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     }
   }
 
-  if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView )
+  if ( anIsOCCView )
+  {
+    SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
+    HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
+    if ( aPolylineOp && aPolylineOp->deleteEnabled() )
+      theMenu->addAction( action( DeleteId ) );
+  }
+
+  if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
   {
     theMenu->addAction( action( ShowAllId ) );
     theMenu->addAction( action( HideAllId ) );
@@ -428,15 +549,15 @@ void HYDROGUI_Module::update( const int flags )
   // store selected objects
   QStringList aSelectedEntries = storeSelection();
 
+  bool aDoFitAll = flags & UF_FitAll;
   if( ( flags & UF_Viewer ) )
-    updateGV( flags & UF_GV_Init,
-              flags & UF_GV_Forced,
-              flags & UF_FitAll );
+    updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll ); 
 
   if( ( flags & UF_OCCViewer ) )
-    updateOCCViewer( flags & UF_OCC_Init,
-                     flags & UF_OCC_Forced,
-                     flags & UF_FitAll );
+    updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll ); 
+
+  if( ( flags & UF_VTKViewer ) )
+    updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll ); 
 
   if( ( flags & UF_Model ) && getDataModel() && getApp() )
   {
@@ -496,6 +617,20 @@ HYDROGUI_OCCDisplayer* HYDROGUI_Module::getOCCDisplayer() const
   return myOCCDisplayer;
 }
 
+HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
+{
+  return myVTKDisplayer;
+}
+
+SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
+{
+  if( myViewManagerMap.contains( theId ) )
+  {
+    return myViewManagerMap[ theId ].first;
+  }
+  return NULL;
+}
+
 GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
 {
   if( myViewManagerMap.contains( theId ) )
@@ -522,6 +657,19 @@ OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
   return NULL;
 }
 
+SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
+{
+  if( myViewManagerMap.contains( theId ) )
+  {
+    ViewManagerInfo anInfo = myViewManagerMap[ theId ];
+    SVTK_ViewManager* aViewManager =
+      ::qobject_cast<SVTK_ViewManager*>( anInfo.first );
+    if( aViewManager )
+      return dynamic_cast<SVTK_Viewer*>( aViewManager->getViewModel() );
+  }
+  return NULL;
+}
+
 int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
 {
   ViewManagerMapIterator anIter( myViewManagerMap );
@@ -589,6 +737,7 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId,
   }
 }
 
+/////////////////// OCC SHAPES PROCESSING
 HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int                       theViewId,
                                                  const Handle(HYDROData_Entity)& theObject ) const
 {
@@ -661,6 +810,126 @@ void HYDROGUI_Module::removeViewShapes( const int theViewId )
 
   myShapesMap.remove( theViewId );
 }
+/////////////////// END OF OCC SHAPES PROCESSING
+
+/////////////////// VTKPrs PROCESSING
+HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int                       theViewId,
+                                                 const Handle(HYDROData_Entity)& theObject ) const
+{
+  HYDROGUI_VTKPrs* aResShape = NULL;
+  if( theObject.IsNull() )
+    return aResShape;
+
+  if ( myVTKPrsMap.contains( theViewId ) )
+  {
+    const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
+    foreach ( HYDROGUI_VTKPrs* aShape, aViewShapes )
+    {
+      if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
+        continue;
+
+      aResShape = aShape;
+      break;
+    }
+  }
+
+  return aResShape;
+}
+
+void HYDROGUI_Module::setObjectVTKPrs( const int                       theViewId,
+                                       const Handle(HYDROData_Entity)& theObject,
+                                       HYDROGUI_VTKPrs*                 theShape )
+{
+  if( theObject.IsNull() )
+    return;
+
+  // Compute the new global Z range from the added presentation and the old global Z range.
+  double* aGlobalRange = getVTKDisplayer()->GetZRange( theViewId );
+  double* aRange = theShape->getInternalZRange();
+  bool anIsUpdate = false;
+  if ( aRange[0] < aGlobalRange[0] )
+  {
+    aGlobalRange[0] = aRange[0];
+    anIsUpdate = true;
+  }
+  if ( aRange[1] > aGlobalRange[1] )
+  {
+    aGlobalRange[1] = aRange[1];
+    anIsUpdate = true;
+  }
+
+  //if ( anIsUpdate )
+  //{
+    updateVTKZRange( theViewId, aGlobalRange );
+  //}
+
+  ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+  aViewShapes.append( theShape );
+}
+
+void HYDROGUI_Module::removeObjectVTKPrs( const int                       theViewId,
+                                          const Handle(HYDROData_Entity)& theObject )
+{
+  if ( !myVTKPrsMap.contains( theViewId ) )
+    return;
+
+  ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+  Handle(HYDROData_Entity) anObject;
+  for ( int i = 0; i < aViewShapes.length(); )
+  {
+    HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+    anObject = aShape->getObject();
+    if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
+    {
+      delete aShape;
+      aViewShapes.removeAt( i );
+      continue;
+    }
+
+    ++i;
+  }
+
+  // Invalidate global Z range
+  double anInvalidRange[2] = { HYDROGUI_VTKPrs::InvalidZValue(), HYDROGUI_VTKPrs::InvalidZValue() };
+  getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
+}
+
+void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
+{
+  if ( !myVTKPrsMap.contains( theViewId ) )
+    return;
+
+  const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
+  for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
+  {
+    HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+    if ( aShape )
+      delete aShape;
+  }
+
+  myVTKPrsMap.remove( theViewId );
+}
+
+void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
+{
+  if ( myVTKPrsMap.contains( theViewId ) )
+  {
+    // For the given viewer id update all VTK presentations ...
+    const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
+    HYDROGUI_VTKPrs* aShape;
+    for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
+    {
+      aShape = aViewShapes.at( i );
+      if ( aShape )
+      {
+        aShape->setZRange( theRange );
+      }
+    }
+  }
+  // ... and update the global color legend scalar bar.
+  getVTKDisplayer()->SetZRange( theViewId, theRange );
+}
+/////////////////// END OF VTKPrs PROCESSING
 
 CAM_DataModel* HYDROGUI_Module::createDataModel()
 {
@@ -715,6 +984,17 @@ bool HYDROGUI_Module::eventFilter( QObject* theObj, QEvent* theEvent )
       theObj->removeEventFilter( this );
     }
   }
+  else if ( theObj->inherits( "OCCViewer_ViewPort" ) )
+  {
+    if( aType == QEvent::Leave )
+    {
+      SUIT_Desktop* aDesktop = getApp()->desktop();
+      if ( aDesktop && aDesktop->statusBar() ) {
+        aDesktop->statusBar()->clearMessage();
+      }
+    }
+  }
+
   return LightApp_Module::eventFilter( theObj, theEvent );
 }
 
@@ -731,6 +1011,8 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
   {
     connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
              this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
+    connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+             this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
   }
 
   createSelector( theViewManager ); // replace the default selector
@@ -757,6 +1039,16 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
         removeViewShapes( (size_t)anOCCViewer );
     }
 
+    if ( getVTKDisplayer()->IsApplicable( theViewManager ) )
+    {
+      SVTK_Viewer* aVTKViewer = getVTKViewer( anId );
+      if ( aVTKViewer )
+      {
+        getVTKDisplayer()->DeleteScalarBar( anId );
+        removeViewShapes( (size_t)aVTKViewer );
+      }
+    }
+
     myViewManagerMap.remove( anId );
   }
 }
@@ -780,6 +1072,13 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
     if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
     {
       aViewFrame->onTopView();
+
+      HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
+
+      OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort();
+      if ( aViewPort ) {
+        aViewPort->installEventFilter( this );
+      }
     }
   }
 }
@@ -831,59 +1130,31 @@ void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent )
   */
 }
 
-void HYDROGUI_Module::updateGV( const bool theIsInit,
-                                const bool theIsForced,
-                                const bool theDoFitAll )
+void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, 
+                                    const bool theIsInit, 
+                                    const bool theIsForced, 
+                                    const bool theDoFitAll )
 {
-  if( !getDisplayer() )
-    return;
-
   QList<int> aViewManagerIdList;
 
   // currently, all views are updated
   ViewManagerMapIterator anIter( myViewManagerMap );
   while( anIter.hasNext() )
   { 
-    GraphicsView_ViewManager* aViewManager =
-      dynamic_cast<GraphicsView_ViewManager*>( anIter.next().value().first );
-    if ( !aViewManager )
-      continue;
+    SUIT_ViewManager* aViewManager = anIter.next().value().first;
 
-    int anId = anIter.key();
-    aViewManagerIdList.append( anId );
+    if ( theDisplayer->IsApplicable( aViewManager ) )
+    {
+      int anId = anIter.key();
+      aViewManagerIdList.append( anId );
+    }
   }
 
   QListIterator<int> anIdIter( aViewManagerIdList );
   while( anIdIter.hasNext() )
-    getDisplayer()->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
-}
-
-void HYDROGUI_Module::updateOCCViewer( const bool theIsInit,
-                                       const bool theIsForced,
-                                       const bool theDoFitAll )
-{
-  HYDROGUI_OCCDisplayer* anOCCDisplayer = getOCCDisplayer();
-  if( !anOCCDisplayer )
-    return;
-
-  QList<int> aViewManagerIdList;
-
-  // currently, all views are updated
-  ViewManagerMapIterator anIter( myViewManagerMap );
-  while( anIter.hasNext() )
-  { 
-    OCCViewer_ViewManager* aViewManager =
-      ::qobject_cast<OCCViewer_ViewManager*>( anIter.next().value().first );
-    if ( !aViewManager )
-      continue;
-
-    int anId = anIter.key();
-    aViewManagerIdList.append( anId );
+  {
+    theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
   }
-
-  QListIterator<int> anIdIter( aViewManagerIdList );
-  while( anIdIter.hasNext() )
-    anOCCDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
 }
 
 void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
@@ -909,6 +1180,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
   {
     SUIT_Selector* aSelector = *anIter;
     if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
+                       !dynamic_cast<SVTK_Selector*>( aSelector ) &&
                        !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
       aSelector->setEnabled( false );
   }
@@ -971,3 +1243,29 @@ void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
     aSelectionMgr->setSelected( aList );
   }
 }
+
+void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
+{
+  OCCViewer_ViewWindow* anOCCViewWindow = 
+    dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
+  if ( !anOCCViewWindow ) {
+    return;
+  }
+
+  // Get the selected point coordinates
+  OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
+  if ( !aViewPort ) {
+    return;
+  }
+
+  gp_Pnt aPnt = GEOMUtils::ConvertClickToPoint( theEvent->x(), theEvent->y(), 
+                                                aViewPort->getView() );
+
+  // Show the coordinates in the status bar
+  SUIT_Desktop* aDesktop = getApp()->desktop();
+  if ( aDesktop && aDesktop->statusBar() ) {
+    QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
+    QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
+    aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+  }
+}
\ No newline at end of file