theWires.Append(aW);
}
}
-
//=======================================================================
//function : IsInside
//purpose :
const TopoDS_Shape& theF2,
IntTools_PContext& theContext)
{
+ Standard_Boolean bRet;
Standard_Real aT, aU, aV;
+
+ TopAbs_State aState;
TopExp_Explorer aExp;
- TopAbs_State aState=TopAbs_UNKNOWN;
+ TopTools_IndexedMapOfShape aME2;
gp_Pnt2d aP2D;
//
+ bRet=Standard_False;
+ aState=TopAbs_UNKNOWN;
const TopoDS_Face& aF2=TopoDS::Face(theF2);
//
+ TopExp::MapShapes(aF2, TopAbs_EDGE, aME2);
+ //
aExp.Init(theHole, TopAbs_EDGE);
- if (aExp.More()){
+ if (aExp.More()) {
const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
+ if (aME2.Contains(aE)) {
+ return bRet;
+ }
+ //
aT=BOPTools_Tools2D::IntermediatePoint(aE);
BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV);
aP2D.SetCoord(aU, aV);
//
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
aState=aClsf.Perform(aP2D);
+ bRet=(aState==TopAbs_IN);
}
- return (aState==TopAbs_IN);
+ //
+ return bRet;
}
+
//=======================================================================
//function : IsGrowthWire
//purpose :
}
return bRet;
}
-//modified by NIZNHY-PKV Mon Sep 18 13:18:27 2006f
-/*
-static
- Standard_Boolean IsHole(const TopoDS_Shape& ,
- const TopoDS_Face& ,
- IntTools_PContext& );
-*/
-//modified by NIZNHY-PKV Mon Sep 18 13:18:34 2006t
-//modified by NIZNHY-PKV Mon Sep 18 13:18:13 2006f
+
+//BRepTools::Write(aFF, "ff");
+//
+// ErrorStatus :
+// 11 - Null Context
+// 12 - Null face generix
+
/*
//=======================================================================
-//function : IsHole
+//function : IsInside
//purpose :
//=======================================================================
-Standard_Boolean IsHole(const TopoDS_Shape& theS2,
- const TopoDS_Face& theFace,
- IntTools_PContext& theContext)
+Standard_Boolean IsInside(const TopoDS_Shape& theHole,
+ const TopoDS_Shape& theF2,
+ IntTools_PContext& theContext)
{
- Standard_Boolean bIsHole;
- Standard_Real aTol;
- Handle(Geom_Surface) aS;
- TopLoc_Location aLoc;
- TopoDS_Face aF;
- BRep_Builder aBB;
- //
- aTol=BRep_Tool::Tolerance(theFace);
- aS=BRep_Tool::Surface(theFace, aLoc);
- aBB.MakeFace(aF, aS, aLoc, aTol);
- aBB.Add (aF, theS2);
- //
- IntTools_FClass2d& aClsf=theContext->FClass2d(aF);
- //
- bIsHole=aClsf.IsHole();
+ Standard_Real aT, aU, aV;
+ TopExp_Explorer aExp;
+ TopAbs_State aState=TopAbs_UNKNOWN;
+ gp_Pnt2d aP2D;
//
- return bIsHole;
+ const TopoDS_Face& aF2=TopoDS::Face(theF2);
//
+ aExp.Init(theHole, TopAbs_EDGE);
+ if (aExp.More()){
+ const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
+ aT=BOPTools_Tools2D::IntermediatePoint(aE);
+ BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV);
+ aP2D.SetCoord(aU, aV);
+ //
+ IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
+ aState=aClsf.Perform(aP2D);
+ }
+ return (aState==TopAbs_IN);
}
*/
-//modified by NIZNHY-PKV Mon Sep 18 13:18:06 2006t
-
-//BRepTools::Write(aFF, "ff");
-//
-// ErrorStatus :
-// 11 - Null Context
-// 12 - Null face generix
-
#include <GEOMAlgo_Gluer.ixx>
+#include <NMTDS_BoxBndTree.hxx>
+#include <NCollection_UBTreeFiller.hxx>
+
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
-#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx> //qft
-#include <GEOMAlgo_PassKeyShape.hxx>//qft
+#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
+#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_Tools.hxx>
//
{
myErrorStatus=0;
//
- Standard_Integer j, i, aNbV, aIndex, aNbVSD;
+ Standard_Integer j, i, aNbV, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
- Handle(Bnd_HArray1OfBox) aHAB;
- Bnd_BoundSortBox aBSB;
- TopoDS_Shape aSTmp, aVF;
+ TopoDS_Shape aVF;
TopoDS_Vertex aVnew;
TopTools_IndexedMapOfShape aMV, aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
+ NMTDS_BoxBndTreeSelector aSelector;
+ NMTDS_BoxBndTree aBBTree;
+ NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
+ //
+ //
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
return;
}
//
- aHAB=new Bnd_HArray1OfBox(1, aNbV);
- //
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
//
aBox.SetGap(myTol);
BRepBndLib::Add(aV, aBox);
- aHAB->SetValue(i, aBox);
+ //
+ aTreeFiller.Add(i, aBox);
+ //
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
- aBSB.Initialize(aHAB);
+ aTreeFiller.Fill();
//
+ //------------------------------
+ // Chains
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
continue;
}
//
- const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
- const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
- aNbVSD=aLI.Extent();
- if (!aNbVSD) {
- myErrorStatus=3; // it must not be
- return;
- }
+ Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
+ TopTools_ListOfShape aLVSD;
+ TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
+ TColStd_MapIteratorOfMapOfInteger aIt1;
//
- // Images
+ aMIP.Add(i);
+ while(1) {
+ aNbIP=aMIP.Extent();
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it must not be
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
+ }//for(; aIt1.More(); aIt1.Next()) {
+ //
+ aNbIP1=aMIP1.Extent();
+ if (!aNbIP1) {
+ break;
+ }
+ //
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
+ }
+ //
+ aMIP.Clear();
+ aIt1.Initialize(aMIP1);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
+ }
+ aMIP1.Clear();
+ }// while(1)
//
- TopTools_ListOfShape aLVSD;
+ // Fill myImages
+ aNbIP=aMIPC.Extent();
//
- aIt.Initialize(aLI);
- for (j=0; aIt.More(); aIt.Next(), ++j) {
- aIndex=aIt.Value();
- const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
- if(!j) {
- aVF=aVx;
+ if (!aNbIP) {// no SD vertices founded
+ aVF=aV;
+ aLVSD.Append(aV);
+ aMVProcessed.Add(aV);
+ }
+ else { // SD vertices founded [ aMIPC ]
+ aIt1.Initialize(aMIPC);
+ for(j=0; aIt1.More(); aIt1.Next(), ++j) {
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
}
- aLVSD.Append(aVx);
- aMVProcessed.Add(aVx);
}
- //
myImages.Bind(aVF, aLVSD);
- }
+ }// for (i=1; i<=aNbV; ++i) {
+ //------------------------------
//
// Make new vertices
aMV.Clear();
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
- //
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
TopoDS_Shape aNewShape;
TopTools_IndexedMapOfShape aMF;
TopTools_ListIteratorOfListOfShape aItS;
- GEOMAlgo_PassKeyShape aPKF;//qft
- GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;//qft
+ GEOMAlgo_PassKeyShape aPKF;
+ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
//
TopExp::MapShapes(myShape, aType, aMF);
//
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aS=aMF(i);
//
- //aPKF.Clear();//qft
if (aType==TopAbs_FACE) {
const TopoDS_Face& aF=TopoDS::Face(aS);
FacePassKey(aF, aPKF);
void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
GEOMAlgo_PassKeyShape& aPK)
{
- Standard_Integer i, aNbE;//, aNbMax;//qft
+ Standard_Integer i, aNbE;
TopTools_ListOfShape aLE;
TopTools_IndexedMapOfShape aME;
//
TopExp::MapShapes(aF, TopAbs_EDGE, aME);
aNbE=aME.Extent();
- //qf
- /*
- aNbMax=aPK.NbMax();
- if (!aNbE || aNbE>aNbMax) {
- myErrorStatus=101; // temprorary
- return;
- }
- */
- //qt
//
for (i=1; i<=aNbE; ++i) {
const TopoDS_Shape& aE=aME(i);
const TopoDS_Shape& aER=myOrigins.Find(aE);
aLE.Append(aER);
}
- //qf
- //aPK.SetIds(aLE);
aPK.SetShapes(aLE);
- //qt
}
//=======================================================================
//function : EdgePassKey
}
const TopoDS_Shape& aVR1=myOrigins.Find(aV1);
const TopoDS_Shape& aVR2=myOrigins.Find(aV2);
- //qf
- //aPK.SetIds(aVR1, aVR2);
aPK.SetShapes(aVR1, aVR2);
- //qt
}
//=======================================================================
//function : MakeVertex
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
}
}
-//
//=======================================================================
//function : MakeFace
//purpose :
//
aBB.Add(newWire, aER);
}
- //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f
- //
+ // xf
TopTools_ListOfShape aLW;
//
aLW.Append(aW);
myImages.Bind(newWire, aLW);
myOrigins.Bind(aW, newWire);
- //
- //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t
+ // xt
aBB.Add(newFace, newWire);
}
aNewFace=newFace;
aType=aS.ShapeType();
if (aType==TopAbs_VERTEX ||
aType==TopAbs_EDGE ||
- aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
+ aType==TopAbs_WIRE ||
aType==TopAbs_FACE ||
- aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
- aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
+ aType==TopAbs_SHELL ||
+ aType==TopAbs_SOLID) {
if(myOrigins.IsBound(aS)) {
const TopoDS_Shape& aSnew=myOrigins.Find(aS);
if (!aSnew.IsSame(aS)) {
//=======================================================================
void GEOMAlgo_WESCorrector::DoConnexityBlocks()
{
- Standard_Boolean bRegular;
+ Standard_Boolean bRegular, bClosed;
Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS;
TopTools_ListIteratorOfListOfShape aIt;
TopoDS_Iterator aItE;
aER=aMEC(j);
//
if (aMER.Contains(aER)) {
- Standard_Boolean bClosed;
- //
aER.Orientation(TopAbs_FORWARD);
aLEC.Append(aER);
aER.Orientation(TopAbs_REVERSED);
aLEC.Append(aER);
//
- bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face());
- if (!bClosed) {
+ //modified by NIZNHY-PKV Tue Nov 28 12:02:29 2006f
+ //bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face());
+ //if (!bClosed) {
bRegular=Standard_False;
- }
+ //}
+ //modified by NIZNHY-PKV Tue Nov 28 12:02:33 2006t
}
else {
aLEC.Append(aER);
//
aNbVR=aMVER.Extent();
for (k=1; k<=aNbVR; ++k) {
- const TopTools_ListOfShape& aLER=aMVER(k);//?? it was aMVE(k)
+ const TopTools_ListOfShape& aLER=aMVER(k);
aNbER=aLER.Extent();
if (aNbER==1) {
const TopoDS_Edge& aEx=TopoDS::Edge(aER);
- if (!BRep_Tool::IsClosed(aEx, myWES->Face())) {
+ bClosed=BRep_Tool::IsClosed(aEx, myWES->Face());
+ if (!bClosed) {
bRegular=!bRegular;
break;
}
aTol=2.*Tolerance2D(aVb, aGAS);
aTol2=aTol*aTol;
//
- //modified by NIZNHY-PKV Tue Nov 14 16:56:19 2006f
- /*
- UVTolerance2D(aVb, aGAS, aTolUVb, aTolVVb);
- aTolUVb = 2.*aTolUVb;
- aTolVVb = 2.*aTolVVb;
- */
- //modified by NIZNHY-PKV Tue Nov 14 16:56:26 2006t
- //
aNb=aLS.Length();
if (aNb>0) {
//
//
aD2=aPaPrev.SquareDistance(aPb);
anIsSameV2d =aD2<aTol2;
- //
- //modified by NIZNHY-PKV Tue Nov 14 16:56:49 2006f
- /*
- if(anIsSameV2d) {
- Standard_Real udist, vdist;
- //
- udist=fabs(aPaPrev.X() - aPb.X());
- vdist=fabs(aPaPrev.Y() - aPb.Y());
- if((udist > aTolUVb) || (vdist > aTolVVb)) {
- anIsSameV2d=!anIsSameV2d;
- }
- }
- */
- //modified by NIZNHY-PKV Tue Nov 14 16:56:54 2006t
}//if (anIsSameV) {
//
if (anIsSameV && anIsSameV2d) {
aTol2D=(aVr>anUr) ? aVr : anUr;
//
if (aType==GeomAbs_BSplineSurface||
- aType==GeomAbs_Sphere) {
+ 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;
}
}
return iCnt;
}
-//modified by NIZNHY-PKV Tue Nov 14 16:55:31 2006f
-/*
-static
- void UVTolerance2D (const TopoDS_Vertex& aV,
- const GeomAdaptor_Surface& aGAS,
- Standard_Real& aTolU,
- Standard_Real& aTolV);
-*/
-/*
-//=======================================================================
-//function : UVTolerance2D
-//purpose :
-//=======================================================================
-void UVTolerance2D (const TopoDS_Vertex& aV,
- const GeomAdaptor_Surface& aGAS,
- Standard_Real& aTolU,
- Standard_Real& aTolV)
-{
- Standard_Real aTolV3D;
- //
- aTolV3D = BRep_Tool::Tolerance(aV);
- aTolU=aGAS.UResolution(aTolV3D);
- aTolV=aGAS.VResolution(aTolV3D);
-}
-*/
-//modified by NIZNHY-PKV Tue Nov 14 16:55:39 2006
#include <NMTTools_PaveFiller.ixx>
//
-// Modified Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <BRepBndLib.hxx>
-#include <BOPTools_CArray1OfVSInterference.hxx>
-#include <BOPTools_VSInterference.hxx>
-// Contribution of Samtech www.samcef.com END
-
#include <stdio.h>
#include <Precision.hxx>
-#include <NCollection_UBTreeFiller.hxx>
-
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-#include <gp_XYZ.hxx>
-#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
-#include <TopTools_DataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Range.hxx>
#include <BooleanOperations_KindOfInterference.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_IndexedDataMapOfIntegerShape.hxx>
-#include <NMTDS_IndexedDataMapOfShapeBox.hxx>
-#include <NMTDS_BoxBndTree.hxx>
#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
#include <NMTTools_ListOfCommonBlock.hxx>
#include <NMTTools_CommonBlock.hxx>
#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
+// Modified Thu Sep 14 14:35:18 2006
+// Contribution of Samtech www.samcef.com BEGIN
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <BRepBndLib.hxx>
+#include <BOPTools_CArray1OfVSInterference.hxx>
+#include <BOPTools_VSInterference.hxx>
+// Contribution of Samtech www.samcef.com END
+//
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <Bnd_HArray1OfBox.hxx>
+#include <Bnd_BoundSortBox.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <NMTDS_IndexedDataMapOfIntegerShape.hxx>
+#include <NMTDS_IndexedDataMapOfShapeBox.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <gp_XYZ.hxx>
+#include <gp_Pnt.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <TColStd_MapOfInteger.hxx>
+//
+#include <NMTDS_BoxBndTree.hxx>
+#include <NCollection_UBTreeFiller.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
static
void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
TopoDS_Vertex& aNewVertex);
-
static
void VertexParameters(const IntTools_CommonPrt& aCPart,
Standard_Real& aT1,
static
void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
NMTTools_ListOfCommonBlock& aLCB);
+
//=======================================================================
// function: PerformEE
// purpose:
}//for (; aIt.More(); aIt.Next()) {
}// for (; aItIm.More(); aItIm.Next())
}
+//
+// case: use_02
+// completely rewritten
//=======================================================================
//function : TreatNewVertices
//purpose :
TopTools_DataMapOfShapeListOfShape& myImages,
TopTools_DataMapOfShapeShape& myOrigins)
{
- Standard_Integer j, i, aNbV, aIndex, aNbVSD;
+ Standard_Integer j, i, aNbV, aNbVSD;
Standard_Real aTol;
TColStd_ListIteratorOfListOfInteger aIt;
TopoDS_Shape aSTmp, aVF;
NMTDS_IndexedDataMapOfIntegerShape aMIS;
NMTDS_IndexedDataMapOfShapeBox aMSB;
//
- //
NMTDS_BoxBndTreeSelector aSelector;
NMTDS_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
- //
myImages.Clear();
myOrigins.Clear();
//
//
aTreeFiller.Fill();
//
+ // Chains
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
continue;
}
//
- const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
- aSelector.Clear();
- aSelector.SetBox(aBoxV);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- // Images
- //
+ Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
TopTools_ListOfShape aLVSD;
+ TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
+ TColStd_MapIteratorOfMapOfInteger aIt1;
//
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- aIt.Initialize(aLI);
- for (j=0; aIt.More(); aIt.Next(), ++j) {
- aIndex=aIt.Value();
- const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
- if(!j) {
- aVF=aVx;
+ aMIP.Add(i);
+ while(1) {
+ aNbIP=aMIP.Extent();
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it must not be
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
+ }//for(; aIt1.More(); aIt1.Next()) {
+ //
+ aNbIP1=aMIP1.Extent();
+ if (!aNbIP1) {
+ break; // from while(1)
+ }
+ //
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
+ }
+ //
+ aMIP.Clear();
+ aIt1.Initialize(aMIP1);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
}
- aLVSD.Append(aVx);
- aMVProcessed.Add(aVx);
+ aMIP1.Clear();
+ }// while(1)
+ //...
+ aNbIP=aMIPC.Extent();
+ if (!aNbIP) {
+ //modified by NIZNHY-PKV Tue Jan 9 14:26:09 2007f
+ aMIPC.Add(i);
+ //continue;
+ //modified by NIZNHY-PKV Tue Jan 9 14:26:12 2007t
}
//
+ aIt1.Initialize(aMIPC);
+ for(j=0; aIt1.More(); aIt1.Next(), ++j) {
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
+ }
myImages.Bind(aVF, aLVSD);
- }
+ }// for (i=1; i<=aNbV; ++i) {
+ //------------------------------
//
// Make new vertices
aMV.Clear();
}
}
}
+//
//=======================================================================
//function : MakeNewVertex
//purpose :
}
}
// Contribution of Samtech www.samcef.com END
+/*
+//=======================================================================
+// function:EENewVertices
+// purpose:
+//=======================================================================
+ void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
+{
+ Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple;
+ Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag;
+ Standard_Real aT;
+ TopoDS_Compound aCompound;
+ BRep_Builder aBB;
+ NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE;
+ BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
+ BOPTools_Pave aPave;
+ TopoDS_Vertex aNewVertex;
+ TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple;
+ //
+ BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences();
+ //
+ aNb=aMapVI.Extent();
+ //
+ if (!aNb) { // no new vertices, no new problems
+ return;
+ }
+ //
+ // 0.
+ if (aNb==1) {
+ aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1));
+ EENewVertices(aNewVertex, aMapVI);
+ return;
+ }
+ //
+ // 1. Make compound from new vertices
+ aBB.MakeCompound(aCompound);
+ for (i=1; i<=aNb; ++i) {
+ const TopoDS_Shape& aV=aMapVI.FindKey(i);
+ aBB.Add(aCompound, aV);
+ }
+ //
+ // 2. VV intersection between these vertices
+ // using the auxiliary Filler
+ NMTDS_ShapesDataStructure tDS;
+ //
+ tDS.SetCompositeShape(aCompound);
+ tDS.Init();
+ //
+ BOPTools_InterferencePool tInterfPool(tDS);
+ NMTTools_PaveFiller tPaveFiller(tInterfPool);
+ //
+ tPaveFiller.Init();
+ //
+ tPaveFiller.PerformVV();
+ tPaveFiller.PerformNewVertices();
+ //
+ const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs();
+ //
+ // 3. Separate Comlex and Simple new vertices
+ aNbVV=aVVInterfs.Extent();
+ for (i=1; i<=aNbVV; ++i) {
+ const BOPTools_VVInterference& aVV=aVVInterfs(i);
+ aVV.Indices(aWhat, aWith);
+ const TopoDS_Shape& aV1=tDS.Shape(aWhat);
+ const TopoDS_Shape& aV2=tDS.Shape(aWith);
+ aMNVComplex.Add(aV1);
+ aMNVComplex.Add(aV2);
+ }
+ //
+ for (i=1; i<=aNb; ++i) {
+ const TopoDS_Shape& aV=aMapVI.FindKey(i);
+ if (!aMNVComplex.Contains(aV)) {
+ aMNVSimple.Add(aV);
+ }
+ }
+ //
+ // 4. Treat Simple new Vertices
+ aNbSimple=aMNVSimple.Extent();
+ for (i=1; i<=aNbSimple; ++i) {
+ const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i));
+ EENewVertices(aV, aMapVI);
+ }
+ //
+ // 3. Fill Maps : NewVertex-edges (aMNVE)
+ // NewVertex-interferences (aMNVIEE)
+ for (i=1; i<=aNbVV; ++i) {
+ const BOPTools_VVInterference& aVV=aVVInterfs(i);
+ aNewShape=aVV.NewShape();
+ if (!aNewShape) {
+ continue;
+ }
+ //
+ if (!aMNVE.Contains(aNewShape)) {
+ TColStd_IndexedMapOfInteger aMx;
+ aMNVE.Add(aNewShape, aMx);
+ }
+ if (!aMNVIEE.Contains(aNewShape)) {
+ TColStd_IndexedMapOfInteger aMx;
+ aMNVIEE.Add(aNewShape, aMx);
+ }
+ //
+ TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape);
+ TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape);
+ //
+ aVV.Indices(aWhat, aWith);
+ //aWhat
+ const TopoDS_Shape& aV1=tDS.Shape(aWhat);
+ i1=aMapVI.FindFromKey(aV1);
+ const BOPTools_EEInterference& aEE1=aEEs(i1);
+ aEE1.Indices(nE1, nE2);
+ aME.Add(nE1);
+ aME.Add(nE2);
+ aMIEE.Add(i1);
+ //aWith
+ const TopoDS_Shape& aV2=tDS.Shape(aWith);
+ i2=aMapVI.FindFromKey(aV2);
+ const BOPTools_EEInterference& aEE2=aEEs(i2);
+ aEE2.Indices(nE1, nE2);
+ aME.Add(nE1);
+ aME.Add(nE2);
+ aMIEE.Add(i2);
+ //
+ //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape);
+ }
+ //
+ // 4. Process new vertices
+ aNb=aMNVE.Extent();
+ for (i=1; i<=aNb; ++i) { // xx
+ //
+ // new Vertex
+ nV=aMNVE.FindKey(i);
+ aNewVertex=TopoDS::Vertex(tDS.Shape(nV));
+ //
+ // Insert New Vertex in DS;
+ myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
+ aNewShape=myDS->NumberOfInsertedShapes();
+ myDS->SetState (aNewShape, BooleanOperations_ON);
+ //
+ // Update index of NewShape in EE interferences
+ const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i);
+ aNbIEE=aMIEE.Extent();
+ for (j=1; j<=aNbIEE; ++j) {
+ i1=aMIEE(j);
+ BOPTools_EEInterference& aEE1=aEEs(i1);
+ aEE1.SetNewShape(aNewShape);
+ }
+ //
+ // Update Paves on edges
+ const TColStd_IndexedMapOfInteger& aME=aMNVE(i);
+ aNbEdges=aME.Extent();
+ for (j=1; j<=aNbEdges; ++j) {
+ nE=aME(j);
+ const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv
+ //
+ aFlag=myContext.ComputeVE (aNewVertex, aE, aT);
+ //
+ if (!aFlag) {
+ aPave.SetInterference(-1);
+ aPave.SetType (BooleanOperations_EdgeEdge);
+ aPave.SetIndex(aNewShape);
+ aPave.SetParam(aT);
+ //
+ BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
+ aPaveSet.Append(aPave);
+ }
+ }
+ }// for (i=1; i<=aNb; ++i) {// xx
+}
+//=======================================================================
+// function:EENewVertices
+// purpose:
+//=======================================================================
+ void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex,
+ const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
+{
+ Standard_Integer i, aNewShape, nE1, nE2;
+ Standard_Real aT1, aT2;
+ BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
+ BOPTools_Pave aPave;
+ //
+ BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences();
+ //
+ // one new vertex case is treated in usual way
+ //
+ // Insert New Vertex in DS;
+ myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
+ aNewShape=myDS->NumberOfInsertedShapes();
+ myDS->SetState (aNewShape, BooleanOperations_ON);
+ // Insert New Vertex in EE Interference
+ i=aMapVI.FindFromKey(aNewVertex);
+ BOPTools_EEInterference& aEEInterf= aEEs(i);
+ aEEInterf.SetNewShape(aNewShape);
+ // Extact interference info
+ aEEInterf.Indices(nE1, nE2);
+ const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt();
+ VertexParameters(aCPart, aT1, aT2);
+ //
+ // Add Paves to the myPavePoolNew
+ aPave.SetInterference(i);
+ aPave.SetType (BooleanOperations_EdgeEdge);
+ aPave.SetIndex(aNewShape);
+ // Pave for edge nE1
+ aPave.SetParam(aT1);
+ BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1));
+ aPaveSet1.Append(aPave);
+ // Pave for edge nE2
+ aPave.SetParam(aT2);
+ BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2));
+ aPaveSet2.Append(aPave);
+}
+*/
#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <NMTTools_MapOfPaveBlock.hxx>
+//
+#include <IntTools_ShrunkRange.hxx>
static
Standard_Boolean IsPairFound(const Standard_Integer nF1,
TopTools_ListOfShape& aLS);
// Contribution of Samtech www.samcef.com END
+//modified by NIZNHY-PKV Mon Dec 4 12:56:04 2006f
+static
+ Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
+ IntTools_Context& aCtx);
+//modified by NIZNHY-PKV Mon Dec 4 12:56:08 2006t
+
//=======================================================================
// function: PerformFF
// purpose:
Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided;
// Contribution of Samtech www.samcef.com END
//
+ Standard_Boolean bIsMicroEdge;
Standard_Integer i, aNbFFs, nF1, nF2, aBid=0;
Standard_Integer nV1, nV2, j, aNbCurves;
Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion();
//
BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES);
//
+ //modified by NIZNHY-PKV Mon Dec 4 12:56:35 2006f use_01
+ //
+ NMTTools_Tools::UpdateEdge (aES, aTolR3D);
+ bIsMicroEdge=IsMicroEdge(aES, myContext);
+ if (bIsMicroEdge) {
+ continue;
+ }
+ //
+ //modified by NIZNHY-PKV Mon Dec 4 12:56:38 2006t
+ //
//modified by NIZNHY-PKV Thu Nov 16 11:13:46 2006f SKL/PartC5
{
Handle(Geom2d_Curve) aC2D1, aC2D2;
//
NMTTools_Tools::MakePCurve(aES, aF1, aC2D1);
NMTTools_Tools::MakePCurve(aES, aF2, aC2D2);
- NMTTools_Tools::UpdateEdge (aES, aTolR3D);
+ //NMTTools_Tools::UpdateEdge (aES, aTolR3D); // ft use_01
}
//
}
//
// Contribution of Samtech www.samcef.com END
+
+//modified by NIZNHY-PKV Mon Dec 4 12:30:38 2006f use_01
+//=======================================================================
+//function : IsMicroEdge
+//purpose :
+//=======================================================================
+Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
+ IntTools_Context& aCtx)
+{
+ Standard_Boolean bRet;
+ Standard_Integer iErr;
+ Standard_Real aT1, aT2, aTmp;
+ Handle(Geom_Curve) aC3D;
+ TopoDS_Vertex aV1, aV2;
+ IntTools_Range aR;
+ //
+ bRet=(BRep_Tool::Degenerated(aE) ||
+ !BRep_Tool::IsGeometric(aE));
+ if (bRet) {
+ return bRet;
+ }
+ //
+ aC3D=BRep_Tool::Curve(aE, aT1, aT2);
+ TopExp::Vertices(aE, aV1, aV2);
+ aT1=BRep_Tool::Parameter(aV1, aE);
+ aT2=BRep_Tool::Parameter(aV2, aE);
+ if (aT2<aT1) {
+ aTmp=aT1;
+ aT1=aT2;
+ aT2=aTmp;
+ }
+ //
+ aR.SetFirst(aT1);
+ aR.SetLast(aT2);
+ IntTools_ShrunkRange aSR (aE, aV1, aV2, aR, aCtx);
+ iErr=aSR.ErrorStatus();
+ bRet=!aSR.IsDone();
+ //
+ return bRet;
+}
+//modified by NIZNHY-PKV Mon Dec 4 12:55:50 2006t
aCBIt.Initialize(aLCB);
for (; aCBIt.More(); aCBIt.Next()) {
NMTTools_CommonBlock& aCB=aCBIt.Value();
+ //
+ //modified by NIZNHY-PKV Wed Nov 8 15:59:46 2006f
+ // Among all PBs of aCB the first PB will be one
+ // that have max tolerance value
+ {
+ Standard_Real aTolEx, aTolExMax;
+ BOPTools_ListOfPaveBlock *pLPB, aLPBx;
+ //
+ aTolExMax=-1.;
+ pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
+ aPBIt.Initialize(*pLPB);
+ for (; aPBIt.More(); aPBIt.Next()) {
+ const BOPTools_PaveBlock& aPBx=aPBIt.Value();
+ nEx=aPBx.OriginalEdge();
+ const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
+ aTolEx=BRep_Tool::Tolerance(aEx);
+ if (aTolEx>aTolExMax) {
+ aTolExMax=aTolEx;
+ aLPBx.Prepend(aPBx);
+ }
+ else{
+ aLPBx.Append(aPBx);
+ }
+ }
+ //
+ pLPB->Clear();
+ *pLPB=aLPBx;
+ }
+ //modified by NIZNHY-PKV Wed Nov 8 15:59:50 2006t
+ //
BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
nSp=SplitIndex(aPB);
aPB.SetEdge(nSp);