Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:04

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _BOPDS_SubIterator_HeaderFile
0016 #define _BOPDS_SubIterator_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <BOPDS_PDS.hxx>
0023 #include <BOPDS_VectorOfPair.hxx>
0024 #include <NCollection_BaseAllocator.hxx>
0025 #include <TColStd_ListOfInteger.hxx>
0026 #include <Standard_Integer.hxx>
0027 
0028 
0029 //! The class BOPDS_SubIterator is used to compute intersections between
0030 //! bounding boxes of two sub-sets of BRep sub-shapes of arguments
0031 //! of an operation (see the class BOPDS_DS).
0032 //! The class provides interface to iterate the pairs of intersected sub-shapes.
0033 
0034 class BOPDS_SubIterator 
0035 {
0036 public:
0037 
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Empty constructor
0041   Standard_EXPORT BOPDS_SubIterator();
0042   Standard_EXPORT virtual ~BOPDS_SubIterator();
0043 
0044   //! Constructor
0045   //! theAllocator - the allocator to manage the memory
0046   Standard_EXPORT BOPDS_SubIterator(const Handle(NCollection_BaseAllocator)& theAllocator);
0047 
0048   //! Sets the data structure <pDS> to process.
0049   //! It is used to access the shapes and their bounding boxes.
0050   void SetDS (const BOPDS_PDS& pDS)
0051   {
0052     myDS = pDS;
0053   }
0054 
0055   //! Returns the data structure
0056   const BOPDS_DS& DS() const
0057   {
0058     return *myDS;
0059   }
0060 
0061   //! Sets the first set of indices <theLI> to process
0062   void SetSubSet1 (const TColStd_ListOfInteger& theLI)
0063   {
0064     mySubSet1 = (TColStd_ListOfInteger*)&theLI;
0065   }
0066 
0067   //! Returns the first set of indices to process
0068   const TColStd_ListOfInteger& SubSet1() const
0069   {
0070     return *mySubSet1;
0071   }
0072 
0073   //! Sets the second set of indices <theLI> to process
0074   void SetSubSet2 (const TColStd_ListOfInteger& theLI)
0075   {
0076     mySubSet2 = (TColStd_ListOfInteger*)&theLI;
0077   }
0078 
0079   //! Returns the second set of indices to process
0080   const TColStd_ListOfInteger& SubSet2() const
0081   {
0082     return *mySubSet2;
0083   }
0084 
0085   //! Initializes the iterator
0086   Standard_EXPORT void Initialize();
0087 
0088   //! Returns true if there are more pairs of intersected shapes
0089   Standard_Boolean More() const
0090   {
0091     return myIterator.More();
0092   }
0093 
0094   //! Moves iterations ahead
0095   void Next()
0096   {
0097     myIterator.Next();
0098   }
0099 
0100   //! Returns indices (DS) of intersected shapes
0101   //! theIndex1 - the index of the first shape
0102   //! theIndex2 - the index of the second shape
0103   Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2) const;
0104 
0105   //! Perform the intersection algorithm and prepare
0106   //! the results to be used
0107   Standard_EXPORT virtual void Prepare();
0108 
0109   //! Returns the number of interfering pairs
0110   Standard_Integer ExpectedLength() const
0111   {
0112     return myList.Length();
0113   }
0114 
0115 protected:
0116 
0117   //! Performs intersection of bounding boxes
0118   Standard_EXPORT virtual void Intersect();
0119 
0120   Handle(NCollection_BaseAllocator) myAllocator;
0121   BOPDS_PDS myDS;
0122   BOPDS_VectorOfPair myList;
0123   BOPDS_VectorOfPair::Iterator myIterator;
0124   TColStd_ListOfInteger* mySubSet1;
0125   TColStd_ListOfInteger* mySubSet2;
0126 
0127 private:
0128 
0129 };
0130 
0131 #endif // _BOPDS_SubIterator_HeaderFile