Salome HOME
merge BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineOperator.cxx
index c8bc099f76d36f74f36574a11ef2743d82072f3b..3a4183e8db3fd7b46fa85cdff3508f6b64225d73 100644 (file)
@@ -87,7 +87,8 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD
 bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
               const Handle( HYDROData_PolylineXY )& thePolyline,
               const Handle( HYDROData_PolylineXY )& theTool,
-              double theTolerance ) const
+              double theTolerance,
+              bool& theIsIntersected) const
 {
   if (thePolyline.IsNull() || theTool.IsNull())
   {
@@ -96,7 +97,7 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD
 
   HYDROData_SequenceOfObjects aSeq;
   aSeq.Append( theTool );
-  return split( theDoc, thePolyline, aSeq, theTolerance, -1 );
+  return split( theDoc, thePolyline, aSeq, theTolerance, -1, theIsIntersected);
 }
 
 bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
@@ -107,7 +108,8 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD
   for( int i=f; i<=l; i++ )
   {
     Handle( HYDROData_PolylineXY ) aPolyline = Handle( HYDROData_PolylineXY )::DownCast( thePolylines.Value( i ) );
-    if( !split( theDoc, aPolyline, thePolylines, theTolerance, i ) )
+    bool isIntersected;
+    if( !split( theDoc, aPolyline, thePolylines, theTolerance, i, isIntersected) )
       return false;
   }
   return true;
@@ -163,8 +165,11 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
                                         const Handle( HYDROData_PolylineXY )& thePolyline,
                                         const HYDROData_SequenceOfObjects& theTools,
                                         double theTolerance,
-                                        int theIgnoreIndex ) const
+                                        int theIgnoreIndex,
+                                        bool& theIsIntersected) const
 {
+  theIsIntersected = false;
+
   if (thePolyline.IsNull())
   {
     return false;
@@ -209,7 +214,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
     }
 
     std::deque<HYDROData_TopoCurve> aSplittedCurves;
-    aCurve.Cut(aParams, aSplittedCurves);
+    theIsIntersected |= aCurve.Cut(aParams, aSplittedCurves);
     std::deque<HYDROData_TopoCurve>::const_iterator aCIt =
       aSplittedCurves.begin();
     std::deque<HYDROData_TopoCurve>::const_iterator aLastCIt =