1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0026396: Taper API result differs run-to-run for identical inputs

- all data maps where shape used as a key have been replaced with indexed data maps. Now index used for iteration through this map instead of shape-key.
- new test have been added. This test allows to test stability of DraftAngle-algo.
- alignment corrections...

Removing warnings
This commit is contained in:
isn
2015-10-08 10:32:41 +03:00
committed by bugmaster
parent 6fa29cbf06
commit 8cc2a23a8e
12 changed files with 1471 additions and 1379 deletions

View File

@@ -1,8 +0,0 @@
#ifndef Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo_HeaderFile
#define Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo_HeaderFile
#include <Draft_DataMapOfEdgeEdgeInfo.hxx>
#endif

View File

@@ -1,8 +0,0 @@
#ifndef Draft_DataMapIteratorOfDataMapOfFaceFaceInfo_HeaderFile
#define Draft_DataMapIteratorOfDataMapOfFaceFaceInfo_HeaderFile
#include <Draft_DataMapOfFaceFaceInfo.hxx>
#endif

View File

@@ -1,8 +0,0 @@
#ifndef Draft_DataMapIteratorOfDataMapOfVertexVertexInfo_HeaderFile
#define Draft_DataMapIteratorOfDataMapOfVertexVertexInfo_HeaderFile
#include <Draft_DataMapOfVertexVertexInfo.hxx>
#endif

View File

@@ -14,16 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef Draft_DataMapOfEdgeEdgeInfo_HeaderFile
#define Draft_DataMapOfEdgeEdgeInfo_HeaderFile
#ifndef Draft_IndexedDataMapOfEdgeEdgeInfo_HeaderFile
#define Draft_IndexedDataMapOfEdgeEdgeInfo_HeaderFile
#include <TopoDS_Edge.hxx>
#include <Draft_EdgeInfo.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_DataMap<TopoDS_Edge,Draft_EdgeInfo,TopTools_ShapeMapHasher> Draft_DataMapOfEdgeEdgeInfo;
typedef NCollection_DataMap<TopoDS_Edge,Draft_EdgeInfo,TopTools_ShapeMapHasher>::Iterator Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo;
typedef NCollection_IndexedDataMap<TopoDS_Edge,Draft_EdgeInfo,TopTools_ShapeMapHasher> Draft_IndexedDataMapOfEdgeEdgeInfo;
#endif

View File

@@ -14,16 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef Draft_DataMapOfFaceFaceInfo_HeaderFile
#define Draft_DataMapOfFaceFaceInfo_HeaderFile
#ifndef Draft_IndexedDataMapOfFaceFaceInfo_HeaderFile
#define Draft_IndexedDataMapOfFaceFaceInfo_HeaderFile
#include <TopoDS_Face.hxx>
#include <Draft_FaceInfo.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_DataMap<TopoDS_Face,Draft_FaceInfo,TopTools_ShapeMapHasher> Draft_DataMapOfFaceFaceInfo;
typedef NCollection_DataMap<TopoDS_Face,Draft_FaceInfo,TopTools_ShapeMapHasher>::Iterator Draft_DataMapIteratorOfDataMapOfFaceFaceInfo;
typedef NCollection_IndexedDataMap<TopoDS_Face,Draft_FaceInfo,TopTools_ShapeMapHasher> Draft_IndexedDataMapOfFaceFaceInfo;
#endif

View File

@@ -14,16 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef Draft_DataMapOfVertexVertexInfo_HeaderFile
#define Draft_DataMapOfVertexVertexInfo_HeaderFile
#ifndef Draft_IndexedDataMapOfVertexVertexInfo_HeaderFile
#define Draft_IndexedDataMapOfVertexVertexInfo_HeaderFile
#include <TopoDS_Vertex.hxx>
#include <Draft_VertexInfo.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_DataMap<TopoDS_Vertex,Draft_VertexInfo,TopTools_ShapeMapHasher> Draft_DataMapOfVertexVertexInfo;
typedef NCollection_DataMap<TopoDS_Vertex,Draft_VertexInfo,TopTools_ShapeMapHasher>::Iterator Draft_DataMapIteratorOfDataMapOfVertexVertexInfo;
typedef NCollection_IndexedDataMap<TopoDS_Vertex,Draft_VertexInfo,TopTools_ShapeMapHasher> Draft_IndexedDataMapOfVertexVertexInfo;
#endif

