// Created by: Peter KURNEV // Copyright (c) 2010-2014 OPEN CASCADE SAS // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include #include #include #include #include // // // // // ///////////////////////////////////////////////////////////////////////// //======================================================================= //class : BOPDS_TreeSelector //purpose : //======================================================================= class BOPDS_TSR : public BOPCol_BoxBndTreeSelector{ public: BOPDS_TSR() : BOPCol_BoxBndTreeSelector(), myHasBRep(Standard_False), myTree(NULL) { } // virtual ~BOPDS_TSR() { } // void SetHasBRep(const Standard_Boolean bFlag) { myHasBRep=bFlag; } // void SetTree(BOPCol_BoxBndTree& aTree) { myTree=&aTree; } // void Perform() { if (myHasBRep) { myTree->Select(*this); } } // protected: Standard_Boolean myHasBRep; BOPCol_BoxBndTree *myTree; }; // //======================================================================= typedef BOPCol_NCVector BOPDS_VectorOfTSR; typedef BOPCol_Functor BOPDS_TSRFunctor; typedef BOPCol_Cnt BOPDS_TSRCnt; ///////////////////////////////////////////////////////////////////////// //======================================================================= //function : //purpose : //======================================================================= BOPDS_Iterator::BOPDS_Iterator() : myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()), myRunParallel(Standard_False) { Standard_Integer i, aNb; // myDS=NULL; myLength=0; // aNb=BOPDS_DS::NbInterfTypes(); myLists.SetIncrement(aNb); for (i=0; i=0) { myIterator.Initialize(myLists(iX)); myLength=myLists(iX).Extent(); } } //======================================================================= // function: More // purpose: //======================================================================= Standard_Boolean BOPDS_Iterator::More()const { return myIterator.More(); } //======================================================================= // function: Next // purpose: //======================================================================= void BOPDS_Iterator::Next() { myIterator.Next(); } //======================================================================= // function: Value // purpose: //======================================================================= void BOPDS_Iterator::Value (Standard_Integer& theI1, Standard_Integer& theI2, Standard_Boolean& theWithSubShape) const { Standard_Integer iT1, iT2, n1, n2; // const BOPDS_PassKeyBoolean& aPKB=myIterator.Value(); aPKB.Ids(n1, n2); // iT1=(Standard_Integer)(myDS->ShapeInfo(n1).ShapeType()); iT2=(Standard_Integer)(myDS->ShapeInfo(n2).ShapeType()); // theI1=n1; theI2=n2; if (iT1 aTreeFiller(aBBTree); // aNb=myDS->NbSourceShapes(); BOPDS_VectorOfTSR aVTSR(aNb, aAllocator); // for (i=0; iShapeInfo(i); bFlag=aSI.IsInterfering(); // BOPDS_TSR& aTSR=aVTSR.Append1(); // aTSR.SetHasBRep(bFlag); if (!bFlag) { continue; } // const Bnd_Box& aBoxEx=aSI.Box(); aTSR.SetTree(aBBTree); aTSR.SetBox(aBoxEx); // aTreeFiller.Add(i, aBoxEx); } // aTreeFiller.Fill(); // //=========================================== BOPDS_TSRCnt::Perform(myRunParallel, aVTSR); //=========================================== // aNbR=myDS->NbRanges()-1; for (iR=0; iRRange(iR); i1=aR.First(); i2=aR.Last(); for (i=i1; i<=i2; ++i) { const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i); // if (!aSI.IsInterfering()){ continue; } // aTi=aSI.ShapeType(); const Bnd_Box& aBoxi=aSI.Box(); // BOPDS_TSR& aTSRi=aVTSR(i); const BOPCol_ListOfInteger& aLI=aTSRi.Indices(); aNbSD=aLI.Extent(); if (!aNbSD){ continue; } // aIt.Initialize(aLI); for (; aIt.More(); aIt.Next()) { j=aIt.Value(); // DS index if (j>=i1 && j<=i2) { continue;// same range } // const BOPDS_ShapeInfo& aSIj=myDS->ShapeInfo(j); aTj=aSIj.ShapeType(); iTi=BOPDS_Tools::TypeToInteger(aTi); iTj=BOPDS_Tools::TypeToInteger(aTj); // bFlag=Standard_False; if (iTi