Salome HOME
projects
/
modules
/
hydro.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of https://git.salome-platform.org/git/modules/hydro
[modules/hydro.git]
/
src
/
HYDROData
/
HYDROData_TopoCurve.cxx
diff --git
a/src/HYDROData/HYDROData_TopoCurve.cxx
b/src/HYDROData/HYDROData_TopoCurve.cxx
index 449db4c98fa9a81764bcd38ef5a20ecef6ae5b2c..c58da31f3d95520e991c45f20a39c3ccf4aae12e 100644
(file)
--- a/
src/HYDROData/HYDROData_TopoCurve.cxx
+++ b/
src/HYDROData/HYDROData_TopoCurve.cxx
@@
-1,8
+1,4
@@
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015 EDF-R&D
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
@@
-97,7
+93,7
@@
template<typename ItemType> static void InsertAfter(
const ItemType& theValue,
std::list<ItemType>& theList)
{
const ItemType& theValue,
std::list<ItemType>& theList)
{
- std::list<ItemType>::iterator aEIt2 = thePosition;
+
typename
std::list<ItemType>::iterator aEIt2 = thePosition;
if (++aEIt2 != theList.end())
{
theList.insert(aEIt2, theValue);
if (++aEIt2 != theList.end())
{
theList.insert(aEIt2, theValue);
@@
-469,11
+465,13
@@
TopoDS_Wire HYDROData_TopoCurve::Wire() const
return aWire;
}
return aWire;
}
-
void
HYDROData_TopoCurve::Cut(
+
bool
HYDROData_TopoCurve::Cut(
const std::list<TopoDS_Edge>::iterator& theEdgePosition,
const double theParameter,
HYDROData_TopoCurve& theCurve)
{
const std::list<TopoDS_Edge>::iterator& theEdgePosition,
const double theParameter,
HYDROData_TopoCurve& theCurve)
{
+ bool aResult = false;
+
// Locate the edge.
std::list<TopoDS_Edge>::iterator aFirstEIt = myEdges.begin();
std::list<TopoDS_Edge>::iterator aEIt = aFirstEIt;
// Locate the edge.
std::list<TopoDS_Edge>::iterator aFirstEIt = myEdges.begin();
std::list<TopoDS_Edge>::iterator aEIt = aFirstEIt;
@@
-498,6
+496,7
@@
void HYDROData_TopoCurve::Cut(
{
aParamI ^= 1;
}
{
aParamI ^= 1;
}
+ const bool isClosed = IsClosed();
if (aParamI < 0)
{
aEdge.Orientation(TopAbs_FORWARD);
if (aParamI < 0)
{
aEdge.Orientation(TopAbs_FORWARD);
@@
-529,19
+528,41
@@
void HYDROData_TopoCurve::Cut(
*aEIt = aEParts[aFirstPI];
InsertAfter(aEIt, aEParts[1 - aFirstPI], myEdges);
++aEIt;
*aEIt = aEParts[aFirstPI];
InsertAfter(aEIt, aEParts[1 - aFirstPI], myEdges);
++aEIt;
+
+ aResult = true;
}
}
- else
if (aParamI > 0)
+ else
{
{
- ++aEIt;
+ TopoDS_Edge aNewEdge = ReplaceVertex(aEdge, (aParamI == 0) ? false : true);
+ *aEIt = aNewEdge;
+ if (aParamI > 0)
+ {
+ ++aEIt;
+
+ std::list<TopoDS_Edge>::iterator aEdgePosition = theEdgePosition;
+ if (isClosed || ++aEdgePosition != myEdges.end())
+ {
+ aResult = true;
+ }
+ }
+ else
+ {
+ if (isClosed || theEdgePosition != aFirstEIt)
+ {
+ aResult = true;
+ }
+ }
}
// Calculate the curve parts.
std::list<TopoDS_Edge>::iterator aLastEIt = myEdges.end();
if (aEIt != aFirstEIt && aEIt != aLastEIt)
{
}
// Calculate the curve parts.
std::list<TopoDS_Edge>::iterator aLastEIt = myEdges.end();
if (aEIt != aFirstEIt && aEIt != aLastEIt)
{
- std::list<TopoDS_Edge>* aEdges = !
IsClosed()
? &theCurve.myEdges : &myEdges;
+ std::list<TopoDS_Edge>* aEdges = !
isClosed
? &theCurve.myEdges : &myEdges;
aEdges->splice(aEdges->begin(), myEdges, aEIt, aLastEIt);
}
aEdges->splice(aEdges->begin(), myEdges, aEIt, aLastEIt);
}
+
+ return aResult;
}
void HYDROData_TopoCurve::Cut(
}
void HYDROData_TopoCurve::Cut(
@@
-557,23
+578,34
@@
void HYDROData_TopoCurve::Cut(
theCurve1.Cut(aEPos1, theParameter, theCurve2);
}
theCurve1.Cut(aEPos1, theParameter, theCurve2);
}
-
void
HYDROData_TopoCurve::Cut(
+
bool
HYDROData_TopoCurve::Cut(
const std::deque<std::list<double> >& theParameters,
std::deque<HYDROData_TopoCurve>& theCurves) const
{
const std::deque<std::list<double> >& theParameters,
std::deque<HYDROData_TopoCurve>& theCurves) const
{
+ bool aResult = false;
HYDROData_TopoCurve aCurves[2];
aCurves[0] = *this;
int aCI = 0;
std::list<TopoDS_Edge>::iterator aEIt = aCurves[0].myEdges.begin();
std::deque<std::list<double> >::const_iterator aPLIt = theParameters.begin();
for (std::deque<std::list<double> >::const_iterator aLastPLIt =
HYDROData_TopoCurve aCurves[2];
aCurves[0] = *this;
int aCI = 0;
std::list<TopoDS_Edge>::iterator aEIt = aCurves[0].myEdges.begin();
std::deque<std::list<double> >::const_iterator aPLIt = theParameters.begin();
for (std::deque<std::list<double> >::const_iterator aLastPLIt =
- theParameters.end(); aPLIt != aLastPLIt; ++a
EIt, ++a
PLIt)
+ theParameters.end(); aPLIt != aLastPLIt; ++aPLIt)
{
{
+ TopoDS_Edge aNextEdge;
+ {
+ std::list<TopoDS_Edge>::iterator aNextEIt = aEIt;
+ ++aNextEIt;
+ if (aNextEIt != aCurves[aCI].myEdges.end())
+ {
+ aNextEdge = *aNextEIt;
+ }
+ }
+
for (Iterator<std::list<double>, std::list<double>::const_iterator> aPIt(
*aPLIt, (aEIt->Orientation() != TopAbs_REVERSED)); aPIt.More(); ++aPIt)
{
const int aCI1 = 1 - aCI;
for (Iterator<std::list<double>, std::list<double>::const_iterator> aPIt(
*aPLIt, (aEIt->Orientation() != TopAbs_REVERSED)); aPIt.More(); ++aPIt)
{
const int aCI1 = 1 - aCI;
- aCurves[aCI].Cut(aEIt, **aPIt, aCurves[aCI1]);
+ a
Result |= a
Curves[aCI].Cut(aEIt, **aPIt, aCurves[aCI1]);
if (!aCurves[aCI1].IsEmpty())
{
theCurves.push_back(HYDROData_TopoCurve());
if (!aCurves[aCI1].IsEmpty())
{
theCurves.push_back(HYDROData_TopoCurve());
@@
-586,8
+618,14
@@
void HYDROData_TopoCurve::Cut(
aEIt = aCurves[aCI].myEdges.begin();
}
}
aEIt = aCurves[aCI].myEdges.begin();
}
}
+
+ if (!aNextEdge.IsNull() && !aEIt->IsEqual(aNextEdge))
+ {
+ ++aEIt;
+ }
}
theCurves.push_back(aCurves[aCI]);
}
theCurves.push_back(aCurves[aCI]);
+ return aResult;
}
double HYDROData_TopoCurve::Project(
}
double HYDROData_TopoCurve::Project(
@@
-791,7
+829,7
@@
bool HYDROData_TopoCurve::Connect(
return false;
}
return false;
}
- HYDROData_TopoCurve aECurve = BRepBuilderAPI_MakeEdge(aBSpline);
+ HYDROData_TopoCurve aECurve = BRepBuilderAPI_MakeEdge(aBSpline)
.Edge()
;
aCurve2.Merge(aOrder, aECurve);
}
aCurve2.Merge(aOrder, *this);
aCurve2.Merge(aOrder, aECurve);
}
aCurve2.Merge(aOrder, *this);
@@
-808,9
+846,10
@@
bool HYDROData_TopoCurve::Connect(
return true;
}
return true;
}
-
bool
HYDROData_TopoCurve::BSplinePiecewiseCurve(
+
int
HYDROData_TopoCurve::BSplinePiecewiseCurve(
const double theDeflection, HYDROData_TopoCurve& theCurve) const
{
const double theDeflection, HYDROData_TopoCurve& theCurve) const
{
+ int aPieceCount = 0;
std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
TopoDS_Vertex aEndVertex;
std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
TopoDS_Vertex aEndVertex;
@@
-821,7
+860,7
@@
bool HYDROData_TopoCurve::BSplinePiecewiseCurve(
::BSpline(BRepAdaptor_Curve(*aEIt), theDeflection);
if (aBSpline.IsNull())
{
::BSpline(BRepAdaptor_Curve(*aEIt), theDeflection);
if (aBSpline.IsNull())
{
- return
false
;
+ return
0
;
}
if (aEIt->Orientation() == TopAbs_REVERSED)
}
if (aEIt->Orientation() == TopAbs_REVERSED)
@@
-844,6
+883,7
@@
bool HYDROData_TopoCurve::BSplinePiecewiseCurve(
}
BRep_Builder().Add(aEdge, aVertex);
theCurve.myEdges.push_back(aEdge);
}
BRep_Builder().Add(aEdge, aVertex);
theCurve.myEdges.push_back(aEdge);
+ aPieceCount += aBSpline->NbKnots() - 1;
aPrevEdge = aEdge;
}
aPrevEdge = aEdge;
}
@@
-854,10
+894,10
@@
bool HYDROData_TopoCurve::BSplinePiecewiseCurve(
aCurve.Value(aCurve.LastParameter()), Precision::Confusion());
}
BRep_Builder().Add(aPrevEdge, aEndVertex.Oriented(TopAbs_REVERSED));
aCurve.Value(aCurve.LastParameter()), Precision::Confusion());
}
BRep_Builder().Add(aPrevEdge, aEndVertex.Oriented(TopAbs_REVERSED));
- return
true
;
+ return
aPieceCount
;
}
}
-bool HYDROData_TopoCurve::ValuesInKnots(std::
deque
<gp_XYZ>& theValues) const
+bool HYDROData_TopoCurve::ValuesInKnots(std::
list
<gp_XYZ>& theValues) const
{
std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
{
std::list<TopoDS_Edge>::const_iterator aLastEIt = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();