]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge branch 'BR_v14_rc' of ssh://git.salome-platform.org/modules/hydro into BR_v14_rc
authorasl <asl@opencascade.com>
Mon, 29 Jun 2015 13:29:17 +0000 (16:29 +0300)
committerasl <asl@opencascade.com>
Mon, 29 Jun 2015 13:29:17 +0000 (16:29 +0300)
1  2 
src/HYDROData/HYDROData_PolylineOperator.cxx

index 73d79c9883ba99ea05d1498090a444ebbe8ba32d,f95789d6f5bcd981f9ff98df66abc1c390558189..ed7a4a93fe558a958bbe7a5d2476eb3540fd11ce
@@@ -417,6 -417,24 +417,24 @@@ static void CollectCurveWire
    }
  }
  
+ static void CollectCurveWire(
+   const NCollection_Vector<TopoDS_Edge>& theEdges1,
+   const NCollection_Vector<TopoDS_Edge>& theEdges2,
+   TopoDS_Wire& theWire)
+ {
+   BRep_Builder aBulder;
+   aBulder.MakeWire(theWire);
+   const NCollection_Vector<TopoDS_Edge>* aEdges[] = {&theEdges1, &theEdges2};
+   for (Standard_Integer aEI = 0; aEI < 2; ++aEI)
+   {
+     NCollection_Vector<TopoDS_Edge>::Iterator aEIt(*aEdges[aEI]);
+     for (; aEIt.More(); aEIt.Next())
+     {
+       aBulder.Add(theWire, aEIt.Value());
+     }
+   }
+ }
  std::vector<TopoDS_Shape> HYDROData_PolylineOperator::Split( const TopoDS_Wire& theWire,
                                                               const gp_Pnt2d& thePoint,
                                                               double theTolerance )
    NCollection_Vector<TopoDS_Edge> aEdges1, aEdges2;
    SplitCurveByPoint(aEdges, aSEI, aSParam, aEdges1, aEdges2);
    TopoDS_Wire aWire;
-   CollectCurveWire(aEdges1, aWire);
-   aResult.push_back(aWire);
-   if (!aEdges2.IsEmpty())
+   if (!isClosed)
    {
-     CollectCurveWire(aEdges2, aWire);
-     aResult.push_back(aWire);
+     CollectCurveWire(aEdges1, aWire);
+     if (!aEdges2.IsEmpty())
+     {
+       aResult.push_back(aWire);
+       CollectCurveWire(aEdges2, aWire);
+     }
    }
+   else
+   {
+     CollectCurveWire(aEdges2, aEdges1, aWire);
+   }
+   aResult.push_back(aWire);
    return aResult;
  }
  
@@@ -487,7 -511,6 +511,7 @@@ bool HYDROData_PolylineOperator::Create
      return false;
  
    int n = theShapes.size();
 +  int anIndex = 1;
    for( int i=0; i<n; i++ )
    {
      Handle( HYDROData_PolylineXY ) aPolyline = 
        return false;
  
      aPolyline->SetShape( theShapes[i] );
 -    //TODO: set name
 +
 +    if( isUseIndices )
 +    {
 +      QString aNewName = theNamePrefix + "_" + QString::number( anIndex );
 +      if( theDoc->FindObjectByName( aNewName ).IsNull() )  // the object with such a name is not found
 +        aPolyline->SetName( aNewName );
 +      anIndex++;
 +    }
 +    else
 +    {
 +      aPolyline->SetName( theNamePrefix );
 +    }
    }
    return true;
  }