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 'BR_HYDRO_IMPS_WIN' of ssh://gitolite3@git.salome-platform.org/modules...
[modules/hydro.git]
/
src
/
HYDROData
/
HYDROData_TopoCurve.cxx
diff --git
a/src/HYDROData/HYDROData_TopoCurve.cxx
b/src/HYDROData/HYDROData_TopoCurve.cxx
index abe49f37865a10e5c4d88a03a67c2cb828485c1b..ffa0361075c86d446a21d891f10633588a23ab78 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
@@
-43,6
+39,10
@@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+#include <BRepTools.hxx>
+
//! The type is intended to traverse the container
//! either from the begin to the end or vice versa.
template<typename ContainerType, typename IteratorType>
//! The type is intended to traverse the container
//! either from the begin to the end or vice versa.
template<typename ContainerType, typename IteratorType>
@@
-134,7
+134,7
@@
static TopoDS_Edge ReplaceVertex(
}
// Projects the point to the curve.
}
// Projects the point to the curve.
-
static
double ProjectPointToCurve(
+double ProjectPointToCurve(
const gp_XYZ& thePoint,
const Adaptor3d_Curve& theCurve,
double& theParameter)
const gp_XYZ& thePoint,
const Adaptor3d_Curve& theCurve,
double& theParameter)
@@
-367,12
+367,13
@@
static bool Interpolate(
bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
{
bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
{
- // Check for nonemptiness.
+ // Check for non
-
emptiness.
myEdges.clear();
TopTools_IndexedDataMapOfShapeListOfShape aVertexToEdges;
TopExp::MapShapesAndAncestors(theWire,
TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
const int aVCount = aVertexToEdges.Extent();
myEdges.clear();
TopTools_IndexedDataMapOfShapeListOfShape aVertexToEdges;
TopExp::MapShapesAndAncestors(theWire,
TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges);
const int aVCount = aVertexToEdges.Extent();
+ //DEBTRACE("initialize VCount= "<< aVCount);
if (aVCount == 0)
{
return false;
if (aVCount == 0)
{
return false;
@@
-458,22
+459,24
@@
bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
TopoDS_Wire HYDROData_TopoCurve::Wire() const
{
TopoDS_Wire aWire;
TopoDS_Wire HYDROData_TopoCurve::Wire() const
{
TopoDS_Wire aWire;
- BRep_Builder aBulder;
- aBulder.MakeWire(aWire);
+ BRep_Builder aBu
i
lder;
+ aBu
i
lder.MakeWire(aWire);
std::list<TopoDS_Edge>::const_iterator aEItLast = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
for (; aEIt != aEItLast; ++aEIt)
{
std::list<TopoDS_Edge>::const_iterator aEItLast = myEdges.end();
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
for (; aEIt != aEItLast; ++aEIt)
{
- aBulder.Add(aWire, *aEIt);
+ aBu
i
lder.Add(aWire, *aEIt);
}
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;
@@
-499,6
+502,7
@@
void HYDROData_TopoCurve::Cut(
aParamI ^= 1;
}
const bool isClosed = IsClosed();
aParamI ^= 1;
}
const bool isClosed = IsClosed();
+ //DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed);
if (aParamI < 0)
{
aEdge.Orientation(TopAbs_FORWARD);
if (aParamI < 0)
{
aEdge.Orientation(TopAbs_FORWARD);
@@
-530,6
+534,8
@@
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
{
}
else
{
@@
-538,6
+544,19
@@
void HYDROData_TopoCurve::Cut(
if (aParamI > 0)
{
++aEIt;
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;
+ }
}
}
}
}
@@
-548,6
+567,8
@@
void HYDROData_TopoCurve::Cut(
std::list<TopoDS_Edge>* aEdges = !isClosed ? &theCurve.myEdges : &myEdges;
aEdges->splice(aEdges->begin(), myEdges, aEIt, aLastEIt);
}
std::list<TopoDS_Edge>* aEdges = !isClosed ? &theCurve.myEdges : &myEdges;
aEdges->splice(aEdges->begin(), myEdges, aEIt, aLastEIt);
}
+
+ return aResult;
}
void HYDROData_TopoCurve::Cut(
}
void HYDROData_TopoCurve::Cut(
@@
-563,10
+584,11
@@
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;
HYDROData_TopoCurve aCurves[2];
aCurves[0] = *this;
int aCI = 0;
@@
-589,7
+611,7
@@
void HYDROData_TopoCurve::Cut(
*aPLIt, (aEIt->Orientation() != TopAbs_REVERSED)); aPIt.More(); ++aPIt)
{
const int aCI1 = 1 - aCI;
*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());
@@
-609,6
+631,7
@@
void HYDROData_TopoCurve::Cut(
}
}
theCurves.push_back(aCurves[aCI]);
}
}
theCurves.push_back(aCurves[aCI]);
+ return aResult;
}
double HYDROData_TopoCurve::Project(
}
double HYDROData_TopoCurve::Project(
@@
-637,6
+660,10
@@
int HYDROData_TopoCurve::Intersect(
const TopoDS_Wire& theWire,
std::deque<std::list<double> >& theParameters) const
{
const TopoDS_Wire& theWire,
std::deque<std::list<double> >& theParameters) const
{
+ //std::string brepName = "theWireToIntersect";
+ //brepName += ".brep";
+ //BRepTools::Write( theWire, brepName.c_str() );
+
int aIntCount = 0;
theParameters.resize(myEdges.size());
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
int aIntCount = 0;
theParameters.resize(myEdges.size());
std::list<TopoDS_Edge>::const_iterator aEIt = myEdges.begin();
@@
-652,6
+679,7
@@
int HYDROData_TopoCurve::Intersect(
aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams);
}
}
aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams);
}
}
+ //DEBTRACE("aIntCount " << aIntCount);
return aIntCount;
}
return aIntCount;
}