From ea24c0c5ef94a08fff17e9d2cde931250bc0677e Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 23 Oct 2015 18:34:14 +0300 Subject: [PATCH] code revision --- src/HYDROData/HYDROData_LandCoverMap.cxx | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index d77a212d..7c619b90 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -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 ); } /** -- 2.39.2