]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Fix for the bug: Showing objects in VTK: Problem with immersible zone.
authorrkv <rkv@opencascade.com>
Tue, 24 Dec 2013 11:06:09 +0000 (11:06 +0000)
committerrkv <rkv@opencascade.com>
Tue, 24 Dec 2013 11:06:09 +0000 (11:06 +0000)
src/HYDROGUI/HYDROGUI_Actor.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx

index 9b27a1fdd5e52a66b21916cab6591a038b78c2ae..d42756802b60ea25aceb4490b2b8a7c53f8f6ae7 100644 (file)
@@ -17,6 +17,7 @@ HYDROGUI_Actor::HYDROGUI_Actor()
   myOneFaceEdgeActor->GetDeviceActor()->SetMapper( myOneFaceEdgeActor->GetDeviceActor()->GetMapper() );
   mySharedEdgeActor->GetDeviceActor()->SetMapper( mySharedEdgeActor->GetDeviceActor()->GetMapper() );
   myWireframeFaceActor->GetDeviceActor()->SetMapper( myWireframeFaceActor->GetDeviceActor()->GetMapper() );
+  myShadingFaceActor->SetInput(myShadingFaceSource->GetOutputPort(),false); 
   myShadingFaceActor->GetDeviceActor()->SetMapper( myShadingFaceActor->GetDeviceActor()->GetMapper() );
   GEOM_Actor::myHighlightActor->GetDeviceActor()->SetMapper( GEOM_Actor::myHighlightActor->GetDeviceActor()->GetMapper() );
 } 
@@ -69,5 +70,11 @@ void HYDROGUI_Actor::SetShape( const TopoDS_Shape& theShape,
     myWireframeFaceActor->GetDeviceActor()->SetInfinitive( true );
 
   if( myShadingFaceSource->IsEmpty() )
+  {
     myShadingFaceActor->GetDeviceActor()->SetInfinitive( true );
+  }
+  else
+  {
+    myShadingFaceSource->Update();
+  }
 }
index 1d24042baf71cdccd3ae5103484cd06cb2b0a4a9..d49d503a0c1115d265b5fcd065cc0a0158a31334 100644 (file)
@@ -82,7 +82,9 @@
 
 #include <SVTK_ViewManager.h>
 #include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
 #include <SVTK_Selector.h>
+#include <SVTK_RenderWindowInteractor.h>
 
 #include <OCCViewer_ViewPort3d.h>
 
@@ -1148,6 +1150,16 @@ bool HYDROGUI_Module::eventFilter( QObject* theObj, QEvent* theEvent )
       }
     }
   }
+  else if ( theObj->inherits( "SVTK_ViewWindow" ) )
+  {
+    if( aType == QEvent::Leave )
+    {
+      SUIT_Desktop* aDesktop = getApp()->desktop();
+      if ( aDesktop && aDesktop->statusBar() ) {
+        aDesktop->statusBar()->clearMessage();
+      }
+    }
+  }
 
   return LightApp_Module::eventFilter( theObj, theEvent );
 }
@@ -1168,6 +1180,13 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
     connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
              this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
   }
+  else if( theViewManager->getType() == SVTK_Viewer::Type() )
+  {
+    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
 
@@ -1235,6 +1254,13 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
       }
     }
   }
+  else if( theViewWindow && theViewWindow->inherits( "SVTK_ViewWindow" ) )
+  {
+    if( SVTK_ViewWindow* aViewFrame = dynamic_cast<SVTK_ViewWindow*>( theViewWindow ) )
+    {
+      aViewFrame->installEventFilter( this );
+    }
+  }
 }
 
 void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent )
@@ -1402,23 +1428,45 @@ void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent*
 {
   OCCViewer_ViewWindow* anOCCViewWindow = 
     dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
-  if ( !anOCCViewWindow ) {
-    return;
-  }
-
-  // Get the selected point coordinates
-  OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
-  if ( !aViewPort ) {
-    return;
-  }
+  if ( anOCCViewWindow ) {
+    // Get the selected point coordinates
+    OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
+    if ( !aViewPort ) {
+      return;
+    }
 
-  gp_Pnt aPnt = CurveCreator_Utils::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 ) );
+    gp_Pnt aPnt = CurveCreator_Utils::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 ) );
+    }
+  } 
+  else
+  {
+    SVTK_ViewWindow* aViewWindow = 
+      dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
+    if ( aViewWindow ) {
+      // Get the selected point coordinates
+      double aCoords[3];
+      SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+      if ( anInteractor )
+      {
+        //TODO: Use a WorldPicker to get current coords
+        //anInteractorStyle->ComputeDisplayToWorld( theEvent->x(), theEvent->y(), 0, aCoords );
+        aCoords[0] = theEvent->x();
+        aCoords[1] = theEvent->y();
+        // Show the coordinates in the status bar
+        SUIT_Desktop* aDesktop = getApp()->desktop();
+        if ( aDesktop && aDesktop->statusBar() ) {
+          QString aX = HYDROGUI_Tool::GetCoordinateString( aCoords[0] );
+          QString anY = HYDROGUI_Tool::GetCoordinateString( aCoords[1] );
+          aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+        }
+      }
+    } 
   }
 }
\ No newline at end of file
index 168fd3ad2bce46bb4abe0398a77e0d5634b0d09e..4d7bd19e177998e1217192e5bc8218a3517a9e80 100644 (file)
@@ -300,7 +300,7 @@ void HYDROGUI_VTKPrsShape::setFaces( const TopoDS_Compound& theWires,
   }
 
   myTopoShape = aCompound;
-  myDisplayMode = GEOM_Actor::eShading;
+  //myDisplayMode = GEOM_Actor::eShading;
 }
 
 void HYDROGUI_VTKPrsShape::setFace( const TopoDS_Wire& theWire,
@@ -321,7 +321,7 @@ void HYDROGUI_VTKPrsShape::setFace( const TopoDS_Face& theFace,
                                     const bool         theIsUpdateViewer )
 {
   myTopoShape = theFace;
-  myDisplayMode = GEOM_Actor::eShading;
+  //myDisplayMode = GEOM_Actor::eShading;
 }
 
 void HYDROGUI_VTKPrsShape::setShape( const TopoDS_Shape& theShape,
@@ -329,5 +329,5 @@ void HYDROGUI_VTKPrsShape::setShape( const TopoDS_Shape& theShape,
                                      const bool          theIsUpdateViewer )
 {
   myTopoShape = theShape;
-  myDisplayMode = GEOM_Actor::eShading;
+  //myDisplayMode = GEOM_Actor::eShading;
 }