1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +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)) {
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);
}
ite.Next();
}
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;

View File

@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Adaptor3d_HCurveOnSurface.hxx>
#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
@ -25,9 +24,6 @@
#include <BRepExtrema_ExtPC.hxx>
#include <BRepLib_MakeFace.hxx>
#include <BRepTools.hxx>
#include <Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo.hxx>
#include <Draft_DataMapIteratorOfDataMapOfFaceFaceInfo.hxx>
#include <Draft_DataMapIteratorOfDataMapOfVertexVertexInfo.hxx>
#include <Draft_EdgeInfo.hxx>
#include <Draft_FaceInfo.hxx>
#include <Draft_Modification.hxx>
@ -105,8 +101,8 @@
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo&,
Draft_DataMapOfEdgeEdgeInfo&,
static Standard_Boolean Choose(const Draft_IndexedDataMapOfFaceFaceInfo&,
Draft_IndexedDataMapOfEdgeEdgeInfo&,
const TopoDS_Vertex&,
Draft_VertexInfo&,
GeomAdaptor_Curve&,
@ -147,7 +143,7 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
const Standard_Boolean Flag)
{
if (myFMap.IsBound(F)) {
if (myFMap.Contains(F)) {
return (badShape.IsNull());
}
@ -275,9 +271,9 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
if (postponed || S != NewS) {
Draft_FaceInfo FI(NewS,Standard_True);
FI.RootFace(curFace);
myFMap.Bind(F,FI);
myFMap.Add(F,FI);
if (postponed) {
myFMap(F).ChangeCurve() = theCircle;
myFMap.ChangeFromKey(F).ChangeCurve() = theCircle;
}
}
@ -285,11 +281,11 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
TopTools_MapOfShape MapOfE;
while (expl.More() && badShape.IsNull()) {
const TopoDS_Edge& edg = TopoDS::Edge(expl.Current());
if (!myEMap.IsBound(edg)) {
if (!myEMap.Contains(edg)) {
Standard_Boolean addedg = Standard_False;
Standard_Boolean addface = Standard_False;
TopoDS_Face OtherF;
// if (BRep_Tool::IsClosed(edg,F)) {
//if (BRep_Tool::IsClosed(edg,F)) {
if (BRepTools::IsReallyClosed(edg,F)) {
addedg = Standard_True;
addface = Standard_False;
@ -323,7 +319,7 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
}
if (addedg) {
if (postponed) {
myFMap(F).Add(OtherF);
myFMap.ChangeFromKey(F).Add(OtherF);
}
Standard_Real f,l;
TopLoc_Location L;
@ -369,7 +365,7 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
EInf.ChangeGeometry() = NewC;
EInf.RootFace(curFace);
myEMap.Bind(edg,EInf);
myEMap.Add(edg,EInf);
MapOfE.Add(edg);
if (addface) {
Standard_Boolean Fl = Flag;
@ -382,12 +378,33 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
Handle(Standard_Type) typS = alocalSurface->DynamicType();
if (typS == STANDARD_TYPE(Geom_CylindricalSurface) ||
typS == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
if ( myFMap.IsBound(F)) {
if ( myFMap.Contains(F)) {
if ( Flag == Standard_False && !postponed) {
myFMap.UnBind(F);
Standard_Integer IndToReplace = myFMap.FindIndex(F);
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);
}
TopTools_MapIteratorOfMapOfShape itm(MapOfE);
for ( ; itm.More(); itm.Next())
myEMap.UnBind(TopoDS::Edge(itm.Key()));
{
Standard_Integer IndToReplace = myEMap.FindIndex(TopoDS::Edge(itm.Key()));
if ( IndToReplace )
{
Standard_Integer LInd = myEMap.Extent();
TopoDS_Edge LE = myEMap.FindKey(LInd);
Draft_EdgeInfo LEInfo = myEMap.FindFromIndex(LInd);
myEMap.RemoveLast();
if (IndToReplace != LInd)
myEMap.Substitute(IndToReplace, LE, LEInfo);
}
}
}
}
}
@ -411,8 +428,6 @@ Standard_Boolean Draft_Modification::Propagate ()
if (!badShape.IsNull()) return Standard_False;
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo itf(myFMap);
// Set all edges and vertices of modified faces
TopoDS_Face F;
TopoDS_Edge E;
@ -420,36 +435,36 @@ Standard_Boolean Draft_Modification::Propagate ()
TopExp_Explorer editer;
TopExp_Explorer vtiter;
while (itf.More()) {
const TopoDS_Face& Fc = itf.Key();
for (Standard_Integer i = 1; i <= myFMap.Extent(); i++)
{
const TopoDS_Face& Fc = myFMap.FindKey(i);
// Exploration of the edges of the face
editer.Init(Fc,TopAbs_EDGE);
while (editer.More()) {
E = TopoDS::Edge(editer.Current());
if (!myEMap.IsBound(E)) {
if (!myEMap.Contains(E)) {
Draft_EdgeInfo EInf(Standard_True);
myEMap.Bind(E,EInf);
myEMap.Add(E,EInf);
}
myEMap(E).Add(Fc);
myEMap.ChangeFromKey(E).Add(Fc);
// Exploration of the vertices of the edge
vtiter.Init(E,TopAbs_VERTEX);
while (vtiter.More()) {
V = TopoDS::Vertex(vtiter.Current());
if (!myVMap.IsBound(V)) {
if (!myVMap.Contains(V)) {
Draft_VertexInfo VInf;
myVMap.Bind(V,VInf);
myVMap.Add(V,VInf);
}
myVMap(V).Add(E);
myVMap(V).ChangeParameter(E) = BRep_Tool::Parameter(V, E);
myVMap.ChangeFromKey(V).Add(E);
myVMap.ChangeFromKey(V).ChangeParameter(E) = BRep_Tool::Parameter(V, E);
vtiter.Next();
}
editer.Next();
}
itf.Next();
}
@ -458,10 +473,9 @@ Standard_Boolean Draft_Modification::Propagate ()
// Set edges containing modified vertices.
Draft_DataMapIteratorOfDataMapOfVertexVertexInfo itv(myVMap);
while (itv.More()) {
const TopoDS_Vertex& Vt = itv.Key();
for (Standard_Integer i = 1; i <= myVMap.Extent(); i++)
{
const TopoDS_Vertex& Vt = myVMap.FindKey(i);
// Exploration of the ancestors of the vertex
anc.Init(myShape,TopAbs_EDGE);
@ -478,29 +492,26 @@ Standard_Boolean Draft_Modification::Propagate ()
vtiter.Next();
}
if (found) {
if (!myEMap.IsBound(E)) {
if (!myEMap.Contains(E)) {
Draft_EdgeInfo EInf(Standard_False);
myEMap.Bind(E,EInf);
myEMap.Add(E,EInf);
}
myVMap(Vt).Add(E);
myVMap(Vt).ChangeParameter(E) = BRep_Tool::Parameter(Vt, E);
myVMap.ChangeFromKey(Vt).Add(E);
myVMap.ChangeFromKey(Vt).ChangeParameter(E) = BRep_Tool::Parameter(Vt, E);
}
anc.Next();
}
itv.Next();
}
// Set faces containing modified edges
Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo ite(myEMap);
while (ite.More()) {
const TopoDS_Edge& Ed = ite.Key();
for (Standard_Integer i = 1; i <= myEMap.Extent(); i++)
{
const TopoDS_Edge& Ed = myEMap.FindKey(i);
TopTools_ListIteratorOfListOfShape it;
for (it.Initialize(myEFMap.FindFromKey(Ed)); it.More(); it.Next()) {
F = TopoDS::Face(it.Value());
if (!myFMap.IsBound(F)) {
if (!myFMap.Contains(F)) {
TopLoc_Location L;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,L);
Handle(Geom_Surface) NewS =
@ -516,25 +527,24 @@ Standard_Boolean Draft_Modification::Propagate ()
Standard_Real deltav = 10.*(vmax-vmin);
vmin = vmin - deltav;
vmax = vmax + deltav;
NewS =
new Geom_RectangularTrimmedSurface(NewS,0.,2.*M_PI,vmin,vmax);
NewS = new Geom_RectangularTrimmedSurface(NewS,0.,2.*M_PI,vmin,vmax);
}
}
Draft_FaceInfo FInf(NewS,Standard_False);
myFMap.Bind(F,FInf);
myFMap.Add(F,FInf);
}
myEMap(Ed).Add(F);
myEMap.ChangeFromKey(Ed).Add(F);
}
ite.Next();
}
// Try to add faces for free borders...
// JAG 09.11.95
ite.Initialize(myEMap);
for (; ite.More(); ite.Next()) {
Draft_EdgeInfo& Einf = myEMap(ite.Key());
if (Einf.NewGeometry() && Einf.Geometry().IsNull() &&
for (Standard_Integer i = 1; i <= myEMap.Extent(); i++)
{
Draft_EdgeInfo& Einf = myEMap.ChangeFromIndex(i);
if (Einf.NewGeometry() &&
Einf.Geometry().IsNull() &&
Einf.SecondFace().IsNull()) {
TopLoc_Location Loc;
@ -544,7 +554,8 @@ Standard_Boolean Draft_Modification::Propagate ()
Handle(Geom_Surface) S2;
Standard_Real f,l;
Handle(Geom_Curve) C = BRep_Tool::Curve(ite.Key(),Loc,f,l);
const TopoDS_Edge& EK = myEMap.FindKey(i);
Handle(Geom_Curve) C = BRep_Tool::Curve(EK,Loc,f,l);
C = Handle(Geom_Curve)::DownCast(C->Transformed(Loc.Transformation()));
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
C = Handle(Geom_TrimmedCurve)::DownCast(C)->BasisCurve();
@ -570,27 +581,28 @@ Standard_Boolean Draft_Modification::Propagate ()
}
else {
badShape = TopoDS::Edge(ite.Key());
badShape = EK;
errStat = Draft_EdgeRecomputation;
break; // leave from for
}
}
else { // on the plane
Draft_DataMapIteratorOfDataMapOfVertexVertexInfo anewitv(myVMap);
while (anewitv.More()) {
Draft_VertexInfo& Vinf = myVMap(anewitv.Key());
for (Standard_Integer j = 1; j <= myVMap.Extent(); j++)
{
Draft_VertexInfo& Vinf = myVMap.ChangeFromIndex(j);
for (Vinf.InitEdgeIterator();Vinf.MoreEdge();Vinf.NextEdge()) {
if (Vinf.Edge().IsSame(ite.Key())) {
if (Vinf.Edge().IsSame(EK)) {
break;
}
}
if (Vinf.MoreEdge()) {
for (Vinf.InitEdgeIterator();Vinf.MoreEdge();Vinf.NextEdge()) {
const TopoDS_Edge& edg = Vinf.Edge();
if (!edg.IsSame(ite.Key())) {
if (!myEMap(edg).FirstFace().IsSame(Einf.FirstFace()) &&
(myEMap(edg).SecondFace().IsNull() ||
!myEMap(edg).SecondFace().IsSame(Einf.FirstFace()))) {
if (!edg.IsSame(EK)) {
const Draft_EdgeInfo& EI = myEMap.FindFromKey(edg);
if (!EI.FirstFace().IsSame(Einf.FirstFace()) &&
(EI.SecondFace().IsNull() ||
!EI.SecondFace().IsSame(Einf.FirstFace()))) {
break;
}
}
@ -614,7 +626,7 @@ Standard_Boolean Draft_Modification::Propagate ()
HCur = new GeomAdaptor_HCurve(C);
}
else {
badShape = TopoDS::Edge(ite.Key());
badShape = EK;
errStat = Draft_EdgeRecomputation;
break; // leave from while
}
@ -642,13 +654,13 @@ Standard_Boolean Draft_Modification::Propagate ()
}
else {
badShape = TopoDS::Edge(ite.Key());
badShape = EK;
errStat = Draft_EdgeRecomputation;
break; // leave from while
}
break;
}
anewitv.Next();
//j++;
}
}
@ -658,7 +670,7 @@ Standard_Boolean Draft_Modification::Propagate ()
B.MakeFace(TheNewFace,S2,Precision::Confusion());
Einf.Add(TheNewFace);
Draft_FaceInfo FI(S2,Standard_False);
myFMap.Bind(TheNewFace,FI);
myFMap.Add(TheNewFace,FI);
}
else {
break; // leave from for
@ -689,23 +701,24 @@ void Draft_Modification::Perform ()
// Calculate eventual faces
Draft_DataMapIteratorOfDataMapOfFaceFaceInfo itf(myFMap);
while (itf.More()) {
Draft_FaceInfo& Finf = myFMap(itf.Key());
for (Standard_Integer i = 1; i <= myFMap.Extent(); i++)
{
const TopoDS_Face& FK = myFMap.FindKey(i);
Draft_FaceInfo& Finf = myFMap.ChangeFromIndex(i);
if (Finf.NewGeometry() && Finf.Geometry().IsNull()) {
const TopoDS_Face& F1 = Finf.FirstFace();
const TopoDS_Face& F2 = Finf.SecondFace();
if (F1.IsNull() || F2.IsNull()) {
errStat = Draft_FaceRecomputation;
badShape = TopoDS::Face(itf.Key());
badShape = FK;
return;
}
Handle(Geom_Surface) S1 = myFMap(F1).Geometry();
Handle(Geom_Surface) S2 = myFMap(F2).Geometry();
Handle(Geom_Surface) S1 = myFMap.FindFromKey(F1).Geometry();
Handle(Geom_Surface) S2 = myFMap.FindFromKey(F2).Geometry();
if (S1.IsNull() || S2.IsNull()) {
errStat = Draft_FaceRecomputation;
badShape = TopoDS::Face(itf.Key());
badShape = FK;
return;
}
if (S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
@ -720,7 +733,7 @@ void Draft_Modification::Perform ()
Handle(Geom_Plane) P2 = Handle(Geom_Plane)::DownCast(S2);
if (P1.IsNull() || P2.IsNull()) {
errStat = Draft_FaceRecomputation;
badShape = TopoDS::Face(itf.Key());
badShape = FK;
return;
}
gp_Pln pp1 = P1->Pln();
@ -729,7 +742,7 @@ void Draft_Modification::Perform ()
Precision::Angular(),Precision::Confusion());
if (!i2p.IsDone() || i2p.TypeInter() != IntAna_Line) {
errStat = Draft_FaceRecomputation;
badShape = TopoDS::Face(itf.Key());
badShape = FK;
return;
}
@ -737,7 +750,7 @@ void Draft_Modification::Perform ()
// Preserve the same direction as the base face
Handle(Geom_Surface) RefSurf =
BRep_Tool::Surface(TopoDS::Face(itf.Key()));
BRep_Tool::Surface(FK);
if (RefSurf->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
RefSurf =
Handle(Geom_RectangularTrimmedSurface)::DownCast(RefSurf)
@ -754,8 +767,7 @@ void Draft_Modification::Perform ()
else if (RefSurf->DynamicType() ==
STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
DirRef =
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(RefSurf)
->Direction();
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(RefSurf)->Direction();
}
if (extrdir.Dot(DirRef) < 0.) extrdir.Reverse();
@ -769,7 +781,7 @@ void Draft_Modification::Perform ()
new Geom_SurfaceOfLinearExtrusion(CCir, extrdir);
Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(TopoDS::Face(itf.Key()),umin,umax,vmin,vmax);
BRepTools::UVBounds(FK,umin,umax,vmin,vmax);
if (!Precision::IsNegativeInfinite(vmin) &&
!Precision::IsPositiveInfinite(vmax)) {
Standard_Real deltav = 2.*(vmax-vmin);
@ -786,7 +798,6 @@ void Draft_Modification::Perform ()
NewS = new Geom_RectangularTrimmedSurface(NewS,0.,1.9*M_PI,vmin,vmax);
Finf.ChangeGeometry() = NewS;
}
itf.Next();
}
// Calculate new edges.
@ -795,12 +806,12 @@ void Draft_Modification::Perform ()
Handle(Geom_Curve) C, newC;
Standard_Real f,l;
TopLoc_Location L;
Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo ite(myEMap);
while (ite.More()) {
Draft_EdgeInfo& Einf = myEMap(ite.Key());
for (Standard_Integer ii = 1; ii <= myEMap.Extent(); ii++)
{
Draft_EdgeInfo& Einf = myEMap.ChangeFromIndex(ii);
const TopoDS_Edge& theEdge = TopoDS::Edge(ite.Key());
const TopoDS_Edge& theEdge = TopoDS::Edge(myEMap.FindKey(ii));
C = BRep_Tool::Curve(theEdge,L,f,l);
C = Handle(Geom_Curve)::DownCast(C->Transformed(L.Transformation()));
@ -811,8 +822,8 @@ void Draft_Modification::Perform ()
const TopoDS_Face& FirstFace = Einf.FirstFace();
const TopoDS_Face& SecondFace = Einf.SecondFace();
S1 = myFMap(FirstFace).Geometry();
S2 = myFMap(SecondFace).Geometry();
S1 = myFMap.FindFromKey(FirstFace).Geometry();
S2 = myFMap.FindFromKey(SecondFace).Geometry();
Standard_Integer detrompeur = 0;
@ -820,8 +831,8 @@ void Draft_Modification::Perform ()
TopoDS_Vertex FV = TopExp::FirstVertex(theEdge);
TopoDS_Vertex LV = TopExp::LastVertex(theEdge);
Standard_Real pmin = 0.;
Standard_Real prmfv = BRep_Tool::Parameter(FV,ite.Key());
Standard_Real prmlv = BRep_Tool::Parameter(LV,ite.Key());
Standard_Real prmfv = BRep_Tool::Parameter(FV, theEdge);
Standard_Real prmlv = BRep_Tool::Parameter(LV, theEdge);
gp_Pnt pfv, plv;
gp_Vec d1fv,d1lv, newd1;
C->D1(prmfv,pfv,d1fv);
@ -920,8 +931,8 @@ void Draft_Modification::Perform ()
Einf.ChangeSecondPC() = L2d;
}
else {
S1 = myFMap(Einf.FirstFace()).Geometry();
S2 = myFMap(Einf.SecondFace()).Geometry();
S1 = myFMap.FindFromKey(Einf.FirstFace()).Geometry();
S2 = myFMap.FindFromKey(Einf.SecondFace()).Geometry();
// PCurves are not calculated immediately for 2 reasons:
@ -933,7 +944,7 @@ void Draft_Modification::Perform ()
if (!i2s.IsDone() || i2s.NbLines() <= 0) {
errStat = Draft_EdgeRecomputation;
badShape = TopoDS::Edge(ite.Key());
badShape = theEdge;
return;
}
@ -1062,7 +1073,7 @@ void Draft_Modification::Perform ()
}
if (imin == 0) {
errStat = Draft_EdgeRecomputation;
badShape = TopoDS::Edge(ite.Key());
badShape = theEdge;
return;
}
@ -1117,9 +1128,9 @@ void Draft_Modification::Perform ()
if(Candidates.Length() == 0)
{
// errStat = Draft_EdgeRecomputation;
// badShape = TopoDS::Edge(ite.Key());
// return;
//errStat = Draft_EdgeRecomputation;
//badShape = TopoDS::Edge(ite.Key());
//return;
for (i = 1; i <= i2s.NbLines(); i++)
Candidates.Append( i2s.Line(i) );
}
@ -1189,7 +1200,7 @@ void Draft_Modification::Perform ()
if (FirstCurve.IsNull()) {
errStat = Draft_EdgeRecomputation;
badShape = TopoDS::Edge(ite.Key());
badShape = theEdge;
return;
}
@ -1241,11 +1252,11 @@ void Draft_Modification::Perform ()
const TopoDS_Face& F1 = Einf.FirstFace();
const TopoDS_Face& F2 = Einf.SecondFace();
Handle(Geom_Surface) aLocalS1 = myFMap(F1).Geometry();
Handle(Geom_Surface) aLocalS2 = myFMap(F2).Geometry();
Handle(Geom_Surface) aLocalS1 = myFMap.FindFromKey(F1).Geometry();
Handle(Geom_Surface) aLocalS2 = myFMap.FindFromKey(F2).Geometry();
if (aLocalS1.IsNull() || aLocalS2.IsNull()) {
errStat = Draft_EdgeRecomputation;
badShape = TopoDS::Edge(ite.Key());
badShape = theEdge;
return;
}
if (aLocalS1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
@ -1340,32 +1351,31 @@ void Draft_Modification::Perform ()
if (!T.IsNull()) C = T->BasisCurve();
Einf.ChangeGeometry() = C;
}
ite.Next();
}
// Calculate new vertices.
Draft_DataMapIteratorOfDataMapOfVertexVertexInfo itv(myVMap);
Handle(GeomAdaptor_HCurve) HAC = new GeomAdaptor_HCurve;
Handle(GeomAdaptor_HSurface) HAS = new GeomAdaptor_HSurface;
while (itv.More()) {
for (Standard_Integer ii = 1; ii <= myVMap.Extent(); ii++)
{
GeomAdaptor_Curve AC;
GeomAdaptor_Surface AS;
Draft_VertexInfo& Vinf = myVMap(itv.Key());
if (!Choose(myFMap,myEMap,itv.Key(),Vinf,AC,AS)) {
const TopoDS_Vertex& TVV = myVMap.FindKey(ii);
Draft_VertexInfo& Vinf = myVMap.ChangeFromIndex(ii);
if (!Choose(myFMap,myEMap,TVV,Vinf,AC,AS)) {
// no concerted edge => alignment of two consecutive edges.
// no concerted edge => alignment of two consecutive edges.
gp_Pnt pvt;
Vinf.ChangeGeometry() = pvt;
Vinf.InitEdgeIterator();
if (Vinf.MoreEdge()) {
const TopoDS_Edge& Edg1 = Vinf.Edge();
//const Draft_EdgeInfo& Einf1 = myEMap(Edg1);
Draft_EdgeInfo& Einf1 = myEMap(Edg1);
gp_Pnt vtori = BRep_Tool::Pnt(itv.Key());
Draft_EdgeInfo& Einf1 = myEMap.ChangeFromKey(Edg1);
gp_Pnt vtori = BRep_Tool::Pnt(TVV);
//Einf1.Geometry()->D0(Vinf.Parameter(Edg1), pvt);
GeomAPI_ProjectPointOnCurve Projector( vtori, Einf1.Geometry() ); //patch
pvt = Projector.NearestPoint();
@ -1384,8 +1394,8 @@ void Draft_Modification::Perform ()
if (Vinf.MoreEdge()) {
const TopoDS_Edge& Edg2 = Vinf.Edge();
//const Draft_EdgeInfo& Einf2 = myEMap(Edg2);
Draft_EdgeInfo& Einf2 = myEMap(Edg2);
// Standard_Real f;
Draft_EdgeInfo& Einf2 = myEMap.ChangeFromKey(Edg2);
// Standard_Real f;
gp_Pnt opvt;
Einf2.Geometry()->D0(Vinf.Parameter(Edg2), opvt);
@ -1404,8 +1414,8 @@ void Draft_Modification::Perform ()
Standard_Real param = Parameter(Einf2.Geometry(), pvt, done);
if (done != 0)
{
S1 = myFMap(Einf2.FirstFace()).Geometry();
S2 = myFMap(Einf2.SecondFace()).Geometry();
S1 = myFMap.FindFromKey(Einf2.FirstFace()).Geometry();
S2 = myFMap.FindFromKey(Einf2.SecondFace()).Geometry();
Vinf.ChangeParameter(Edg2) = SmartParameter( Einf2, BRep_Tool::Tolerance(Edg2), pvt, done, S1, S2 );
}
else
@ -1418,34 +1428,35 @@ void Draft_Modification::Perform ()
Standard_Real param = Parameter(Einf1.Geometry(), pvt, done);
if (done != 0)
{
S1 = myFMap(Einf1.FirstFace()).Geometry();
S2 = myFMap(Einf1.SecondFace()).Geometry();
S1 = myFMap.FindFromKey(Einf1.FirstFace()).Geometry();
S2 = myFMap.FindFromKey(Einf1.SecondFace()).Geometry();
Vinf.ChangeParameter(Edg1) = SmartParameter( Einf1, BRep_Tool::Tolerance(Edg1), pvt, done, S1, S2 );
}
else
Vinf.ChangeParameter(Edg1) = param;
itv.Next();
continue;
}
errStat = Draft_VertexRecomputation;
badShape = TopoDS::Vertex(itv.Key());
badShape = TVV;
return;
}
IntCurveSurface_HInter myintcs;
HAC->Set(AC);
HAS->Set(AS);
myintcs.Perform(HAC,HAS);
if (!myintcs.IsDone()) {
errStat = Draft_VertexRecomputation;
badShape = TopoDS::Vertex(itv.Key());
badShape = TVV;
return;
}
gp_Pnt vtori = BRep_Tool::Pnt(itv.Key());
gp_Pnt vtori = BRep_Tool::Pnt(TVV);
gp_Pnt pvt;
Standard_Integer nbsol = myintcs.NbPoints();
@ -1455,7 +1466,7 @@ void Draft_Modification::Perform ()
if(!extr.IsDone() || extr.NbExt() == 0) {
errStat = Draft_VertexRecomputation;
badShape = TopoDS::Vertex(itv.Key());
badShape = TVV;
return;
}
@ -1498,28 +1509,27 @@ void Draft_Modification::Perform ()
for (Vinf.InitEdgeIterator();Vinf.MoreEdge(); Vinf.NextEdge()) {
const TopoDS_Edge& Edg = Vinf.Edge();
//const Draft_EdgeInfo& Einf = myEMap(Edg);
Draft_EdgeInfo& Einf = myEMap(Edg);
Draft_EdgeInfo& Einf = myEMap.ChangeFromKey(Edg);
//Vinf.ChangeParameter(Edg) = Parameter(Einf.Geometry(),pvt);
Standard_Integer done;
Standard_Real param = Parameter(Einf.Geometry(), pvt, done);
if (done != 0)
{
S1 = myFMap(Einf.FirstFace()).Geometry();
S2 = myFMap(Einf.SecondFace()).Geometry();
S1 = myFMap.FindFromKey(Einf.FirstFace()).Geometry();
S2 = myFMap.FindFromKey(Einf.SecondFace()).Geometry();
Vinf.ChangeParameter(Edg) = SmartParameter( Einf, BRep_Tool::Tolerance(Edg), pvt, done, S1, S2 );
}
else
Vinf.ChangeParameter(Edg) = param;
}
itv.Next();
}
}
// small loop of validation/protection
for (Draft_DataMapIteratorOfDataMapOfEdgeEdgeInfo ite(myEMap);
ite.More(); ite.Next()) {
const TopoDS_Edge& edg = TopoDS::Edge(ite.Key());
for (Standard_Integer i = 1; i <= myEMap.Extent(); i++)
{
const TopoDS_Edge& edg = TopoDS::Edge(myEMap.FindKey(i));
TopoDS_Vertex Vf,Vl;
TopExp::Vertices(edg,Vf,Vl);
@ -1535,12 +1545,12 @@ void Draft_Modification::Perform ()
pl = BRep_Tool::Parameter(Vl,edg);
}
if (pl <= pf) {
// const Handle(Geom_Curve) gc=ite.Value().Geometry();
// if (!gc.IsNull()) {
// pl = gc->LastParameter();
// pf = gc->FirstParameter();
// }
Handle( Geom_Curve ) theCurve = myEMap(edg).Geometry();
// const Handle(Geom_Curve) gc=ite.Value().Geometry();
// if (!gc.IsNull()) {
// pl = gc->LastParameter();
// pf = gc->FirstParameter();
// }
Handle( Geom_Curve ) theCurve = myEMap.FindFromKey(edg).Geometry();
if (theCurve->IsClosed())
{
// pf >= pl
@ -1558,14 +1568,14 @@ void Draft_Modification::Perform ()
}
if (pl <= pf) {
errStat = Draft_EdgeRecomputation;
badShape = TopoDS::Edge(ite.Key());
badShape = edg;
return;
}
}
if (myVMap.IsBound( Vf ))
myVMap(Vf).ChangeParameter(edg) = pf;
if (myVMap.IsBound( Vl ))
myVMap(Vl).ChangeParameter(edg) = pl;
if (myVMap.Contains( Vf ))
myVMap.ChangeFromKey(Vf).ChangeParameter(edg) = pf;
if (myVMap.Contains( Vl ))
myVMap.ChangeFromKey(Vl).ChangeParameter(edg) = pl;
}
}
@ -1778,10 +1788,10 @@ Handle(Geom_Curve) Draft_Modification::NewCurve
gp_Lin lin = Handle(Geom_Line)::DownCast(C)->Lin();
// Standard_Real testdir = Direction.Dot(lin.Direction());
// if (Abs(testdir) <= 1.-Precision::Angular()) {
// return NewC;
// }
// Standard_Real testdir = Direction.Dot(lin.Direction());
// if (Abs(testdir) <= 1.-Precision::Angular()) {
// return NewC;
// }
gp_Dir Norm;
if (TypeS == STANDARD_TYPE(Geom_CylindricalSurface)) {
Standard_Real U,V;
@ -1824,8 +1834,8 @@ Handle(Geom_Curve) Draft_Modification::NewCurve
//purpose :
//=======================================================================
static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
Draft_DataMapOfEdgeEdgeInfo& theEMap,
static Standard_Boolean Choose(const Draft_IndexedDataMapOfFaceFaceInfo& theFMap,
Draft_IndexedDataMapOfEdgeEdgeInfo& theEMap,
const TopoDS_Vertex& Vtx,
Draft_VertexInfo& Vinf,
GeomAdaptor_Curve& AC,
@ -1837,7 +1847,7 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
// Find a regular edge with null SecondFace
while (Vinf.MoreEdge()) {
const TopoDS_Edge& E1 = Vinf.Edge();
const Draft_EdgeInfo& Einf1 = theEMap(E1);
const Draft_EdgeInfo& Einf1 = theEMap.FindFromKey(E1);
if (Einf1.SecondFace().IsNull()) {
break;
}
@ -1856,7 +1866,7 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
const TopoDS_Edge& Eref = Vinf.Edge();
//const Draft_EdgeInfo& Einf = theEMap(Eref);
Draft_EdgeInfo& Einf = theEMap(Eref);
Draft_EdgeInfo& Einf = theEMap.ChangeFromKey(Eref);
AC.Load(Einf.Geometry());
@ -1870,8 +1880,8 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
Standard_Real param = Parameter( C, BRep_Tool::Pnt(Vtx), done );
if (done != 0)
{
Handle( Geom_Surface ) S1 = theFMap(Einf.FirstFace()).Geometry();
Handle( Geom_Surface ) S2 = theFMap(Einf.SecondFace()).Geometry();
Handle( Geom_Surface ) S1 = theFMap.FindFromKey(Einf.FirstFace()).Geometry();
Handle( Geom_Surface ) S2 = theFMap.FindFromKey(Einf.SecondFace()).Geometry();
prm = SmartParameter( Einf, BRep_Tool::Tolerance(Eref), BRep_Tool::Pnt(Vtx), done, S1, S2 );
}
else
@ -1885,7 +1895,7 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
const TopoDS_Edge& Edg = Vinf.Edge();
if (!Edg.IsSame(Eref)) {
//const Draft_EdgeInfo& Einfo = theEMap(Edg);
Draft_EdgeInfo& Einfo = theEMap(Edg);
Draft_EdgeInfo& Einfo = theEMap.ChangeFromKey(Edg);
if (!Einfo.SecondFace().IsNull() &&
BRep_Tool::Continuity(Edg,Einfo.FirstFace(),Einfo.SecondFace())
<= GeomAbs_C0) {
@ -1896,8 +1906,8 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
Standard_Real anewparam = Parameter( C, BRep_Tool::Pnt(Vtx), anewdone );
if (anewdone != 0)
{
Handle( Geom_Surface ) S1 = theFMap(Einfo.FirstFace()).Geometry();
Handle( Geom_Surface ) S2 = theFMap(Einfo.SecondFace()).Geometry();
Handle( Geom_Surface ) S1 = theFMap.FindFromKey(Einfo.FirstFace()).Geometry();
Handle( Geom_Surface ) S2 = theFMap.FindFromKey(Einfo.SecondFace()).Geometry();
prm = SmartParameter( Einfo, BRep_Tool::Tolerance(Edg), BRep_Tool::Pnt(Vtx), anewdone, S1, S2 );
}
else
@ -1915,23 +1925,23 @@ static Standard_Boolean Choose(const Draft_DataMapOfFaceFaceInfo& theFMap,
return Standard_False;
}
const Draft_EdgeInfo& Einf2 = theEMap(Vinf.Edge());
const Draft_EdgeInfo& Einf2 = theEMap.FindFromKey(Vinf.Edge());
if (!Einf.SecondFace().IsNull()) {
if (Einf2.FirstFace().IsSame(Einf.FirstFace()) ||
Einf2.FirstFace().IsSame(Einf.SecondFace())) {
AS.Load(theFMap(Einf2.SecondFace()).Geometry());
AS.Load(theFMap.FindFromKey(Einf2.SecondFace()).Geometry());
}
else {
AS.Load(theFMap(Einf2.FirstFace()).Geometry());
AS.Load(theFMap.FindFromKey(Einf2.FirstFace()).Geometry());
}
}
else {
if (Einf2.FirstFace().IsSame(Einf.FirstFace())) {
AS.Load(theFMap(Einf2.SecondFace()).Geometry());
AS.Load(theFMap.FindFromKey(Einf2.SecondFace()).Geometry());
}
else {
AS.Load(theFMap(Einf2.FirstFace()).Geometry());
AS.Load(theFMap.FindFromKey(Einf2.FirstFace()).Geometry());
}
}
return Standard_True;
@ -2124,9 +2134,9 @@ static Standard_Real SmartParameter(Draft_EdgeInfo& Einf,
static TopAbs_Orientation Orientation(const TopoDS_Shape& S,
const TopoDS_Face& F)
{
//
// change porting NT
//
//
// change porting NT
//
TopExp_Explorer expl ;
expl.Init(S,
TopAbs_FACE) ;

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

View File

@ -4485,6 +4485,97 @@ static Standard_Integer OCC24537(
return 0;
}
#include <TopExp.hxx>
#include <BRepOffsetAPI_DraftAngle.hxx>
#include <vector>
static TopoDS_Shape taper(const TopoDS_Shape &shape, const TopoDS_Face &face_a, const TopoDS_Face &face_b, Standard_Real angle)
{
// Use maximum face-to-taper z-offset.
const gp_Pln neutral_plane(gp_Ax3(gp_Pnt(0.0, 0.0, 140.0), gp_Dir(0.0, 0.0, 1.0)));
// Draft angle needs to be in radians, and flipped to adhere to our own (arbitrary) draft
// angle definition.
const Standard_Real draft_angle = -(angle / 180.0) * M_PI;
// Add face to draft. The first argument indicates that all material added/removed during
// drafting is located below the neutral plane
BRepOffsetAPI_DraftAngle drafter(shape);
drafter.Add(face_a, gp_Dir(0.0, 0.0, -1.0), draft_angle, neutral_plane);
drafter.Add(face_b, gp_Dir(0.0, 0.0, -1.0), draft_angle, neutral_plane);
drafter.Build();
return drafter.Shape();
}
static void dumpShapeVertices(const TopoDS_Shape &shape, std::vector<Standard_Real>& coords)
{
TopTools_IndexedMapOfShape shape_vertices;
TopExp::MapShapes(shape, TopAbs_VERTEX, shape_vertices);
for (Standard_Integer i = 1; i <= shape_vertices.Extent(); i++)
{
gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(shape_vertices(i)));
coords.push_back(p.X());
coords.push_back(p.Y());
coords.push_back(p.Z());
}
}
static void GetCoords(const Standard_CString& path_to_file, std::vector<Standard_Real>& coords)
{
TopoDS_Shape shape;
BRep_Builder builder;
BRepTools::Read(shape, path_to_file, builder);
TopTools_IndexedMapOfShape shape_faces;
TopExp::MapShapes(shape, TopAbs_FACE, shape_faces);
TopoDS_Face face_a = TopoDS::Face(shape_faces(1));
TopoDS_Face face_b = TopoDS::Face(shape_faces(5));
dumpShapeVertices(taper(shape, face_a, face_b, 5.0), coords);
}
static Standard_Integer OCC26396 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
if (theArgc < 2)
{
theDI << "Error: path to file is missing\n";
return 1;
}
const int maxInd = 50;
std::vector<Standard_Real> ref_coords;
ref_coords.reserve(100);
Standard_Boolean Stat = Standard_True;
GetCoords(theArgv[1], ref_coords);
std::vector<Standard_Real> coords;
coords.reserve(100);
for (int i = 1; i < maxInd; i++)
{
GetCoords(theArgv[1], coords);
if (coords.size() != ref_coords.size())
{
Stat = Standard_False;
break;
}
for (size_t j = 0; j < coords.size(); j++)
if (Abs(ref_coords[j] - coords[j]) > RealEpsilon())
{
Stat = Standard_False;
break;
}
coords.clear();
}
if (!Stat)
theDI << "Error: unstable results";
else
theDI << "test OK";
return 0;
}
//=======================================================================
//function : OCC26750
//purpose :
@ -4609,6 +4700,7 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
__FILE__, OCC26462, group);
theCommands.Add ("OCC26313", "OCC26313 result shape", __FILE__, OCC26313, group);
theCommands.Add ("OCC26396", "OCC26396 shape_file_path", __FILE__, OCC26396, group);
theCommands.Add ("OCC26525", "OCC26525 result edge face ", __FILE__, OCC26525, group);
theCommands.Add ("OCC24537", "OCC24537 [file]", __FILE__, OCC24537, group);

View File

@ -0,0 +1,8 @@
puts "================"
puts "OCC26396"
puts "================"
puts ""
pload QAcommands
OCC26396 [locate_data_file bug26396_shape.brep]