//======================================================================= // function: CheckFacePaves // purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aNewVertex, const Standard_Integer nF) { Standard_Integer nEF, nVF, iFlag, i, aNbV, iRet; BOPTools_ListIteratorOfListOfPave anIt; TColStd_IndexedMapOfInteger aMVF; // iRet=0; // BooleanOperations_OnceExplorer aExp(*myDS); aExp.Init(nF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { nEF=aExp.Current(); BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(nEF)); const BOPTools_ListOfPave& aLP=aPaveSet.Set(); anIt.Initialize(aLP); for (; anIt.More(); anIt.Next()) { const BOPTools_Pave& aPave=anIt.Value(); nVF=aPave.Index(); aMVF.Add(nVF); } } // aNbV=aMVF.Extent(); for (i=1; i<=aNbV; ++i) { nVF=aMVF(i); const TopoDS_Vertex aVF=TopoDS::Vertex(myDS->Shape(nVF)); iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF); if (!iFlag) { return nVF; } } return iRet; }
//======================================================================= // function: PrepareEdges // purpose: //======================================================================= void NMTTools_PaveFiller::PrepareEdges() { Standard_Integer i, nV, ii, aNBSuc, ip, aNbShapesObject; Standard_Real aT; TopAbs_Orientation anOr; TopoDS_Edge aE; TopoDS_Vertex aV; // aNbShapesObject=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=myNbSources; ++i) { if (myDS->GetShapeType(i)==TopAbs_EDGE) { aE=TopoDS::Edge(myDS->Shape(i)); // if (BRep_Tool::Degenerated(aE)){ continue; } // BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(i)); // // A <- aNBSuc=myDS->NumberOfSuccessors(i); for (ii=1; ii <=aNBSuc; ii++) { nV=myDS->GetSuccessor(i, ii); anOr=myDS->GetOrientation(i, ii); aV=TopoDS::Vertex(myDS->Shape(nV)); aV.Orientation(anOr); aT=BRep_Tool::Parameter(aV, aE); // ip=FindSDVertex(nV); if (ip) { aV=TopoDS::Vertex(myDS->Shape(ip)); aV.Orientation(anOr);// XX ? if the edge is closed it'll be amazing result nV=ip; } // BOPTools_Pave aPave(nV, aT); aPaveSet.Append (aPave); } } } }
//======================================================================= // function: PreparePaveBlocks // purpose: //======================================================================= void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE) { myIsDone=Standard_False; // // char buf[32]={"SR"}; Standard_Boolean bIsValid; Standard_Integer nV1, nV2, iErr; Standard_Real aT1, aT2; TopoDS_Edge aE; TopoDS_Vertex aV1, aV2; // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); // Edge aE=TopoDS::Edge(myDS->Shape(nE)); if (BRep_Tool::Degenerated(aE)) { myIsDone=Standard_True; return; } // BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); BOPTools_PaveBlockIterator aPBIt(nE, aPS); for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); const IntTools_Range& aRange=aPB.Range(); // const BOPTools_Pave& aPave1=aPB.Pave1(); nV1=aPave1.Index(); aV1=TopoDS::Vertex(myDS->Shape(nV1)); aT1=aPave1.Param(); // const BOPTools_Pave& aPave2=aPB.Pave2(); nV2=aPave2.Index(); aV2=TopoDS::Vertex(myDS->Shape(nV2)); aT2=aPave2.Param(); // bIsValid=Standard_True; if (nV1==nV2) { bIsValid=IsValid(aE, aV1, aT1, aT2); if (!bIsValid) { //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); myStopStatus=1; } } // IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); iErr=aSR.ErrorStatus(); if (!aSR.IsDone()) { //printf(" pb SR: Done nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); aSR.SetShrunkRange(aRange); //throw BOPTColStd_Failure(buf) ; } else if (iErr!=6) { CorrectShrunkRanges (0, aPave1, aSR); CorrectShrunkRanges (1, aPave2, aSR); } aPB.SetShrunkRange(aSR); aLPB.Append(aPB); } //for (; aPBIt.More(); aPBIt.Next()) myIsDone=Standard_True; }
//======================================================================= // function: PerformVE // purpose: //======================================================================= void NMTTools_PaveFiller::PerformVE() { myIsDone=Standard_False; // Standard_Boolean bJustAdd; Standard_Integer n1, n2, anIndexIn, aFlag, aWhat; Standard_Integer aWith, aNbVEs, aBlockLength, iSDV, nV1; Standard_Real aT; #if OCC_VERSION_LARGE > 0x06030008 // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method Standard_Boolean bToUpdateVertex; Standard_Real aDist; #endif TopoDS_Vertex aV1; TopoDS_Edge aE2; BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; BOPTools_CoupleOfInteger aCouple; // BOPTools_CArray1OfVEInterference& aVEs=myIP->VEInterferences(); // myDSIt->Initialize (TopAbs_VERTEX, TopAbs_EDGE); // // BlockLength correction aNbVEs=myDSIt->BlockLength(); aBlockLength=aVEs.BlockLength(); if (aNbVEs > aBlockLength) { aVEs.SetBlockLength(aNbVEs); } // for (; myDSIt->More(); myDSIt->Next()) { myDSIt->Current(n1, n2, bJustAdd); if (!IsSuccessorsComputed(n1, n2)) { anIndexIn=0; aWhat=n1; // Vertex aWith=n2; // Edge if (myDS->GetShapeType(n1)==TopAbs_EDGE) { aWhat=n2; aWith=n1; } // if(bJustAdd) { continue; } // Edge aE2=TopoDS::Edge(myDS->Shape(aWith)); if (BRep_Tool::Degenerated(aE2)){ continue; } // Vertex nV1=aWhat; aV1=TopoDS::Vertex(myDS->Shape(aWhat)); // iSDV=FindSDVertex(aWhat); if (iSDV) { nV1=iSDV; aV1=TopoDS::Vertex(myDS->Shape(nV1)); // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN Standard_Integer nVE, iSDVE, iRet; // BooleanOperations_OnceExplorer aExp(*myDS); iRet=0; aExp.Init(aWith, TopAbs_VERTEX); for (; aExp.More(); aExp.Next()) { nVE=aExp.Current(); iSDVE=FindSDVertex(nVE); if (iSDVE==iSDV) { iRet=1; break; } } if (iRet) { continue; } } else { if (Contains(aE2, aV1)) { continue; } // Contribution of Samtech www.samcef.com END } // //modified by NIZNHY-PKV Mon Dec 28 08:58:05 2009f #if OCC_VERSION_LARGE > 0x06030008 // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method aFlag = myContext->ComputeVE (aV1, aE2, aT, bToUpdateVertex, aDist); #else aFlag = myContext->ComputeVE (aV1, aE2, aT); #endif //modified by NIZNHY-PKV Mon Dec 28 08:58:13 2009t // if (!aFlag) { // Add Interference to the Pool BOPTools_VEInterference anInterf (aWhat, aWith, aT); anIndexIn=aVEs.Append(anInterf); // // Add Pave to the Edge's myPavePool aCouple.SetCouple(nV1, aWith); if (!aSnareMap.Contains(aCouple)){ aSnareMap.Add(aCouple); // BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); aPave.SetInterference(anIndexIn); BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); aPaveSet.Append(aPave); } // // State for the Vertex in DS; myDS->SetState (aWhat, BooleanOperations_ON); // Insert Vertex in Interference Object BOPTools_VEInterference& aVE=aVEs(anIndexIn); aVE.SetNewShape(aWhat); // myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE); // //modified by NIZNHY-PKV Mon Dec 28 09:00:54 2009f #if OCC_VERSION_LARGE > 0x06030008 // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method if (bToUpdateVertex) { BRep_Builder aBB; // aBB.UpdateVertex(aV1, aDist); } #endif //modified by NIZNHY-PKV Mon Dec 28 09:00:57 2009t // } //if (!aFlag) { } } myIsDone=Standard_True; }