Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_VTKPrsShape.cxx
index c1a20685c7c094d8a0af5bf2e0d06d90e54adb07..ce016a554b6431e2f86fe9023f88072a3810dc6d 100644 (file)
@@ -1,12 +1,8 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,6 +24,7 @@
 #include <HYDROData_DummyObject3D.h>
 #include <HYDROData_Image.h>
 #include <HYDROData_ImmersibleZone.h>
+#include <HYDROData_BCPolygon.h>
 #include <HYDROData_Obstacle.h>
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_Polyline3D.h>
@@ -88,22 +85,18 @@ HYDROGUI_VTKPrsShape::~HYDROGUI_VTKPrsShape()
 //================================================================
 void HYDROGUI_VTKPrsShape::compute()
 {
+  HYDROGUI_VTKPrs::compute();
+
   if ( !getObject().IsNull() )
   {
     buildShape();
 
     if ( !myTopoShape.IsNull() )
     {
-      HYDROGUI_Actor* anActor = HYDROGUI_Actor::New();
+      HYDROGUI_Actor* anActor = getActor<HYDROGUI_Actor>(this);
       anActor->SetShape( myTopoShape, VTK_MIN_DEFLECTION );
       anActor->setDisplayMode( myDisplayMode );
       anActor->setIO( getIO() );
-      AddObject( anActor );
-
-      //double bounds[6];
-      //anActor->GetBounds( bounds );
-
-      anActor->Delete();
     }
   }
 }
@@ -155,7 +148,7 @@ void HYDROGUI_VTKPrsShape::buildShape()
         }
       }
 
-      QColor aWireColor = aPolyline->GetWireColor();
+      //QColor aWireColor = aPolyline->GetWireColor();
       //setBorderColor( aWireColor, false, false );
     }
     else if ( anObject->IsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) )
@@ -194,14 +187,13 @@ void HYDROGUI_VTKPrsShape::buildShape()
       else
       {
         // Generate the filling color for zone
-        QStringList aGeomObjectsNames;
+        QStringList anObjectsNames;
 
-        HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
+        HYDROData_SequenceOfObjects aRefObjects = aZone->GetObjects();
         HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
         for ( ; anIter.More(); anIter.Next() )
         {
-          Handle(HYDROData_Object) aRefbject = 
-            Handle(HYDROData_Object)::DownCast( anIter.Value() );
+          Handle(HYDROData_Entity) aRefbject = anIter.Value();
           if ( aRefbject.IsNull() )
             continue;
 
@@ -209,7 +201,7 @@ void HYDROGUI_VTKPrsShape::buildShape()
           if ( aRefObjectName.isEmpty() )
             continue;
 
-          aGeomObjectsNames.append( aRefObjectName );
+          anObjectsNames.append( aRefObjectName );
         }
 
         //setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
@@ -270,6 +262,29 @@ void HYDROGUI_VTKPrsShape::buildShape()
       //setFillingColor( aFillingColor, false, false );
       //setBorderColor( aBorderColor, false, false );
     }
+    else if ( anObject->IsKind( STANDARD_TYPE(HYDROData_BCPolygon) ) )
+    {
+      Handle(HYDROData_BCPolygon) aBCObj =
+        Handle(HYDROData_BCPolygon)::DownCast( anObject );
+
+      TopoDS_Shape aBCShape = aBCObj->GetTopShape();
+      if ( !aBCShape.IsNull() ) 
+      {
+        if ( aBCShape.ShapeType() == TopAbs_FACE )
+        {
+          TopoDS_Face aFace = TopoDS::Face( aBCShape );
+          setFace( aFace, false, false );
+        }
+        else 
+        {
+          myTopoShape = aBCShape;
+        }
+      }
+
+      QColor aFillingColor = aBCObj->GetFillingColor();
+      QColor aBorderColor = aBCObj->GetBorderColor();
+    }
   }
 }
 
@@ -304,7 +319,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,
@@ -325,7 +340,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,
@@ -333,5 +348,5 @@ void HYDROGUI_VTKPrsShape::setShape( const TopoDS_Shape& theShape,
                                      const bool          theIsUpdateViewer )
 {
   myTopoShape = theShape;
-  myDisplayMode = GEOM_Actor::eShading;
+  //myDisplayMode = GEOM_Actor::eShading;
 }