Salome HOME
refs #441: crash in digue construction
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_VTKPrsShape.cxx
index 7512b0a39276be343d805dd695e0bd1badebc342..4d7bd19e177998e1217192e5bc8218a3517a9e80 100644 (file)
@@ -55,7 +55,7 @@
 
 #include <Precision.hxx>
 
-#include <GEOM_Actor.h>
+#include <HYDROGUI_Actor.h>
 #include <vtkScalarBarActor.h>
 
 #include <QString>
@@ -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 )
 {
 }
 
@@ -87,18 +88,18 @@ HYDROGUI_VTKPrsShape::~HYDROGUI_VTKPrsShape()
 //================================================================
 void HYDROGUI_VTKPrsShape::compute()
 {
+  HYDROGUI_VTKPrs::compute();
+
   if ( !getObject().IsNull() )
   {
     buildShape();
 
     if ( !myTopoShape.IsNull() )
     {
-      GEOM_Actor* anActor = GEOM_Actor::New();
+      HYDROGUI_Actor* anActor = getActor<HYDROGUI_Actor>(this);
       anActor->SetShape( myTopoShape, VTK_MIN_DEFLECTION );
+      anActor->setDisplayMode( myDisplayMode );
       anActor->setIO( getIO() );
-      AddObject( anActor );
-
-      anActor->Delete();
     }
   }
 }
@@ -146,6 +147,7 @@ void HYDROGUI_VTKPrsShape::buildShape()
           setWire( aPolylineWire, false, false );  
         } else {
           myTopoShape = aPolylineShape;
+          myDisplayMode = GEOM_Actor::eWireframe;
         }
       }
 
@@ -165,6 +167,7 @@ void HYDROGUI_VTKPrsShape::buildShape()
           setWire( aPolylineWire, false, false );  
         } else {
           myTopoShape = aPolylineShape;
+          myDisplayMode = GEOM_Actor::eWireframe;
         }
       }
 
@@ -267,15 +270,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 +300,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 +317,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;
 }