Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:09

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() : BRepBuilderAPI_BndBoxTree::Selector() {}
0038 
0039   //! Implementation of rejection method
0040   //! @return
0041   //!   True if the bounding box does not intersect with the current 
0042   Standard_Boolean Reject (const Bnd_Box& theBox) const
0043   {
0044     return (myBox.IsOut (theBox));
0045   }
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()
0060   {
0061     myResInd.Clear();
0062   }
0063 
0064   //! Set current box to search for overlapping with him
0065   void SetCurrent (const Bnd_Box& theBox) 
0066   { 
0067     myBox = theBox;
0068   }
0069 
0070   //! Get list of indexes of boxes intersecting with the current box
0071   const TColStd_ListOfInteger& ResInd()
0072   {
0073     return myResInd;
0074   }
0075 
0076 private:
0077   TColStd_ListOfInteger myResInd;
0078   Bnd_Box myBox;
0079 };
0080 
0081 #endif