From: abk Date: Fri, 10 Jul 2015 17:35:04 +0000 (+0300) Subject: refs #625: Fatal error as result of show split polyline X-Git-Tag: BR_quadtree_20150925~2^2~4^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=479a1e10b43dc61aeb07a26d055804363d2c0fef;p=modules%2Fhydro.git refs #625: Fatal error as result of show split polyline The reasons of the error - the incorrect cuttings of a topological curve by parameters and a parameter - were corrected. --- diff --git a/src/HYDROData/HYDROData_TopoCurve.cxx b/src/HYDROData/HYDROData_TopoCurve.cxx index 86c0cf82..abe49f37 100644 --- a/src/HYDROData/HYDROData_TopoCurve.cxx +++ b/src/HYDROData/HYDROData_TopoCurve.cxx @@ -498,6 +498,7 @@ void HYDROData_TopoCurve::Cut( { aParamI ^= 1; } + const bool isClosed = IsClosed(); if (aParamI < 0) { aEdge.Orientation(TopAbs_FORWARD); @@ -530,16 +531,21 @@ void HYDROData_TopoCurve::Cut( InsertAfter(aEIt, aEParts[1 - aFirstPI], myEdges); ++aEIt; } - else if (aParamI > 0) + else { - ++aEIt; + TopoDS_Edge aNewEdge = ReplaceVertex(aEdge, (aParamI == 0) ? false : true); + *aEIt = aNewEdge; + if (aParamI > 0) + { + ++aEIt; + } } // Calculate the curve parts. std::list::iterator aLastEIt = myEdges.end(); if (aEIt != aFirstEIt && aEIt != aLastEIt) { - std::list* aEdges = !IsClosed() ? &theCurve.myEdges : &myEdges; + std::list* aEdges = !isClosed ? &theCurve.myEdges : &myEdges; aEdges->splice(aEdges->begin(), myEdges, aEIt, aLastEIt); } } @@ -569,7 +575,16 @@ void HYDROData_TopoCurve::Cut( for (std::deque >::const_iterator aLastPLIt = theParameters.end(); aPLIt != aLastPLIt; ++aPLIt) { - const int aSize = aCurves[aCI].myEdges.size(); + TopoDS_Edge aNextEdge; + { + std::list::iterator aNextEIt = aEIt; + ++aNextEIt; + if (aNextEIt != aCurves[aCI].myEdges.end()) + { + aNextEdge = *aNextEIt; + } + } + for (Iterator, std::list::const_iterator> aPIt( *aPLIt, (aEIt->Orientation() != TopAbs_REVERSED)); aPIt.More(); ++aPIt) { @@ -587,7 +602,8 @@ void HYDROData_TopoCurve::Cut( aEIt = aCurves[aCI].myEdges.begin(); } } - if (aCurves[aCI].myEdges.size() == aSize) + + if (!aNextEdge.IsNull() && !aEIt->IsEqual(aNextEdge)) { ++aEIt; }