Salome HOME
code revision
authorasl <asl@opencascade.com>
Fri, 23 Oct 2015 15:34:14 +0000 (18:34 +0300)
committerasl <asl@opencascade.com>
Fri, 23 Oct 2015 15:34:14 +0000 (18:34 +0300)
src/HYDROData/HYDROData_LandCoverMap.cxx

index d77a212dd76d0da9064d63c333375ca4bdcda5a8..7c619b90632774519a7ff2900426d672931ec18d 100644 (file)
@@ -710,29 +710,38 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
 */
 void HYDROData_LandCoverMap::StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& theMap )
 {
-  TopoDS_Shell aShell;
-  BRep_Builder aShellBuilder;
-  aShellBuilder.MakeShell( aShell );
-  aShell.Closed( Standard_False );
   TopTools_ListOfShape aListOfFaces;
 
   int n = theMap.Size();
+
   Handle( TDataStd_ExtStringArray ) aTypes = 
     TDataStd_ExtStringArray::Set( myLab.FindChild( DataTag_Types ), 0, n-1, Standard_True );
+
   HYDROData_MapOfFaceToStricklerType::Iterator aNFIt( theMap );
   for( int i=0; aNFIt.More(); aNFIt.Next(), i++ )
   {
     TopoDS_Face aFace = aNFIt.Key();
-    if (aFace.IsNull())
+    if( aFace.IsNull() )
       continue;
     QString aType = aNFIt.Value();
-    aShellBuilder.Add( aShell, aFace );
     aListOfFaces.Append(aFace);
     aTypes->SetValue( i, HYDROData_Tool::toExtString( aType ) );
   }
-  TopoDS_Shape aMF = MergeFaces(aListOfFaces, false);
 
-  SetShape( aListOfFaces.Extent() < 2 ? aShell : MergeFaces(aListOfFaces, false));
+  TopoDS_Shape aResult;
+  if( aListOfFaces.Extent() == 1 )
+  {
+    TopoDS_Shell aShell;
+    BRep_Builder aShellBuilder;
+    aShellBuilder.MakeShell( aShell );
+    aShell.Closed( Standard_False );
+    aShellBuilder.Add( aShell, aListOfFaces.First() );
+    aResult = aShell;
+  }
+  else if( aListOfFaces.Extent() > 1 )
+    aResult = MergeFaces( aListOfFaces, false );
+
+  SetShape( aResult );
 }
 
 /**