Salome HOME
Feature #86: The hierarchy in the Object Browser (T 19).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImmersibleZoneOp.cxx
index d9b072d483421f393add5bcd93ba418936ed2dd2..ecf6b2836e40ca5ef1e841bbde1ffe0f7c62fef8 100644 (file)
@@ -239,12 +239,16 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName
     return;
 
   TopoDS_Wire aWire;
+  TopoDS_Shape aShape;
 
   Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast(
     HYDROGUI_Tool::FindObjectByName( module(), thePolylineName, KIND_POLYLINE ) );
   if ( !aPolyline.IsNull() )
   {
-    aWire = TopoDS::Wire( aPolyline->GetTopShape() );
+    aShape = aPolyline->GetTopShape();
+    if ( aShape.ShapeType() == TopAbs_WIRE ) {
+      aWire = TopoDS::Wire( aShape );
+    }
   }
 
   LightApp_Application* anApp = module()->getApp();
@@ -274,7 +278,14 @@ void HYDROGUI_ImmersibleZoneOp::onCreatePreview( const QString& thePolylineName
 
   myPreviewPrs->setFillingColor( aFillingColor, false, false );
   myPreviewPrs->setBorderColor( aBorderColor, false, false );
-  myPreviewPrs->setFace( aWire );
+  if ( !aWire.IsNull() ) {
+    myPreviewPrs->setFace( aWire );
+  } else if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND ) {
+    TopoDS_Compound aCompound = TopoDS::Compound( aShape );
+    if ( !aCompound.IsNull() ) {
+      myPreviewPrs->setFaces( aCompound );
+    }
+  }
 }
 
 void HYDROGUI_ImmersibleZoneOp::closePreview()