View File

@@ -18,8 +18,6 @@
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo.hxx>
#include <Draft_DataMapIteratorOfDataMapOfFaceFaceInfo.hxx>
#include <Draft_EdgeInfo.hxx>
#include <Draft_FaceInfo.hxx>
#include <Draft_Modification.hxx>
@@ -129,44 +127,60 @@ Standard_Boolean Draft_Modification::Add(const TopoDS_Face& F,
void Draft_Modification::Remove(const TopoDS_Face& F)
{
if (!myFMap.IsBound(F) || myComp) {
if (!myFMap.Contains(F) || myComp) {
Standard_NoSuchObject::Raise();
}
conneF.Clear();
TopTools_ListIteratorOfListOfShape ltod;
curFace = myFMap(F).RootFace();
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo itf(myFMap);
while (itf.More()) {
const TopoDS_Face& theF = itf.Key();
if (myFMap(theF).RootFace().IsSame(curFace)) {
curFace = myFMap.FindFromKey(F).RootFace();
for (Standard_Integer i = 1; i <= myFMap.Extent(); i++)
{
const TopoDS_Face& theF = myFMap.FindKey(i);
if (myFMap.FindFromKey(theF).RootFace().IsSame(curFace)) {
conneF.Append(theF);
if (theF.IsSame(badShape)) {
badShape.Nullify();
}
}
itf.Next();
}
ltod.Initialize(conneF);
Standard_Integer IndToReplace = 0;
while (ltod.More()) {
myFMap.UnBind(TopoDS::Face(ltod.Value()));
IndToReplace = myFMap.FindIndex(TopoDS::Face(ltod.Value()));
if (IndToReplace)
{
Standard_Integer LInd = myFMap.Extent();
TopoDS_Face LF = myFMap.FindKey(LInd);
Draft_FaceInfo LFInfo = myFMap.FindFromIndex(LInd);
myFMap.RemoveLast();
if (IndToReplace != LInd)
myFMap.Substitute(IndToReplace, LF, LFInfo);
}
ltod.Next();
}
conneF.Clear();
Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo ite(myEMap);
while (ite.More()) {
const TopoDS_Edge& theE = ite.Key();
if (myEMap(theE).RootFace().IsSame(curFace)) {
conneF.Append(theE);
}
ite.Next();
for (Standard_Integer i = 1; i <= myEMap.Extent(); i++)
{
const TopoDS_Edge& theE = myEMap.FindKey(i);
if (myEMap.FindFromKey(theE).RootFace().IsSame(curFace))
conneF.Append(theE);
}
ltod.Initialize(conneF);
while (ltod.More()) {
myEMap.UnBind(TopoDS::Edge(ltod.Value()));
IndToReplace = myFMap.FindIndex(TopoDS::Face(ltod.Value()));
if (IndToReplace)
{
Standard_Integer LInd = myEMap.Extent();
TopoDS_Edge LF = myEMap.FindKey(LInd);
Draft_EdgeInfo LFInfo = myEMap.FindFromIndex(LInd);
myEMap.RemoveLast();
if (IndToReplace != LInd)
myEMap.Substitute(IndToReplace, LF, LFInfo);
}
ltod.Next();
}
}
@@ -212,22 +226,21 @@ const TopoDS_Shape& Draft_Modification::ProblematicShape() const
const TopTools_ListOfShape & Draft_Modification::ConnectedFaces(const TopoDS_Face& F)
{
if (!myFMap.IsBound(F)) {
if (!myFMap.Contains(F)) {
Standard_NoSuchObject::Raise();
}
if (!IsDone()) {
StdFail_NotDone::Raise();
}
conneF.Clear();
curFace = myFMap(F).RootFace();
curFace = myFMap.FindFromKey(F).RootFace();
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo itf(myFMap);
while (itf.More()) {
const TopoDS_Face& theF = itf.Key();
if (myFMap(theF).RootFace().IsSame(curFace)) {
for (Standard_Integer i = 1; i <= myFMap.Extent(); i++)
{
const TopoDS_Face& theF = myFMap.FindKey(i);
if (myFMap.FindFromKey(theF).RootFace().IsSame(curFace)) {
conneF.Append(theF);
}
itf.Next();
}
return conneF;
@@ -248,13 +261,12 @@ const TopTools_ListOfShape & Draft_Modification::ModifiedFaces()
}
conneF.Clear();
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo itf(myFMap);
while (itf.More()) {
const TopoDS_Face& theF = itf.Key();
if (!myFMap(theF).RootFace().IsNull()) {
for (Standard_Integer i = 1; i <= myFMap.Extent(); i++)
{
const TopoDS_Face& theF = myFMap.FindKey(i);
if (!myFMap.FindFromKey(theF).RootFace().IsNull()) {
conneF.Append(theF);
}
itf.Next();
}
return conneF;
@@ -277,7 +289,7 @@ Standard_Boolean Draft_Modification::NewSurface(const TopoDS_Face& F,
{
if (!IsDone()) {Standard_DomainError::Raise();}
if (!myFMap.IsBound(F) || !myFMap(F).NewGeometry()) {
if (!myFMap.Contains(F) || !myFMap.FindFromKey(F).NewGeometry()) {
return Standard_False;
}
@@ -289,7 +301,7 @@ Standard_Boolean Draft_Modification::NewSurface(const TopoDS_Face& F,
L.Identity();
S = myFMap(F).Geometry();
S = myFMap.FindFromKey(F).Geometry();
return Standard_True;
}
@@ -307,17 +319,17 @@ Standard_Boolean Draft_Modification::NewCurve(const TopoDS_Edge& E,
{
if (!IsDone()) {Standard_DomainError::Raise();}
if (!myEMap.IsBound(E))
if (!myEMap.Contains(E))
return Standard_False;
const Draft_EdgeInfo& Einf= myEMap(E);
if (!myEMap(E).NewGeometry())
const Draft_EdgeInfo& Einf= myEMap.FindFromKey(E);
if (!myEMap.FindFromKey(E).NewGeometry())
return Standard_False;
Tol = Einf.Tolerance();
Tol = Max(Tol, BRep_Tool::Tolerance(E));
L.Identity();
C = myEMap(E).Geometry();
C = myEMap.FindFromKey(E).Geometry();
return Standard_True;
@@ -335,12 +347,12 @@ Standard_Boolean Draft_Modification::NewPoint(const TopoDS_Vertex& V,
{
if (!IsDone()) {Standard_DomainError::Raise();};
if (!myVMap.IsBound(V)) {
if (!myVMap.Contains(V)) {
return Standard_False;
}
Tol = BRep_Tool::Tolerance(V);
P = myVMap(V).Geometry();
P = myVMap.FindFromKey(V).Geometry();
return Standard_True;
}
@@ -360,16 +372,16 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
if (!IsDone()) {Standard_DomainError::Raise();};
if (!myEMap.IsBound(E)) {
if (!myEMap.Contains(E)) {
return Standard_False;
}
Standard_Real Fp,Lp;
BRep_Tool::Range(NewE,Fp,Lp);
Handle(Geom_Surface) SB = myFMap(F).Geometry();
Handle(Geom_Surface) SB = myFMap.FindFromKey(F).Geometry();
const Draft_EdgeInfo& Einf = myEMap(E);
const Draft_EdgeInfo& Einf = myEMap.FindFromKey(E);
if ( Einf.FirstFace().IsSame(F) && !Einf.FirstPC().IsNull()) {
C = Einf.FirstPC();
}
@@ -378,7 +390,7 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
}
else {
if (!myEMap(E).NewGeometry()) {
if (!myEMap.FindFromKey(E).NewGeometry()) {
Standard_Real Fpi,Lpi;
BRep_Tool::Range(E,Fpi,Lpi);
if (Fpi <= Fp && Fp <= Lpi && Fpi <= Lp && Lp <= Lpi) {
@@ -390,7 +402,7 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
// if (!BRep_Tool::IsClosed(E,F)) {
BRep_Tool::Range(NewE,Fp,Lp);
Handle(Geom_TrimmedCurve) TC = new Geom_TrimmedCurve(myEMap(E).Geometry(),
Handle(Geom_TrimmedCurve) TC = new Geom_TrimmedCurve(myEMap.FindFromKey(E).Geometry(),
Fp,Lp);
Fp = TC->FirstParameter();
Lp = TC->LastParameter();
@@ -464,12 +476,12 @@ Standard_Boolean Draft_Modification::NewParameter(const TopoDS_Vertex& V,
if (!IsDone()) {Standard_DomainError::Raise();};
if (!myVMap.IsBound(V)) {
if (!myVMap.Contains(V)) {
return Standard_False;
}
P = myVMap(V).Parameter(E);
Handle(Geom_Curve) GC = myEMap(E).Geometry();
P = myVMap.ChangeFromKey(V).Parameter(E);
Handle(Geom_Curve) GC = myEMap.FindFromKey(E).Geometry();
Handle(Standard_Type) typc = GC->DynamicType();
if (typc == STANDARD_TYPE(Geom_TrimmedCurve)) {
GC = Handle(Geom_TrimmedCurve)::DownCast(GC);
@@ -479,8 +491,8 @@ Standard_Boolean Draft_Modification::NewParameter(const TopoDS_Vertex& V,
if (GC->IsClosed()) {
TopoDS_Vertex FV = TopExp::FirstVertex(E);
Standard_Real paramf;
if (myVMap.IsBound(FV)) {
paramf = myVMap(FV).Parameter(E);
if (myVMap.Contains(FV)) {
paramf = myVMap.ChangeFromKey(FV).Parameter(E);
}
else {
paramf = BRep_Tool::Parameter(FV,E);

View File

@@ -20,9 +20,9 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Draft_DataMapOfFaceFaceInfo.hxx>
#include <Draft_DataMapOfEdgeEdgeInfo.hxx>
#include <Draft_DataMapOfVertexVertexInfo.hxx>
#include <Draft_IndexedDataMapOfFaceFaceInfo.hxx>
#include <Draft_IndexedDataMapOfEdgeEdgeInfo.hxx>
#include <Draft_IndexedDataMapOfVertexVertexInfo.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_Shape.hxx>
#include <Draft_ErrorStatus.hxx>
@@ -184,9 +184,9 @@ private:
Standard_EXPORT Handle(Geom_Surface) NewSurface (const Handle(Geom_Surface)& S, const TopAbs_Orientation OriS, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane);
Draft_DataMapOfFaceFaceInfo myFMap;
Draft_DataMapOfEdgeEdgeInfo myEMap;
Draft_DataMapOfVertexVertexInfo myVMap;
Draft_IndexedDataMapOfFaceFaceInfo myFMap;
Draft_IndexedDataMapOfEdgeEdgeInfo myEMap;
Draft_IndexedDataMapOfVertexVertexInfo myVMap;
Standard_Boolean myComp;
TopoDS_Shape myShape;
TopoDS_Shape badShape;

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,8 @@
Draft.cxx
Draft.hxx
Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo.hxx
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo.hxx
Draft_DataMapIteratorOfDataMapOfVertexVertexInfo.hxx
Draft_DataMapOfEdgeEdgeInfo.hxx
Draft_DataMapOfFaceFaceInfo.hxx
Draft_DataMapOfVertexVertexInfo.hxx
Draft_IndexedDataMapOfEdgeEdgeInfo.hxx
Draft_IndexedDataMapOfFaceFaceInfo.hxx
Draft_IndexedDataMapOfVertexVertexInfo.hxx
Draft_EdgeInfo.cxx
Draft_EdgeInfo.hxx
Draft_ErrorStatus.hxx