Salome HOME
6.12.2013.Fix of HasIntersection method.
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index 9d556eca30d79ac37b94d87906e76dcfd85d7ef8..9d6b58f460957305786c6056ca4d85439d3c886c 100644 (file)
@@ -132,12 +132,21 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() const
 {
   HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
-  aResSeq.Append( GetRegions() );
+
+  Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
+  if ( !aBoundaryPolyline.IsNull() )
+    aResSeq.Append( aBoundaryPolyline );
+
+  HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions();
+  aResSeq.Append( aSeqOfRegions );
+
   return aResSeq;
 }
 
-void HYDROData_CalculationCase::SplitGeometryObjects()
+void HYDROData_CalculationCase::Update()
 {
+  HYDROData_Entity::Update();
+
   // At first we remove previously created regions
   RemoveRegions();
 
@@ -191,9 +200,6 @@ void HYDROData_CalculationCase::SplitGeometryObjects()
       aRegionZone->AddGeometryObject( aRefObject );
     }
   }
-
-  // The splitted data is up to date
-  SetToUpdate( false );
 }
 
 bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
@@ -423,29 +429,32 @@ TopoDS_Shell HYDROData_CalculationCase::GetShell()
   aSewing.Perform();
   TopoDS_Shape aSewedShape = aSewing.SewedShape();
 
-  if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) {
-    // create shell from one face
-    BRep_Builder aBuilder;
-    aBuilder.MakeShell( aShell );
-    aBuilder.Add( aShell, aSewedShape);
-  } else {
-    TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL );
-    Standard_Integer aNbOfShells = 0;
-    for ( ; anExpShells.More(); anExpShells.Next() ) {
-      aShell = TopoDS::Shell( anExpShells.Current() );
-      aNbOfShells++;
-    }
-
-    if ( aNbOfShells != 1 ) {
-      aShell.Nullify();
+  if ( !aSewedShape.IsNull() )
+  {
+    if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) {
+      // create shell from one face
       BRep_Builder aBuilder;
       aBuilder.MakeShell( aShell );
+      aBuilder.Add( aShell, aSewedShape);
+    } else {
+      TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL );
+      Standard_Integer aNbOfShells = 0;
+      for ( ; anExpShells.More(); anExpShells.Next() ) {
+        aShell = TopoDS::Shell( anExpShells.Current() );
+        aNbOfShells++;
+      }
 
-      TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE );
-      for ( ; anExpFaces.More(); anExpFaces.Next() ) {
-        TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() );
-        if ( !aFace.IsNull() ) {
-          aBuilder.Add( aShell, aFace );
+      if ( aNbOfShells != 1 ) {
+        aShell.Nullify();
+        BRep_Builder aBuilder;
+        aBuilder.MakeShell( aShell );
+
+        TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE );
+        for ( ; anExpFaces.More(); anExpFaces.Next() ) {
+          TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() );
+          if ( !aFace.IsNull() ) {
+            aBuilder.Add( aShell, aFace );
+          }
         }
       }
     }