Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-25 09:13:17

0001 // Created on: 2011-11-29
0002 // Created by: ANNA MASALSKAYA
0003 // Copyright (c) 2011-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef BRepBuilderAPI_BndBoxTreeSelector_HeaderFile
0017 #define BRepBuilderAPI_BndBoxTreeSelector_HeaderFile
0018 
0019 #include <TColStd_ListOfInteger.hxx>
0020 #include <Bnd_Box.hxx>
0021 #include <NCollection_UBTree.hxx>
0022 
0023 typedef NCollection_UBTree<Standard_Integer, Bnd_Box> BRepBuilderAPI_BndBoxTree;
0024 
0025 //=======================================================================
0026 //! Class BRepBuilderAPI_BndBoxTreeSelector
0027 //!   derived from UBTree::Selector
0028 //!   This class is used to select overlapping boxes, stored in
0029 //!   NCollection::UBTree; contains methods to maintain the selection
0030 //!   condition and to retrieve selected objects after search.
0031 //=======================================================================
0032 
0033 class BRepBuilderAPI_BndBoxTreeSelector : public BRepBuilderAPI_BndBoxTree::Selector
0034 {
0035 public:
0036   //! Constructor; calls the base class constructor
0037   BRepBuilderAPI_BndBoxTreeSelector()
0038       : BRepBuilderAPI_BndBoxTree::Selector()
0039   {
0040   }
0041 
0042   //! Implementation of rejection method
0043   //! @return
0044   //!   True if the bounding box does not intersect with the current
0045   Standard_Boolean Reject(const Bnd_Box& theBox) const { return (myBox.IsOut(theBox)); }
0046 
0047   //! Implementation of acceptance method
0048   //!   This method is called when the bounding box intersect with the current.
0049   //!   It stores the object - the index of box in the list of accepted objects.
0050   //! @return
0051   //!   True, because the object is accepted
0052   Standard_Boolean Accept(const Standard_Integer& theObj)
0053   {
0054     myResInd.Append(theObj);
0055     return Standard_True;
0056   }
0057 
0058   //! Clear the list of intersecting boxes
0059   void ClearResList() { myResInd.Clear(); }
0060 
0061   //! Set current box to search for overlapping with him
0062   void SetCurrent(const Bnd_Box& theBox) { myBox = theBox; }
0063 
0064   //! Get list of indexes of boxes intersecting with the current box
0065   const TColStd_ListOfInteger& ResInd() { return myResInd; }
0066 
0067 private:
0068   TColStd_ListOfInteger myResInd;
0069   Bnd_Box               myBox;
0070 };
0071 
0072 #endif