]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Bugs 113, 114: if the immersible zone is a compound of faces - create split data...
authormzn <mzn@opencascade.com>
Fri, 22 Nov 2013 07:34:41 +0000 (07:34 +0000)
committermzn <mzn@opencascade.com>
Fri, 22 Nov 2013 07:34:41 +0000 (07:34 +0000)
src/HYDROData/HYDROData_ImmersibleZone.cxx
src/HYDROData/HYDROData_SplitToZonesTool.cxx

index 05a468239cb007a32774d55c2f1cb83ba5eb5df1..c31dac1161c812757e326e82a4bd5052674bcc0b 100644 (file)
@@ -83,8 +83,8 @@ TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
     TopoDS_Shape aPolylineShape = aPolyline->GetTopShape();
     TopTools_ListOfShape aWiresList;
 
-    TopExp_Explorer anExp( aPolylineShape, TopAbs_WIRE );
-    if ( !anExp.More() ) {
+    if ( !aPolylineShape.IsNull() && 
+         aPolylineShape.ShapeType() == TopAbs_WIRE ) {
       TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape );
       if ( !aPolylineWire.IsNull() ) {
         BRepBuilderAPI_MakeFace aMakeFace( aPolylineWire, Standard_True );
@@ -94,6 +94,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::GetTopShape() const
         }
       }
     } else {
+      TopExp_Explorer anExp( aPolylineShape, TopAbs_WIRE );
       for ( ; anExp.More(); anExp.Next() ) {
         TopoDS_Wire aWire = TopoDS::Wire( anExp.Current() );
         aWiresList.Append( aWire );
index 2e29c18eef76aca72dcf33a0cdbfb00f9743dc42..24e53396744d51f6a70987aa41ebf1689d1946fc 100644 (file)
@@ -48,8 +48,21 @@ HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& the
       Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) );
     if( !aGeomObj.IsNull() )
     {
-      SplitData aSplitData( aGeomObj->GetTopShape(), aGeomObj->GetName() );
-      anInputSplitDataList.append( aSplitData );
+      TopoDS_Shape aShape = aGeomObj->GetTopShape();
+      if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND ) {
+        // Create split data for each face contained in the compound
+        TopExp_Explorer anExp( aShape, TopAbs_FACE );
+        for ( ; anExp.More(); anExp.Next() ) {
+          TopoDS_Face aFace = TopoDS::Face( anExp.Current() );
+          if ( !aFace.IsNull() ) {
+            SplitData aSplitData( aFace, aGeomObj->GetName() );
+            anInputSplitDataList.append( aSplitData );
+          }
+        }
+      } else {
+        SplitData aSplitData( aShape, aGeomObj->GetName() );
+        anInputSplitDataList.append( aSplitData );
+      }
     }
   }