Warning, file /include/opencascade/BVH_IndexedBoxSet.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _BVH_IndexedBoxSet_Header
0017 #define _BVH_IndexedBoxSet_Header
0018
0019 #include <BVH_BoxSet.hxx>
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 template <class NumType, int Dimension, class DataType = Standard_Integer>
0036 class BVH_IndexedBoxSet : public BVH_BoxSet <NumType, Dimension, DataType>
0037 {
0038 public:
0039
0040
0041 BVH_IndexedBoxSet()
0042 : BVH_BoxSet <NumType, Dimension, DataType>()
0043 {
0044 }
0045
0046
0047 BVH_IndexedBoxSet (const opencascade::handle <BVH_Builder <NumType, Dimension> >& theBuilder)
0048 : BVH_BoxSet <NumType, Dimension, DataType> (theBuilder)
0049 {
0050 }
0051
0052 public:
0053
0054
0055 virtual void SetSize (const Standard_Size theSize) Standard_OVERRIDE
0056 {
0057 myIndices.reserve (theSize);
0058 BVH_BoxSet <NumType, Dimension, DataType>::SetSize (theSize);
0059 }
0060
0061 public:
0062
0063
0064 virtual void Add (const DataType& theElement, const BVH_Box<NumType, Dimension>& theBox) Standard_OVERRIDE
0065 {
0066 myIndices.push_back (static_cast<Standard_Integer> (myIndices.size()));
0067 BVH_BoxSet <NumType, Dimension, DataType>::Add (theElement, theBox);
0068 }
0069
0070 public:
0071
0072
0073 virtual void Clear() Standard_OVERRIDE
0074 {
0075 myIndices.clear();
0076 BVH_BoxSet <NumType, Dimension, DataType>::Clear();
0077 }
0078
0079 public:
0080
0081
0082 using BVH_BoxSet <NumType, Dimension, DataType>::Box;
0083
0084
0085 virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
0086 {
0087 return this->myBoxes[myIndices[theIndex]];
0088 }
0089
0090
0091 virtual void Swap (const Standard_Integer theIndex1,
0092 const Standard_Integer theIndex2) Standard_OVERRIDE
0093 {
0094 std::swap (myIndices[theIndex1], myIndices[theIndex2]);
0095 }
0096
0097
0098 virtual DataType Element (const Standard_Integer theIndex) const Standard_OVERRIDE
0099 {
0100 return this->myElements[myIndices[theIndex]];
0101 }
0102
0103 protected:
0104
0105 std::vector <Standard_Integer> myIndices;
0106
0107 };
0108
0109 #endif