00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef INC_MI32_QTREE_H
00034 #define INC_MI32_QTREE_H
00035
00036 #ifndef INC_MI32_SIMPLEAR_H
00037 #include <mi32/simplear.h>
00038 #endif
00039
00040 #ifdef GEOMDLL
00041 #define GEOMLIBEXPORT MI_DLLEXPORT
00042 #define GEOMLIBCLASSEXPORT MI_DLLCLASSEXPORT
00043 #else
00044 #define GEOMLIBEXPORT MI_DLLIMPORT
00045 #define GEOMLIBCLASSEXPORT MI_DLLCLASSIMPORT
00046 #endif
00047
00048 #ifndef GENERATING_DOXYGEN_OUTPUT
00049
00050 struct DRECT2D;
00051 class BITSET_DEQUE;
00052 #endif // GENERATING_DOXYGEN_OUTPUT
00053
00054
00055 class GEOMLIBCLASSEXPORT QUADTREE {
00056 public:
00057 enum INITFLAGS {
00058 INITFLAG_None = 0x0000,
00059 INITFLAG_StoreExtents = 0x0001,
00060 INITFLAG_PointOnly = 0x0002,
00061 INITFLAG_FastAdd = 0x0004
00062 };
00063
00064
00065 QUADTREE (
00066 );
00067
00068
00069 QUADTREE (
00070 const QUADTREE& rhs
00071 );
00072
00073
00074 ~QUADTREE (
00075 );
00076
00077
00078 QUADTREE& operator= (
00079 const QUADTREE& rhs
00080 );
00081
00082
00083 ERRVALUE Add (
00084 INT32 ItemID,
00085 const DRECT2D& Extents
00086 );
00087
00088
00089 void Clear (
00090 );
00091
00092
00093
00094 ERRVALUE Delete (
00095 INT32 ItemID
00096 );
00097
00098
00099 ERRVALUE Delete (
00100 INT32 ItemID,
00101 const DRECT2D& Extents
00102 );
00103
00104
00105 void Free (
00106 );
00107
00108
00109
00110 ERRVALUE GetItemExtents (
00111 INT32 ItemID,
00112 DRECT2D& Extents
00113 ) const;
00114
00115
00116 ERRVALUE Initialize (
00117 const DRECT2D& Extents,
00118 INT32 NumItems,
00119 INITFLAGS InitFlags = INITFLAG_None
00120 );
00121
00122
00123 bool IsInitialized (
00124 ) const;
00125
00126
00127
00128 ERRVALUE Search (
00129 const DRECT2D& rect,
00130 SIMPLE_ARRAY<INT32>& ItemList
00131 ) const;
00132
00133
00134
00135 ERRVALUE Search (
00136 const DRECT2D& rect,
00137 BITSET_DEQUE& Deque
00138 ) const;
00139
00140
00141
00142
00143 ERRVALUE SortItemListByExtents (
00144 SIMPLE_ARRAY<INT32>& ItemList
00145 ) const;
00146
00147 private:
00148 #ifndef GENERATING_DOXYGEN_OUTPUT
00149 class PRIV;
00150 PRIV* m_Priv;
00151 #endif
00152 };
00153
00154 DEFINE_ENUM_OP_BITWISE(QUADTREE::INITFLAGS);
00155
00156 #endif