Fix problem with partition (merge fix of PKV from BR_QT4_Dev branch)

This commit is contained in:
vsr 2008-09-18 03:33:24 +00:00
parent 1fbfe5fb2f
commit 985c3a718b
4 changed files with 185 additions and 32 deletions

View File

@ -251,6 +251,7 @@ static
TopTools_MapIteratorOfMapOfOrientedShape aItM;
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
TopTools_MapOfOrientedShape aMAdded;
TopoDS_Iterator aItW;
BRep_Builder aBB;
GEOMAlgo_WireEdgeSet aWES;
GEOMAlgo_WESCorrector aWESCor;
@ -278,6 +279,37 @@ static
const TopoDS_Shape& aW=aIt.Value();
myLoops.Append(aW);
}
//modified by NIZNHY-PKV Tue Aug 5 15:09:29 2008f
// Post Treatment
TopTools_MapOfOrientedShape aMEP;
//
// a. collect all edges that are in loops
aIt.Initialize (myLoops);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aW=aIt.Value();
aItW.Initialize(aW);
for (; aItW.More(); aItW.Next()) {
const TopoDS_Shape& aE=aItW.Value();
aMEP.Add(aE);
}
}
//
// b. collect all edges that are to avoid
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aE=aItM.Key();
aMEP.Add(aE);
}
//
// c. add all edges that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (!aMEP.Contains(aE)) {
myShapesToAvoid.Add(aE);
}
}
//modified by NIZNHY-PKV Tue Aug 5 15:09:35 2008t
//
// 2. Internal Wires
myLoopsInternal.Clear();
@ -302,7 +334,7 @@ static
aBB.MakeWire(aW);
aBB.Add(aW, aEE);
//
TopoDS_Iterator aItW (aW);
aItW.Initialize(aW);
for (; aItW.More()&&bFlag; aItW.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value());
//

View File

@ -93,7 +93,10 @@ static
void MakeInternalShells(const TopTools_MapOfShape& ,
TopTools_ListOfShape& );
//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f
static
Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell);
//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t
//=======================================================================
//function :
@ -228,6 +231,17 @@ static
myShapesToAvoid.Add(aF2);
}
}
//DEB
else {
TopTools_ListIteratorOfListOfShape aItLF;
//
aItLF.Initialize (aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Shape& aFx=aItLF.Value();
int a=0;
}
}
//DEB
}// for (i=1; i<=aNbE; ++i) {
//
if (!bFound) {
@ -246,14 +260,16 @@ static
//
myLoops.Clear();
//
Standard_Integer aNbLF, aNbOff, aNbFP;
Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA;
TopAbs_Orientation anOr;
TopoDS_Edge aEL;
BRep_Builder aBB;
NMTTools_CoupleOfShape aCSOff;
TopTools_MapOfOrientedShape AddedFacesMap;
TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
TopTools_ListIteratorOfListOfShape aItF;
TopTools_ListIteratorOfListOfShape aItF, aIt;
TopTools_MapIteratorOfMapOfOrientedShape aItM;
TopoDS_Iterator aItS;
//
//=================================================
//
@ -366,17 +382,61 @@ static
}
} // for (; aEdgeExp.More(); aEdgeExp.Next()) {
} //for (; aItAddedF.More(); aItAddedF.Next()) {
myLoops.Append(aShell);
//modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f
//myLoops.Append(aShell);
if (IsClosedShell(aShell)) {
myLoops.Append(aShell);
}
/*
else {
TopoDS_Iterator aItS;
aItS.Initialize(aShell);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFs=aItS.Value();
aMFP.Add(aFs);
}
}
*/
//modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t
} // for (; aItF.More(); aItF.Next()) {
//modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f
//
// Post Treatment
TopTools_MapOfOrientedShape aMP;
//
// a. collect all edges that are in loops
aIt.Initialize (myLoops);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aItS.Initialize(aS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aF=aItS.Value();
aMP.Add(aF);
}
}
//
// b. collect all edges that are to avoid
aItM.Initialize(myShapesToAvoid);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aF=aItM.Key();
aMP.Add(aF);
}
//
// c. add all edges that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (!aMP.Contains(aF)) {
myShapesToAvoid.Add(aF);
}
}
//modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t
//=================================================
//
// 2.Internal Shells
//
myLoopsInternal.Clear();
//
Standard_Integer aNbFA;
TopTools_MapIteratorOfMapOfOrientedShape aItM;
//
aEFMap.Clear();
AddedFacesMap.Clear();
//
@ -730,7 +790,50 @@ Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
}
return bRet;
}
//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f
//=======================================================================
//function : IsClosedShell
//purpose :
//=======================================================================
Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
{
Standard_Integer aNbE;
Standard_Boolean bRet;
TopoDS_Iterator aIt;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
//
bRet=Standard_False;
aIt.Initialize(theShell);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Face& aF=TopoDS::Face(aIt.Value());
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
if (BRep_Tool::Degenerated(aE)) {
continue;
}
/*
if (BRep_Tool::IsClosed(aE, aF)) {
continue;
}
*/
if (aE.Orientation()==TopAbs_INTERNAL) {
continue;
}
if (!aM.Add(aE)) {
aM.Remove(aE);
}
}
}
//
aNbE=aM.Extent();
if (!aNbE) {
bRet=!bRet;
}
return bRet;
}
//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t
//BRepTools::Write(aFF, "ff");
//
// ErrorStatus :

