42cf5bc1 |
1 | // Created by: Peter KURNEV |
2 | // Copyright (c) 2010-2014 OPEN CASCADE SAS |
3 | // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE |
4 | // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, |
5 | // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
6 | // |
7 | // This file is part of Open CASCADE Technology software library. |
8 | // |
9 | // This library is free software; you can redistribute it and/or modify it under |
10 | // the terms of the GNU Lesser General Public License version 2.1 as published |
11 | // by the Free Software Foundation, with special exception defined in the file |
12 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
13 | // distribution for complete text of the license and disclaimer of any warranty. |
14 | // |
15 | // Alternatively, this file may be used under the terms of Open CASCADE |
16 | // commercial license or contractual agreement. |
17 | |
18 | #ifndef _BOPDS_Iterator_HeaderFile |
19 | #define _BOPDS_Iterator_HeaderFile |
20 | |
21 | #include <Standard.hxx> |
22 | #include <Standard_DefineAlloc.hxx> |
23 | #include <Standard_Handle.hxx> |
24 | |
25 | #include <BOPCol_BaseAllocator.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <BOPDS_PDS.hxx> |
25dfc507 |
28 | #include <BOPDS_VectorOfPair.hxx> |
29 | #include <BOPDS_VectorOfVectorOfPair.hxx> |
42cf5bc1 |
30 | #include <Standard_Boolean.hxx> |
31 | #include <TopAbs_ShapeEnum.hxx> |
32 | class BOPDS_DS; |
33 | |
34 | |
35 | |
36 | //! The class BOPDS_Iterator is |
37 | //! 1.to compute intersections between BRep sub-shapes |
38 | //! of arguments of an operation (see the class BOPDS_DS) |
39 | //! in terms of theirs bounding boxes |
40 | //! 2.provides interface to iterare the pairs of |
41 | //! intersected sub-shapes of given type |
42 | class BOPDS_Iterator |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
42cf5bc1 |
48 | //! Empty contructor |
49 | Standard_EXPORT BOPDS_Iterator(); |
25dfc507 |
50 | Standard_EXPORT virtual ~BOPDS_Iterator(); |
42cf5bc1 |
51 | |
52 | //! Contructor |
53 | //! theAllocator - the allocator to manage the memory |
54 | Standard_EXPORT BOPDS_Iterator(const BOPCol_BaseAllocator& theAllocator); |
42cf5bc1 |
55 | |
56 | //! Modifier |
57 | //! Sets the data structure <pDS> to process |
58 | Standard_EXPORT void SetDS (const BOPDS_PDS& pDS); |
42cf5bc1 |
59 | |
60 | //! Selector |
61 | //! Returns the data structure |
62 | Standard_EXPORT const BOPDS_DS& DS() const; |
42cf5bc1 |
63 | |
64 | //! Initializes the iterator |
65 | //! theType1 - the first type of shape |
66 | //! theType2 - the second type of shape |
67 | Standard_EXPORT void Initialize (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2); |
42cf5bc1 |
68 | |
69 | //! Returns true if still there are pairs |
70 | //! of intersected shapes |
71 | Standard_EXPORT Standard_Boolean More() const; |
42cf5bc1 |
72 | |
73 | //! Moves iterations ahead |
74 | Standard_EXPORT void Next(); |
42cf5bc1 |
75 | |
76 | //! Returns indices (DS) of intersected shapes |
77 | //! theIndex1 - the index of the first shape |
78 | //! theIndex2 - the index of the second shape |
25dfc507 |
79 | Standard_EXPORT void Value (Standard_Integer& theIndex1, |
80 | Standard_Integer& theIndex2) const; |
42cf5bc1 |
81 | |
82 | //! Perform the intersection algorithm and prepare |
83 | //! the results to be used |
84 | Standard_EXPORT virtual void Prepare(); |
42cf5bc1 |
85 | |
86 | //! Returns the number of intersections founded |
87 | Standard_EXPORT Standard_Integer ExpectedLength() const; |
42cf5bc1 |
88 | |
89 | //! Returns the block length |
90 | Standard_EXPORT Standard_Integer BlockLength() const; |
25dfc507 |
91 | |
42cf5bc1 |
92 | //! Set the flag of parallel processing |
93 | //! if <theFlag> is true the parallel processing is switched on |
94 | //! if <theFlag> is false the parallel processing is switched off |
95 | Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag); |
25dfc507 |
96 | |
42cf5bc1 |
97 | //! Returns the flag of parallel processing |
98 | Standard_EXPORT Standard_Boolean RunParallel() const; |
99 | |
42cf5bc1 |
100 | protected: |
101 | |
42cf5bc1 |
102 | Standard_EXPORT virtual void Intersect(); |
103 | |
42cf5bc1 |
104 | BOPCol_BaseAllocator myAllocator; |
105 | Standard_Integer myLength; |
106 | BOPDS_PDS myDS; |
25dfc507 |
107 | BOPDS_VectorOfVectorOfPair myLists; |
108 | BOPDS_VectorOfPair::Iterator myIterator; |
42cf5bc1 |
109 | Standard_Boolean myRunParallel; |
110 | |
42cf5bc1 |
111 | private: |
112 | |
42cf5bc1 |
113 | }; |
114 | |
42cf5bc1 |
115 | #endif // _BOPDS_Iterator_HeaderFile |