0024235: BRepBuilderAPI_Sewing - add protection against too small tolerance
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_BndBoxTreeSelector.hxx
CommitLineData
b311480e 1// Created on: 2011-11-29
2// Created by: ANNA MASALSKAYA
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
82192477 20
21#ifndef _BRepBuilderAPI_BndBoxTreeSelector_Header
22#define _BRepBuilderAPI_BndBoxTreeSelector_Header
23
24#ifndef _TColStd_ListOfInteger_HeaderFile
25#include <TColStd_ListOfInteger.hxx>
26#endif
27#ifndef _Bnd_Box_HeaderFile
28#include <Bnd_Box.hxx>
29#endif
30#ifndef NCollection_UBTree_HeaderFile
31#include <NCollection_UBTree.hxx>
32#endif
33
34typedef NCollection_UBTree <Standard_Integer, Bnd_Box> BRepBuilderAPI_BndBoxTree;
35
36//=======================================================================
37//! Class BRepBuilderAPI_BndBoxTreeSelector
38//! derived from UBTree::Selector
39//! This class is used to select overlapping boxes, stored in
40//! NCollection::UBTree; contains methods to maintain the selection
41//! condition and to retrieve selected objects after search.
42//=======================================================================
43
44class BRepBuilderAPI_BndBoxTreeSelector : public BRepBuilderAPI_BndBoxTree::Selector
45{
46public:
47 //! Constructor; calls the base class constructor
48 BRepBuilderAPI_BndBoxTreeSelector() : BRepBuilderAPI_BndBoxTree::Selector() {}
49
50 //! Implementation of rejection method
51 //! @return
52 //! True if the bounding box does not intersect with the current
53 Standard_Boolean Reject (const Bnd_Box& theBox) const
54 {
55 return (myBox.IsOut (theBox));
56 }
57
58 //! Implementation of acceptance method
59 //! This method is called when the bounding box intersect with the current.
60 //! It stores the object - the index of box in the list of accepted objects.
61 //! @return
62 //! True, because the object is accepted
63 Standard_Boolean Accept (const Standard_Integer& theObj)
64 {
65 myResInd.Append (theObj);
66 return Standard_True;
67 }
68
69 //! Clear the list of intersecting boxes
70 void ClearResList()
71 {
72 myResInd.Clear();
73 }
74
75 //! Set current box to search for overlapping with him
76 void SetCurrent (const Bnd_Box& theBox)
77 {
78 myBox = theBox;
79 }
80
81 //! Get list of indexes of boxes intersecting with the current box
82 const TColStd_ListOfInteger& ResInd()
83 {
84 return myResInd;
85 }
86
87private:
88 TColStd_ListOfInteger myResInd;
89 Bnd_Box myBox;
90};
91
92#endif