1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _BOPDS_SubIterator_HeaderFile
16 #define _BOPDS_SubIterator_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
22 #include <BOPDS_PDS.hxx>
23 #include <BOPDS_VectorOfPair.hxx>
24 #include <NCollection_BaseAllocator.hxx>
25 #include <TColStd_ListOfInteger.hxx>
26 #include <Standard_Integer.hxx>
29 //! The class BOPDS_SubIterator is used to compute intersections between
30 //! bounding boxes of two sub-sets of BRep sub-shapes of arguments
31 //! of an operation (see the class BOPDS_DS).
32 //! The class provides interface to iterate the pairs of intersected sub-shapes.
34 class BOPDS_SubIterator
41 Standard_EXPORT BOPDS_SubIterator();
42 Standard_EXPORT virtual ~BOPDS_SubIterator();
45 //! theAllocator - the allocator to manage the memory
46 Standard_EXPORT BOPDS_SubIterator(const Handle(NCollection_BaseAllocator)& theAllocator);
48 //! Sets the data structure <pDS> to process.
49 //! It is used to access the shapes and their bounding boxes.
50 void SetDS (const BOPDS_PDS& pDS)
55 //! Returns the data structure
56 const BOPDS_DS& DS() const
61 //! Sets the first set of indices <theLI> to process
62 void SetSubSet1 (const TColStd_ListOfInteger& theLI)
64 mySubSet1 = (TColStd_ListOfInteger*)&theLI;
67 //! Returns the first set of indices to process
68 const TColStd_ListOfInteger& SubSet1() const
73 //! Sets the second set of indices <theLI> to process
74 void SetSubSet2 (const TColStd_ListOfInteger& theLI)
76 mySubSet2 = (TColStd_ListOfInteger*)&theLI;
79 //! Returns the second set of indices to process
80 const TColStd_ListOfInteger& SubSet2() const
85 //! Initializes the iterator
86 Standard_EXPORT void Initialize();
88 //! Returns true if there are more pairs of intersected shapes
89 Standard_Boolean More() const
91 return myIterator.More();
94 //! Moves iterations ahead
100 //! Returns indices (DS) of intersected shapes
101 //! theIndex1 - the index of the first shape
102 //! theIndex2 - the index of the second shape
103 Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2) const;
105 //! Perform the intersection algorithm and prepare
106 //! the results to be used
107 Standard_EXPORT virtual void Prepare();
109 //! Returns the number of interfering pairs
110 Standard_Integer ExpectedLength() const
112 return myList.Length();
117 //! Performs intersection of bounding boxes
118 Standard_EXPORT virtual void Intersect();
120 Handle(NCollection_BaseAllocator) myAllocator;
122 BOPDS_VectorOfPair myList;
123 BOPDS_VectorOfPair::Iterator myIterator;
124 TColStd_ListOfInteger* mySubSet1;
125 TColStd_ListOfInteger* mySubSet2;
131 #endif // _BOPDS_SubIterator_HeaderFile