Salome HOME
refs #668: get the complete boundary of the object face as the splitting polyline.
authormkr <mkr@opencascade.com>
Tue, 10 Nov 2015 10:02:17 +0000 (13:02 +0300)
committermkr <mkr@opencascade.com>
Tue, 10 Nov 2015 10:02:17 +0000 (13:02 +0300)
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx

index 5487b6ad255d8e0c459d667e235f5415a53f6e25..e825ebb04d05b24f585b17b882d6b5f65f53743c 100644 (file)
@@ -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
index f3492f17da8de64034bea85198b03f15afbdcf02..d30ab979cd0e41c1fff21b8659727b11b0f3d521 100644 (file)
@@ -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;
index 5e2c0b9e5705d41e573604f35d1cc276ac04dd94..5a4acc553911cd8128c40756841e057457374143 100644 (file)
@@ -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<TopoDS_Shape> aBoundShapes;
+      QStringList aBoundNames;
+      aFace->GetBoundaries( aBoundShapes, aBoundNames );
+
+      for( int i=0, n=aBoundShapes.size(); i<n; i++ )
+      {
+        TopoDS_Shape aShape = aBoundShapes[i];
+        if( aShape.IsNull() )
+          continue;
+
+        bool aSplitResult = aLandCoverMapObj->Split( aShape );
+        aLandCoverSplitted = ( i==0 ? aSplitResult : aLandCoverSplitted && aSplitResult );
+      }
     }
     if ( !aLandCoverSplitted )
     {