//======================================================================= // function:EFNewVertices // purpose: //======================================================================= 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, iTmp; Standard_Real aT; TopoDS_Compound aCompound; TopoDS_Vertex aNewVertex; BRep_Builder aBB; BOPTools_Pave aPave; NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEF; BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; // 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)); EFNewVertices(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 NMTTools_PaveFiller tPF; // tPF.SetCompositeShape(aCompound); // tPF.Init(); tPF.PerformVV(); // 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(); 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)); EFNewVertices(aV, aMapVI); } // // 3. Fill Maps : NewVertex-edges (aMNVE) // NewVertex-interferences (aMNVIEE) aNb=aVVInterfs.Extent(); for (i=1; i<=aNb; ++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 (!aMNVIEF.Contains(aNewShape)) { TColStd_IndexedMapOfInteger aMx; aMNVIEF.Add(aNewShape, aMx); } // TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.ChangeFromKey(aNewShape); // aVV.Indices(aWhat, aWith); //aWhat const TopoDS_Shape& aV1=tDS.Shape(aWhat); iX=aMapVI.FindFromKey(aV1); const BOPTools_ESInterference& aEF1=aEFs(iX); aEF1.Indices(nE, nF); // if (myDS->GetShapeType(nF)==TopAbs_EDGE) { iTmp=nE; nE=nF; nF=iTmp; } aME.Add(nE); aMIEF.Add(iX); //aWith const TopoDS_Shape& aV2=tDS.Shape(aWith); iX=aMapVI.FindFromKey(aV2); const BOPTools_ESInterference& aEF2=aEFs(iX); aEF2.Indices(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 // // 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 EF interferences const TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.FindFromKey(nV); aNbIEF=aMIEF.Extent(); for (j=1; j<=aNbIEF; ++j) { iX=aMIEF(j); BOPTools_ESInterference& aEF=aEFs(iX); aEF.SetNewShape(aNewShape); } // // Update Paves on all 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_EdgeSurface); aPave.SetIndex(aNewShape); aPave.SetParam(aT); // BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); aPaveSet.Append(aPave); } } } }