From: mkr Date: Tue, 10 Nov 2015 10:02:17 +0000 (+0300) Subject: refs #668: get the complete boundary of the object face as the splitting polyline. X-Git-Tag: v1.5~57 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=91082325de4efeb4cc61175015c9e9f01ecb44ba;p=modules%2Fhydro.git refs #668: get the complete boundary of the object face as the splitting polyline. --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 5487b6ad..e825ebb0 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -508,9 +508,21 @@ bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_PolylineXY )& thePol return false; TopoDS_Shape aShape = thePolyline->GetShape(); - return LocalPartition( aShape, "" ); + return Split( aShape ); } + +/** + Split the land cover map by the given polyline + @param theShape the tool polyline to split the land cover map + @return if the removing is successful +*/ +bool HYDROData_LandCoverMap::Split( const TopoDS_Shape& theShape ) +{ + return LocalPartition( theShape, "" ); +} + + /** Merge the given faces in the land cover @param theFaces the faces to merge in the land cover map diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index f3492f17..d30ab979 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -105,6 +105,7 @@ public: HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& ); HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& ); + HYDRODATA_EXPORT bool Split( const TopoDS_Shape& ); HYDRODATA_EXPORT bool Merge( const TopTools_ListOfShape&, const QString& theType ); HYDRODATA_EXPORT TopoDS_Face FindByPoint( const gp_Pnt2d&, QString& theType ) const; diff --git a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx index 5e2c0b9e..5a4acc55 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx @@ -250,10 +250,20 @@ bool HYDROGUI_LandCoverMapOp::processApply( int& theUpdateFlags, aLandCoverSplitted = aLandCoverMapObj->Split( aPolyline ); else if ( !aFace.IsNull() ) { - // TODO: - //Get the complete boundary of the object face as the splitting polyline - Handle(HYDROData_PolylineXY) aBoundaryPolyline; - aLandCoverSplitted = aLandCoverMapObj->Split( aBoundaryPolyline ); + // Get the complete boundary of the object face as the splitting polyline + QList aBoundShapes; + QStringList aBoundNames; + aFace->GetBoundaries( aBoundShapes, aBoundNames ); + + for( int i=0, n=aBoundShapes.size(); iSplit( aShape ); + aLandCoverSplitted = ( i==0 ? aSplitResult : aLandCoverSplitted && aSplitResult ); + } } if ( !aLandCoverSplitted ) {