+
+ BOPAlgo_PaveFiller aPF;
+ aPF.SetArguments( aLC );
+ aPF.SetRunParallel( Standard_False );
+ aPF.SetFuzzyValue( theTolerance );
+
+ aPF.Perform();
+ anError = aPF.ErrorStatus();
+ if( anError )
+ return TopoDS_Shape();
+
+ BOPAlgo_Builder anAlgo;
+ anIt.Initialize( theFaces );
+ for( ; anIt.More(); anIt.Next() )
+ anAlgo.AddArgument( anIt.Value() );
+
+ anAlgo.PerformWithFiller( aPF );
+ anError = anAlgo.ErrorStatus();
+ if( anError )
+ return TopoDS_Shape();
+
+ const TopoDS_Shape& aMergedShape = anAlgo.Shape();
+
+ BRep_Builder aBuilder;
+ TopoDS_Shell aShell;
+ aBuilder.MakeShell( aShell );
+ aShell.Closed( Standard_False );
+ TopExp_Explorer anExplorer( aMergedShape, TopAbs_FACE );
+ for( ; anExplorer.More(); anExplorer.Next() )
+ {
+ const TopoDS_Face& aFace = TopoDS::Face(anExplorer.Current());
+ if( aFace.IsNull() )
+ continue;
+ if( aFace.ShapeType() == TopAbs_FACE )
+ {
+ aBuilder.Add( aShell, aFace );
+ aShell.Closed( Standard_False );
+ }
+ }
+
+ TopoDS_Shape aResult;
+ if( IsToUnify )
+ {
+ ShapeUpgrade_UnifySameDomain aUSD;
+ aUSD.Initialize( aShell );
+ aUSD.Build();
+ aResult = aUSD.Shape();
+ }
+ else
+ aResult = aShell;
+
+ anExplorer.Init( aResult, TopAbs_FACE );
+ int n = 0;
+ TopoDS_Face anOneFace;
+ for( ; anExplorer.More(); anExplorer.Next(), n++ )
+ anOneFace = TopoDS::Face( anExplorer.Current() );
+
+ if (n == 1)
+ aResult = anOneFace;
+ else if (aResult.ShapeType() == TopAbs_SHELL)
+ {
+ BRepCheck_Shell aBCS(TopoDS::Shell(aResult));
+ if (aBCS.Status().First() != BRepCheck_NoError)
+ {
+ ShapeFix_Shell aFixer;
+ aFixer.FixFaceOrientation(TopoDS::Shell(aResult), 1);
+ aResult = aFixer.Shape();
+ }
+ }
+
+ return aResult;
+}
+
+/**
+ Change Strickler type for the list of faces to the given one
+ @param theFaces the faces to change type
+ @param theType the Strickler type for the given land cover(s)
+ @return if the change type operation is successful
+*/
+bool HYDROData_LandCoverMap::ChangeType( const TopTools_ListOfShape& theFaces, const QString& theType )
+{
+ HYDROData_MapOfFaceToStricklerType aFacesToChangeType;
+ TopTools_ListIteratorOfListOfShape aFIt( theFaces );
+ for( ; aFIt.More(); aFIt.Next() )
+ {
+ TopoDS_Shape aShape = aFIt.Value();
+ if( aShape.ShapeType()==TopAbs_FACE )
+ aFacesToChangeType.Add( TopoDS::Face( aShape ), "" );
+ }
+
+ int aNbChanges = 0;
+ Explorer anIt( *this );
+ for( ; anIt.More(); anIt.Next() )
+ if( aFacesToChangeType.Contains( anIt.Face() ) )
+ {
+ anIt.SetStricklerType( theType );
+ aNbChanges++;
+ }
+ if ( aNbChanges != theFaces.Extent() )
+ return false;
+
+ return true;
+}
+
+/**
+ Get the shape of the land cover map
+*/
+TopoDS_Shape HYDROData_LandCoverMap::GetShape() const
+{
+ return HYDROData_Entity::GetShape( DataTag_Shape );
+}
+
+/**
+ Get Strickler type of the given land cover
+ @param theLandCover the land cover to get Strickler type of
+ @return name of Strickler type
+*/
+QString HYDROData_LandCoverMap::StricklerType( const TopoDS_Face& theLandCover ) const
+{
+ QString aType = "";
+
+ Explorer anIt( *this );
+ for( ; anIt.More(); anIt.Next() )
+ if( anIt.Face().IsEqual( theLandCover) )
+ {
+ aType = anIt.StricklerType();
+ break;
+ }
+
+ return aType;