From: rkv Date: Mon, 16 Dec 2013 05:42:02 +0000 (+0000) Subject: Feature #229: Showing objects in VTK: Faces are shaded now in the same way as in... X-Git-Tag: BR_hydro_v_0_6~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4120ff72aa360a8d1b74b262a619f63bb84a37ce;p=modules%2Fhydro.git Feature #229: Showing objects in VTK: Faces are shaded now in the same way as in OCC viewer. --- diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx index 7512b0a3..3a841ee3 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx @@ -69,7 +69,8 @@ const double VTK_MIN_DEFLECTION = 0.001; // Purpose : Constructor //======================================================================= HYDROGUI_VTKPrsShape::HYDROGUI_VTKPrsShape( const Handle(HYDROData_Entity)& theObject ) -: HYDROGUI_VTKPrs( theObject ) +: HYDROGUI_VTKPrs( theObject ), +myDisplayMode( GEOM_Actor::eWireframe ) { } @@ -95,6 +96,7 @@ void HYDROGUI_VTKPrsShape::compute() { GEOM_Actor* anActor = GEOM_Actor::New(); anActor->SetShape( myTopoShape, VTK_MIN_DEFLECTION ); + anActor->setDisplayMode( myDisplayMode ); anActor->setIO( getIO() ); AddObject( anActor ); @@ -146,6 +148,7 @@ void HYDROGUI_VTKPrsShape::buildShape() setWire( aPolylineWire, false, false ); } else { myTopoShape = aPolylineShape; + myDisplayMode = GEOM_Actor::eWireframe; } } @@ -165,6 +168,7 @@ void HYDROGUI_VTKPrsShape::buildShape() setWire( aPolylineWire, false, false ); } else { myTopoShape = aPolylineShape; + myDisplayMode = GEOM_Actor::eWireframe; } } @@ -267,15 +271,16 @@ void HYDROGUI_VTKPrsShape::buildShape() } void HYDROGUI_VTKPrsShape::setWire( const TopoDS_Wire& theWire, - const bool theToDisplay, - const bool theIsUpdateViewer ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myTopoShape = theWire; + myDisplayMode = GEOM_Actor::eWireframe; } void HYDROGUI_VTKPrsShape::setFaces( const TopoDS_Compound& theWires, - const bool theToDisplay, - const bool theIsUpdateViewer ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { TopExp_Explorer anExp( theWires, TopAbs_WIRE ); TopoDS_Compound aCompound; @@ -296,11 +301,12 @@ void HYDROGUI_VTKPrsShape::setFaces( const TopoDS_Compound& theWires, } myTopoShape = aCompound; + myDisplayMode = GEOM_Actor::eShading; } void HYDROGUI_VTKPrsShape::setFace( const TopoDS_Wire& theWire, - const bool theToDisplay, - const bool theIsUpdateViewer ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True ); aFaceBuilder.Build(); @@ -312,15 +318,17 @@ void HYDROGUI_VTKPrsShape::setFace( const TopoDS_Wire& theWire, } void HYDROGUI_VTKPrsShape::setFace( const TopoDS_Face& theFace, - const bool theToDisplay, - const bool theIsUpdateViewer ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myTopoShape = theFace; + myDisplayMode = GEOM_Actor::eShading; } void HYDROGUI_VTKPrsShape::setShape( const TopoDS_Shape& theShape, - const bool theToDisplay, - const bool theIsUpdateViewer ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myTopoShape = theShape; + myDisplayMode = GEOM_Actor::eShading; } diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsShape.h b/src/HYDROGUI/HYDROGUI_VTKPrsShape.h index 54d9e471..5492a1f9 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsShape.h +++ b/src/HYDROGUI/HYDROGUI_VTKPrsShape.h @@ -83,7 +83,8 @@ protected: private: vtkWeakPointer< vtkScalarsToColors > myLookupTable; vtkNew< vtkPolyDataMapper > myMapper; - TopoDS_Shape myTopoShape; + TopoDS_Shape myTopoShape; + int myDisplayMode; }; #endif