From 8eeb233c7c017b837fff304fe3608443f88a51ee Mon Sep 17 00:00:00 2001 From: msv Date: Mon, 16 Oct 2017 17:42:42 +0300 Subject: [PATCH] # take some changes from the branch CR29144. # simplify changes in BOPDS_DS.cxx. --- src/BOPAlgo/BOPAlgo_PaveFiller.hxx | 1 + src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 83 ++++++++++++++++++++-------- src/BOPDS/BOPDS_DS.cxx | 25 +++------ 3 files changed, 70 insertions(+), 39 deletions(-) diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx index bd4e512fae..ae9611afc1 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx @@ -493,6 +493,7 @@ protected: Standard_Boolean myIsPrimary; Standard_Boolean myAvoidBuildPCurve; BOPAlgo_GlueEnum myGlue; + NCollection_DataMap> myMapICB; private: diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 37a16e2254..b7e65aec3b 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -1045,22 +1045,11 @@ void BOPAlgo_PaveFiller::PostTreatFF iE=myDS->Append(aSI); } // - // update real edge tolerance according to distances in common block if any - if (aPDS->IsCommonBlock(aPBRx)) { - const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx); - Standard_Real *pTol = aMCBTol.ChangeSeek(aCB); - if (!pTol) { - Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context()); - pTol = aMCBTol.Bound(aCB, aTol); - } - // - if (aNC.Tolerance() < *pTol) { - aNC.SetTolerance(*pTol); - } - } - // append new PaveBlock to aLPBC + Handle(BOPDS_PaveBlock) *pPBC = aMEPB.ChangeSeek(iE); - if (!pPBC) { + // append new PaveBlock to aLPBC + if (!pPBC) + { pPBC = aMEPB.Bound(iE, new BOPDS_PaveBlock()); BOPDS_Pave aPaveR1, aPaveR2; aPaveR1 = aPBRx->Pave1(); @@ -1073,13 +1062,44 @@ void BOPAlgo_PaveFiller::PostTreatFF (*pPBC)->SetEdge(iE); } // - if (bOld) { + if (bOld) + { (*pPBC)->SetOriginalEdge(aPB1->OriginalEdge()); aDMExEdges.ChangeFind(aPB1).Append(*pPBC); } - else { + else + { aLPBC.Append(*pPBC); } + + // update real edge tolerance according to distances in common block if any + if (aPDS->IsCommonBlock(aPBRx)) + { + const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx); + const Standard_Integer anIdxOriE = aPB1->OriginalEdge(); + + if (pPBC && (anIdxOriE > 0)) + { + // If original edge exists + NCollection_List *aListOfPB = myMapICB.ChangeSeek(iE); + if (aListOfPB == 0) + { + aListOfPB = myMapICB.Bound(iE, NCollection_List()); + } + + aListOfPB->Append(*pPBC); + } + + Standard_Real *pTol = aMCBTol.ChangeSeek(aCB); + if (!pTol) { + Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context()); + pTol = aMCBTol.Bound(aCB, aTol); + } + // + if (aNC.Tolerance() < *pTol) { + aNC.SetTolerance(*pTol); + } + } } } } @@ -2417,18 +2437,35 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks anEF.SetContext(myContext); anEF.Perform(); // - const IntTools_SequenceOfCommonPrts& aCPrts=anEF.CommonParts(); - if (aCPrts.Length() == 1) { + const IntTools_SequenceOfCommonPrts& aCPrts = anEF.CommonParts(); + if (aCPrts.Length() == 1) + { Standard_Boolean bCoinc = (aCPrts(1).Type() == TopAbs_EDGE); - if (bCoinc) { - if (bCB) { + if (bCoinc) + { + if (bCB) + { aCB = myDS->CommonBlock(aPBChangeValue); - } else { + const NCollection_List *aListOfPB = myMapICB.Seek(aPBChangeValue->Edge()); + if (aListOfPB) + { + NCollection_List::Iterator anItr(*aListOfPB); + for (; anItr.More(); anItr.Next()) + { + Handle(BOPDS_PaveBlock) &aCurrPB = anItr.ChangeValue(); + aCB->AddPaveBlock(aCurrPB); + myDS->SetCommonBlock(aCurrPB, aCB); + } + } + aCB->AddFace(nF); + } + else + { aCB = new BOPDS_CommonBlock; aCB->AddPaveBlock(aPBChangeValue); + aCB->AddFace(nF); myDS->SetCommonBlock(aPBChangeValue, aCB); } - aCB->AddFace(nF); // aMPBIn.Add(aPBChangeValue); } diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index 9ed03f53d1..c8511d7786 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -1156,13 +1156,7 @@ Handle(BOPDS_CommonBlock) BOPDS_DS::CommonBlock void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB, const Handle(BOPDS_CommonBlock)& theCB) { - if (IsCommonBlock(thePB)) { - Handle(BOPDS_CommonBlock)& aCB = myMapPBCB.ChangeFind(thePB); - aCB=theCB; - } - else { - myMapPBCB.Bind(thePB, theCB); - } + myMapPBCB.Bind(thePB, theCB); } // @@ -2114,7 +2108,7 @@ Standard_Boolean BOPDS_DS::IsValidShrunkData(const Handle(BOPDS_PaveBlock)& theP //======================================================================= void BOPDS_DS::FilterOfCommonBlocks() { - NCollection_DataMap aMapEC; + NCollection_DataMap aMapEC; BOPDS_VectorOfListOfPaveBlock& aPBP = ChangePaveBlocksPool(); Standard_Integer aNbPBP = aPBP.Extent(); // @@ -2131,18 +2125,17 @@ void BOPDS_DS::FilterOfCommonBlocks() continue; const Standard_Integer anEIdx = aPB->Edge(); - const TopoDS_Edge &anE = TopoDS::Edge(Shape(anEIdx)); - Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anE); + Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anEIdx); if (!aCB) { - aCB = aMapEC.Bound(anE, CommonBlock(aPB)); - continue; + aCB = aMapEC.Bound(anEIdx, CommonBlock(aPB)); + } + else + { + (*aCB)->AddPaveBlock(aPB); + SetCommonBlock(aPB, *aCB); } - - myMapPBCB.UnBind(aPB); - (*aCB)->AddPaveBlock(aPB); - SetCommonBlock(aPB, *aCB); } } } -- 2.39.5