*/
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 );
}
/**