View File

@ -360,6 +360,26 @@ static
aBF.SetFace(aFF);
aBF.SetContext(aCtx);
const TopTools_ListOfShape& aSE=aWES.StartElements();
//
//DEB f
/*
{
TopoDS_Compound aCx;
BRep_Builder aBBx;
TopTools_ListIteratorOfListOfShape aItx;
//
aBBx.MakeCompound(aCx);
aBBx.Add(aCx, aFF);
aItx.Initialize(aSE);
for (; aItx.More(); aItx.Next()) {
TopoDS_Shape& aEx=aItx.Value();
aBBx.Add(aCx, aEx);
}
int a=0;
}
*/
//DEB t
//
aBF.SetShapes(aSE);
//
aBF.Perform();

View File

@ -664,9 +664,7 @@ static
//
if (aType==GeomAbs_BSplineSurface||
aType==GeomAbs_Sphere||
//modified by NIZNHY-PKV Wed Nov 29 10:18:50 2006f
GeomAbs_SurfaceOfRevolution) {
//modified by NIZNHY-PKV Wed Nov 29 10:18:55 2006t
if (aTol2D < aTolV3D) {
aTol2D=aTolV3D;
}
@ -790,24 +788,29 @@ static
const GeomAdaptor_Surface& aGAS,
const Standard_Boolean aFlag)
{
Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle;
Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle, aTX;
gp_Pnt2d aPV, aPV1;
gp_Vec2d aV2D;
Handle(Geom2d_Curve) aC2D;
//
aTV=BRep_Tool::Parameter (aV, anEdge, myFace);
if (Precision::IsInfinite(aTV)) {
return 0.;
}
//
BOPTools_Tools2D::CurveOnSurface (anEdge, myFace, aC2D,
aFirst, aLast, aToler, Standard_True);
aTV=BRep_Tool::Parameter (aV, anEdge, myFace);
if (Precision::IsInfinite(aTV))
return 0.;
//dt=1.e-7;
dt=Tolerance2D(aV, aGAS);
if(dt > (aLast - aFirst) * 0.25) {
//modified by NIZNHY-PKV Wed Sep 10 14:06:04 2008f
//dt=Tolerance2D(aV, aGAS);
dt=2.*Tolerance2D(aV, aGAS);
//modified by NIZNHY-PKV Wed Sep 10 14:06:07 2008t
//
aTX=0.25*(aLast - aFirst);
if(dt > aTX) {
// to save direction of the curve as much as it possible
// in the case of big tolerances
dt = (aLast - aFirst) * 0.25;
dt = aTX;
}
//
if (fabs (aTV-aFirst) < fabs(aTV - aLast)) {
@ -816,27 +819,22 @@ static
else {
aTV1=aTV - dt;
}
gp_Pnt2d aPV, aPV1;
//
aC2D->D0 (aTV, aPV);
aC2D->D0 (aTV1, aPV1);
gp_Vec2d aV2D;
//
if (aFlag) {//IN
gp_Vec2d aV2DIn(aPV1, aPV);
//
aV2D=aV2DIn;
}
else {
gp_Vec2d aV2DOut(aPV, aPV1);
aV2D=aV2DOut;
}
//
gp_Dir2d aDir2D(aV2D);
anAngle=Angle(aDir2D);
//
return anAngle;
}
//=======================================================================