1155d05a |
1 | // Created by: Eugeny MALTCHIKOV |
2 | // Copyright (c) 2017 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
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. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef BOPTools_BoxSelector_HeaderFile |
16 | #define BOPTools_BoxSelector_HeaderFile |
17 | |
18 | #include <TColStd_ListOfInteger.hxx> |
19 | #include <NCollection_UBTree.hxx> |
20 | #include <Standard_Integer.hxx> |
21 | |
22 | //! Template Selector for the unbalanced binary tree |
23 | //! of overlapped bounding boxes. |
24 | template <class BoxType> class BOPTools_BoxSelector : |
25 | public NCollection_UBTree<Standard_Integer, BoxType>::Selector |
26 | { |
27 | public: |
28 | |
29 | //! Empty constructor |
30 | BOPTools_BoxSelector() {}; |
31 | |
32 | //! Checks if the box should be rejected |
33 | virtual Standard_Boolean Reject(const BoxType& theOther) const |
34 | { |
35 | return myBox.IsOut(theOther); |
36 | } |
37 | |
38 | //! Accepts the index |
39 | virtual Standard_Boolean Accept(const Standard_Integer& theIndex) |
40 | { |
41 | myIndices.Append(theIndex); |
42 | return Standard_True; |
43 | } |
44 | |
45 | //! Clears the indices |
46 | void Clear() |
47 | { |
48 | myIndices.Clear(); |
49 | } |
50 | |
51 | //! Sets the box |
52 | void SetBox(const BoxType& theBox) |
53 | { |
54 | myBox = theBox; |
55 | } |
56 | |
57 | //! Returns the list of accepted indices |
58 | const TColStd_ListOfInteger& Indices() const |
59 | { |
60 | return myIndices; |
61 | } |
62 | |
63 | private: |
64 | |
65 | BoxType myBox; |
66 | TColStd_ListOfInteger myIndices; |
67 | |
68 | }; |
69 | |
70 | #endif |