From: rkv Date: Tue, 24 Dec 2013 11:06:09 +0000 (+0000) Subject: Fix for the bug: Showing objects in VTK: Problem with immersible zone. X-Git-Tag: BR_hydro_v_0_7~70 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d02d9b51c2b15b946c9800725b953c5ab6cb93be;p=modules%2Fhydro.git Fix for the bug: Showing objects in VTK: Problem with immersible zone. --- diff --git a/src/HYDROGUI/HYDROGUI_Actor.cxx b/src/HYDROGUI/HYDROGUI_Actor.cxx index 9b27a1fd..d4275680 100644 --- a/src/HYDROGUI/HYDROGUI_Actor.cxx +++ b/src/HYDROGUI/HYDROGUI_Actor.cxx @@ -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(); + } } diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 1d24042b..d49d503a 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -82,7 +82,9 @@ #include #include +#include #include +#include #include @@ -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( 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(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(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 diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx index 168fd3ad..4d7bd19e 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx @@ -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; }