Salome HOME
code revision
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Shape.cxx
index 339f9453e054787e8a4f54925a84b2563de992f3..f7132b32b5f0092ce14c41e1340d477b9b95c76e 100644 (file)
@@ -31,7 +31,6 @@
 #include <HYDROData_ShapesGroup.h>
 #include <HYDROData_Stream.h>
 #include <HYDROData_Zone.h>
-#include <HYDROData_LandCover.h>
 
 #include <AIS_Shape.hxx>
 #include <BRep_Builder.hxx>
@@ -224,8 +223,8 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
       }
       else
       {
-               // Set the filling color for zone
-               setFillingColor( aZone->GetColor(HYDROData_ImmersibleZone::DefaultFillingColor()) );
+                   // Set the filling color for zone
+        setFillingColor( aZone->GetColor( Qt::darkBlue ) );
       }
     }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Profile) ) )
@@ -300,22 +299,6 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
 
       setShape( aCompound, false, false );  
     }
-    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
-    {
-      Handle(HYDROData_LandCover) aLandCoverObj =
-        Handle(HYDROData_LandCover)::DownCast( myObject );
-
-      TopoDS_Shape aLandCoverShape = aLandCoverObj->GetShape();
-      if ( !aLandCoverShape.IsNull() ) {
-        setShape( aLandCoverShape, false, false );
-      }
-
-      QColor aFillingColor = aLandCoverObj->GetFillingColor();
-      QColor aBorderColor = aLandCoverObj->GetBorderColor();
-
-      setFillingColor( aFillingColor, false, false );
-      setBorderColor( aBorderColor, false, false );
-    }
   }
  
   if ( myShape.IsNull() || !isVisible() )
@@ -462,7 +445,7 @@ QColor HYDROGUI_Shape::getFillingColor() const
 void HYDROGUI_Shape::setBorderColor( const QColor& theColor,
                                      const bool    theToDisplay,
                                      const bool    theIsUpdateViewer )
-{
+{ 
   myBorderColor = theColor;
   updateShape( theToDisplay, theIsUpdateViewer );
 }
@@ -494,11 +477,22 @@ void HYDROGUI_Shape::setZLayer( const int theZLayer )
 
 Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
 {
-  if( myTopoShape.IsNull() )
+  if( myTopoShape.IsNull() ) {
     return Handle_AIS_InteractiveObject();
-  
+  }
+
   TopAbs_ShapeEnum aShapeType = myTopoShape.ShapeType();
-  if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE ) {
+  bool IsWireEdgeCompound = aShapeType==TopAbs_COMPOUND;
+  if (IsWireEdgeCompound) {
+    TopoDS_Iterator itr(myTopoShape);
+    while (itr.More() && IsWireEdgeCompound) {
+      if (itr.Value().ShapeType() != TopAbs_WIRE && itr.Value().ShapeType() != TopAbs_EDGE)
+        IsWireEdgeCompound = false;
+      itr.Next();
+    }
+  }
+
+  if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound) {
     return new HYDROGUI_Polyline( myTopoShape );
   } else {
     return new AIS_Shape( myTopoShape );
@@ -605,7 +599,9 @@ void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
   if ( myZLayer >= 0 )
     myContext->SetZLayer( myShape, myZLayer );
 
-  myContext->UpdateCurrentViewer();
+  if ( theIsUpdateViewer ) {
+    myContext->UpdateCurrentViewer();
+  }
 }
 
 QColor HYDROGUI_Shape::getActiveColor() const