#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
+#include <TopExp.hxx>
+
#include <TopTools_IndexedMapOfShape.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_ESInterference.hxx>
-#include <BOPTools_InterferencePool.hxx>
+
#include <BOPTools_CArray1OfVVInterference.hxx>
#include <BOPTools_CArray1OfESInterference.hxx>
#include <BOPTools_VVInterference.hxx>
#include <BOPTools_IMapOfPaveBlock.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
+#include <NMTDS_Iterator.hxx>
+#include <NMTDS_InterfPool.hxx>
#include <NMTTools_ListOfCommonBlock.hxx>
#include <NMTTools_CommonBlockAPI.hxx>
#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
#include <NMTTools_CommonBlockAPI.hxx>
#include <NMTTools_ListOfCommonBlock.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopExp.hxx>
+
static
void VertexParameter(const IntTools_CommonPrt& aCPart,
//=======================================================================
void NMTTools_PaveFiller::PerformEF()
{
- myIsDone=Standard_False;
-
- Standard_Integer n1, n2, anIndexIn=0, nE, nF, aNbEFs, aBlockLength;
Standard_Boolean bJustAdd;
- Standard_Real aTolE, aTolF, aDeflection=0.01;
- Standard_Integer aDiscretize=35;
+ Standard_Integer n1, n2, anIndexIn, nE, nF, aNbEFs, aBlockLength;
+ Standard_Integer aDiscretize;
+ Standard_Real aTolE, aTolF, aDeflection;
BooleanOperations_IndexedDataMapOfShapeInteger aMapVI;
BOPTools_IDMapOfPaveBlockIMapOfInteger aMapCB;
BOPTools_IMapOfPaveBlock aIMPBx;
//
- BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
+ myIsDone=Standard_False;
+ aDeflection=0.01;
+ aDiscretize=35;
//
- myDSIt.Initialize(TopAbs_EDGE, TopAbs_FACE);
+ BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
+ //
+ myDSIt->Initialize(TopAbs_EDGE, TopAbs_FACE);
//
// BlockLength correction
- aNbEFs=ExpectedPoolLength();
+ aNbEFs=myDSIt->BlockLength();
aBlockLength=aEFs.BlockLength();
if (aNbEFs > aBlockLength) {
aEFs.SetBlockLength(aNbEFs);
}
//
- for (; myDSIt.More(); myDSIt.Next()) {
- myDSIt.Current(n1, n2, bJustAdd);
- anIndexIn = 0;
+ for (; myDSIt->More(); myDSIt->Next()) {
+ myDSIt->Current(n1, n2, bJustAdd);
//
- if (myIntrPool->IsComputed(n1, n2)) {
+ if(bJustAdd) {
continue;
}
//
+ anIndexIn = 0;
+ //
nE=n1;
- nF=n2;
- SortTypes(nE, nF);
+ nF=n2;
+ if (myDS->GetShapeType(n2)==TopAbs_EDGE) {
+ nE=n2;
+ nF=n1;
+ }
//
// all Common Blocks for face nF
- //XXX
NMTTools_ListOfCommonBlock aLCBF;
CommonBlocksFace(nF, aLCBF);
NMTTools_CommonBlockAPI aCBAPIF(aLCBF);
- //XXX
- if(bJustAdd) {
- myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
- continue;
- }
+ //
// Edge
- const TopoDS_Edge aE=TopoDS::Edge(myDS->GetShape(nE));//mpv
+ const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
if (BRep_Tool::Degenerated(aE)){
continue;
}
+ //
// Face
- const TopoDS_Face aF=TopoDS::Face(myDS->GetShape(nF));//mpv
+ const TopoDS_Face aF=TopoDS::Face(myDS->Shape(nF));
//
- // Modified
- // to avoid intersection between face and edge from that face
- // Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
TopTools_IndexedMapOfShape aME;
- //
TopExp::MapShapes(aF, TopAbs_EDGE, aME);
if (aME.Contains(aE)) {
continue;
}
- // Contribution of Samtech www.samcef.com END
//
aTolF=BRep_Tool::Tolerance(aF);
-
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
aTolE=BRep_Tool::Tolerance(aE);
- // Contribution of Samtech www.samcef.com END
const Bnd_Box& aBBF=myDS->GetBoundingBox(nF);
//
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
for (; anIt.More(); anIt.Next()) {
BOPTools_PaveBlock& aPB=anIt.Value();
- //XXX
if (aCBAPIF.IsCommonBlock(aPB)) {
continue;
}
- //XXX
+ //
const IntTools_ShrunkRange& aShrunkRange=aPB.ShrunkRange();
const IntTools_Range& aSR =aShrunkRange.ShrunkRange();
- const Bnd_Box& aBBE=aShrunkRange.BndBox();
+ const Bnd_Box& aBBE=aShrunkRange.BndBox();
//
if (aBBF.IsOut (aBBE)) {
continue;
aEF.Perform();
//
if (aEF.IsDone()) {
- const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts();
+ Standard_Boolean bCoinsideFlag;
Standard_Integer i, aNbCPrts;
+ TopAbs_ShapeEnum aType;
+ //
+ const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts();
+ //
aNbCPrts=aCPrts.Length();
- for (i=1; i<=aNbCPrts; i++) {
- //
+ for (i=1; i<=aNbCPrts; ++i) {
anIndexIn=0;
//
const IntTools_CommonPrt& aCPart=aCPrts(i);
- TopAbs_ShapeEnum aType=aCPart.Type();
+ aType=aCPart.Type();
+ //
switch (aType) {
-
+ //
case TopAbs_VERTEX: {
Standard_Boolean bIsOnPave1, bIsOnPave2;
Standard_Integer nVF;
//
//decide to add pave or not
aTolToDecide=5.e-8;
- //
bIsOnPave1=IsOnPave(anewSR.First(), aR, aTolToDecide);
bIsOnPave2=IsOnPave(anewSR.Last() , aR, aTolToDecide);
//
aMapVI.Add(aNewVertex, anIndexIn);
aIMPBx.Add(aPB);
//
+ myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF);
+ //
}// if (!nVF)
}// if (!bIsOnPave1 && !bIsOnPave2)
- myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
+ //
+ //modified by NIZNHY-PKV Fri Apr 18 10:55:38 2008f
+ else {
+ const BOPTools_Pave& aPave=(bIsOnPave1)? aPB.Pave1() : aPB.Pave2();
+ nVF=aPave.Index();
+ const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
+ BOPTools_Tools::UpdateVertex (aVF, aNewVertex);
+ }
+ //modified by NIZNHY-PKV Fri Apr 18 10:55:40 2008t
+ //
}// case TopAbs_VERTEX:
break;
//
case TopAbs_EDGE: {
- Standard_Boolean aCoinsideFlag;
- //
- aCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext);
- if (!aCoinsideFlag) {
- myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
+ bCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext);
+ if (!bCoinsideFlag) {
break;
}
//
aMapF.Add(nF);
aMapCB.Add(aPB, aMapF);
}
- //modified by NIZNHY-PKV Fri Jan 23 14:13:08 2004 f
+ //
aIMPBx.Add(aPB);
- //modified by NIZNHY-PKV Fri Jan 23 14:13:10 2004 t
+ myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF);
}// case TopAbs_EDGE:
break;
// function:EFCommonBlocks
// purpose:
//=======================================================================
- void NMTTools_PaveFiller::EFCommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB)
+ void NMTTools_PaveFiller::EFCommonBlocks
+ (const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB)
{
Standard_Integer i, aNbPB, nE, j, aNbF, nF;
//
aNbPB=aMapCB.Extent();
- //
for (i=1; i<=aNbPB; ++i) {
const BOPTools_PaveBlock& aPB=aMapCB.FindKey(i);
const TColStd_IndexedMapOfInteger& aMapF=aMapCB.FindFromIndex(i);
// function:EFNewVertices
// purpose:
//=======================================================================
- void NMTTools_PaveFiller::EFNewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
+ void NMTTools_PaveFiller::EFNewVertices
+ (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
{
Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple;
- Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges;
+ Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges, iTmp;
Standard_Real aT;
TopoDS_Compound aCompound;
TopoDS_Vertex aNewVertex;
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple;
//
- BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
- //
aNb=aMapVI.Extent();
- //
if (!aNb) { // no new vertices, no new problems
return;
}
//
+ BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
+ //
// 0.
if (aNb==1) {
aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1));
//
// 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);
+ NMTTools_PaveFiller tPF;
//
- tPaveFiller.Init();
+ tPF.SetCompositeShape(aCompound);
//
- tPaveFiller.PerformVV();
- tPaveFiller.PerformNewVertices();
+ tPF.Init();
+ tPF.PerformVV();
//
- const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs();
+ NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
+ NMTDS_InterfPool& tInterfPool=*(tPF.IP());
+ BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterferences();
//
// 3. Separate Comlex and Simple new vertices
aNbVV=aVVInterfs.Extent();
iX=aMapVI.FindFromKey(aV1);
const BOPTools_ESInterference& aEF1=aEFs(iX);
aEF1.Indices(nE, nF);
- SortTypes(nE, nF);
+ //
+ if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
+ iTmp=nE;
+ nE=nF;
+ nF=iTmp;
+ }
aME.Add(nE);
aMIEF.Add(iX);
//aWith
iX=aMapVI.FindFromKey(aV2);
const BOPTools_ESInterference& aEF2=aEFs(iX);
aEF2.Indices(nE, nF);
- SortTypes(nE, nF);
+ //
+ if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
+ iTmp=nE;
+ nE=nF;
+ nF=iTmp;
+ }
aME.Add(nE);
aMIEF.Add(iX);
- }
+ }// for (i=1; i<=aNb; ++i) {
+ //
// 4. Process new vertices
aNb=aMNVE.Extent();
for (i=1; i<=aNb; ++i) { // xx
// function:EFNewVertices
// purpose:
//=======================================================================
- void NMTTools_PaveFiller::EFNewVertices (const TopoDS_Vertex& aNewVertex,
- const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
+ void NMTTools_PaveFiller::EFNewVertices
+ (const TopoDS_Vertex& aNewVertex,
+ const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
{
Standard_Integer i, aNewShape, nE, nF;
Standard_Real aT;
BOPTools_Pave aPave;
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
//
- BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
+ BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
//
// Insert New Vertex in DS;
myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
aNewShape=myDS->NumberOfInsertedShapes();
myDS->SetState (aNewShape, BooleanOperations_ON);
+ //
// Insert New Vertex in EFInterference
i=aMapVI.FindFromKey(aNewVertex);
BOPTools_ESInterference& aEFInterf= aEFs(i);
aEFInterf.SetNewShape(aNewShape);
// Extract interference info
aEFInterf.Indices(nE, nF);
- SortTypes(nE, nF);
+ if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
+ nE=nF;
+ }
const IntTools_CommonPrt& aCPart=aEFInterf.CommonPrt();
VertexParameter(aCPart, aT);
//
// function: CheckFacePaves
// purpose:
//=======================================================================
- Standard_Integer NMTTools_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aNewVertex,
- const Standard_Integer nF)
+ Standard_Integer NMTTools_PaveFiller::CheckFacePaves
+ (const TopoDS_Vertex& aNewVertex,
+ const Standard_Integer nF)
{
- Standard_Integer nEF, nVF, iFlag, i, aNbV;
+ Standard_Integer nEF, nVF, iFlag, i, aNbV, iRet;
BOPTools_ListIteratorOfListOfPave anIt;
TColStd_IndexedMapOfInteger aMVF;
- //
- BooleanOperations_OnceExplorer aExp(*myDS);
//
+ iRet=0;
+ //
+ BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nEF=aExp.Current();
aNbV=aMVF.Extent();
for (i=1; i<=aNbV; ++i) {
nVF=aMVF(i);
- const TopoDS_Vertex aVF=TopoDS::Vertex(myDS->Shape(nVF));//mpv
+ const TopoDS_Vertex aVF=TopoDS::Vertex(myDS->Shape(nVF));
iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF);
if (!iFlag) {
return nVF;
}
}
- return 0;
+ return iRet;
}
-
//
//=======================================================================
// function: VertexParameter
{
const IntTools_Range& aR=aCPart.Range1();
aT=0.5*(aR.First()+aR.Last());
- //
if((aCPart.VertexParameter1() >= aR.First()) &&
(aCPart.VertexParameter1() <= aR.Last())) {
aT = aCPart.VertexParameter1();
if (bIsOnPave) {
return bIsOnPave;
}
+ //
dT1=Abs(aTR-aT1);
dT2=Abs(aTR-aT2);
bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance);