}
}
+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;
}