From: asl Date: Wed, 14 Oct 2015 09:42:15 +0000 (+0300) Subject: code revision X-Git-Tag: v1.5~124 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=34b88c1f4a51effd3b0646293d689ac8136ed65d;p=modules%2Fhydro.git code revision --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index cc08ba78..2de0498d 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -17,6 +17,7 @@ // #include +#include #include #include @@ -181,8 +182,15 @@ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName ) const */ bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_Object )& theObject, const QString& theType ) { - //TODO - return false; + if( theObject.IsNull() ) + return false; + + TopoDS_Shape aShape = theObject->GetTopShape(); + if( aShape.ShapeType()!=TopAbs_FACE ) + return false; + + TopoDS_Face aFace = TopoDS::Face( aShape ); + return LocalPartition( aFace, theType ); } /** @@ -204,8 +212,24 @@ bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_PolylineXY )& thePolyl */ bool HYDROData_LandCoverMap::Remove( const TopoDS_Face& theFace ) { - //TODO - return false; + TopTools_ListOfShape aList; + aList.Append( theFace ); + return Remove( aList ); +} + +/** + Remove the given faces from land cover map + @param theFacesList the face list to be removed + @return if the removing is successful +*/ +bool HYDROData_LandCoverMap::Remove( const TopTools_ListOfShape& theFacesList ) +{ + TopoDS_Compound aCompound = TopoDS::Compound( GetShape() ); + BRep_Builder aCompoundBuilder; + //TODO: aCompoundBuilder.Remove( aCompound, theFace ); + //TODO: update types + SetShape( aCompound ); + return true; } /** @@ -230,8 +254,15 @@ bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_PolylineXY )& thePol */ bool HYDROData_LandCoverMap::Merge( const TopTools_ListOfShape& theFaces, const QString& theType ) { - //TODO - return false; + // 1. to remove the merged faces from the current map + Remove( theFaces ); + + // 2. to fuse the faces into the new face + // TODO + TopoDS_Face aMergedFace; + + // 3. to add the face into the map + return LocalPartition( aMergedFace, theType ); } /** diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index c9c774d6..0a53e7a1 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -77,6 +77,7 @@ public: bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType ); bool Remove( const TopoDS_Face& ); + bool Remove( const TopTools_ListOfShape& ); bool Split( const Handle( HYDROData_PolylineXY )& ); bool Merge( const TopTools_ListOfShape&, const QString& theType ); diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index 479536ec..f72a456f 100644 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@ -108,7 +108,7 @@ bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName ) generateOne( anOutStream, 1040.079834, -441.303467, 1017.623413, -459.9102175 ); generateOne( anOutStream, 1055.478516, -456.060547, 1034.946899, -475.9505 ); generateOne( anOutStream, 1074.085327, -474.025665, 1058.044922, -493.274017 ); - srand( time( 0 ) ); + srand( 0 ); } aTmpFile.close(); diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 52b58728..360841ac 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -32,7 +32,7 @@ int main( int argc, char* argv[] ) { - srand( time( 0 ) ); + srand( 0 ); QApplication anApp( argc, argv ); SUIT_Session aSession;