23 #include "wxgis/datasource/gdalinh.h"
25 #include "wx/thread.h"
42 virtual void SetFID(
long nFID);
43 virtual long GetFID(
void)
const;
52 WX_DEFINE_ARRAY_WITH_DECL_PTR(
wxGISSpatialTreeData*, wxGISSpatialTreeCursor,
class WXDLLIMPEXP_GIS_DS);
54 extern WXDLLIMPEXP_DATA_GIS_DS(wxGISSpatialTreeCursor) wxNullSpatialTreeCursor;
69 virtual bool IsLoading(
void)
const;
70 virtual void CancelLoading();
73 virtual void Remove(
long nFID) = 0;
74 virtual void RemoveAll(
void) = 0;
76 virtual wxGISSpatialTreeCursor Search(
const OGREnvelope& env) = 0;
78 virtual bool HasFID(
long nFID)
const = 0;
80 virtual wxThread::ExitCode Entry();
81 bool CreateAndRunLoadGeometryThread(
void);
82 void DestroyLoadGeometryThread(
void);
86 short m_nPreloadItemCount;
89 wxCriticalSection m_CritSect;
104 #define RTREE_REINSERT_P 0.30
105 #define RTREE_CHOOSE_SUBTREE_P 32
118 enum enumChooseSubteeType{
135 void Search(wxGISSpatialTreeCursor &Cursor,
const OGREnvelope& env);
136 void GetAll(wxGISSpatialTreeCursor &Cursor);
137 bool Remove(
long nFID);
138 bool HasFID(
long nFID)
const;
139 double GetArea()
const;
140 void StretchBounds(
const OGREnvelope &Env);
141 wxGISRTreeNode* ChooseSubtree(
const OGREnvelope &Env, enumChooseSubteeType eType);
142 OGREnvelope GetBounds()
const;
143 size_t GetCount()
const;
144 bool GetHasLeaves()
const;
145 void SetHasLeaves(
bool bHasLeaves);
148 void UpdateBounds(
void);
150 SPLIT_DIR GetSplitDirection(
const bool bIsX,
size_t nDistributionCount);
151 void RemoveFarestItems(
size_t p, wxVector<wxGISRTreeNode*> &removed_items);
159 m_dfArea = fabs((Env.MaxX - Env.MinX) * (Env.MaxY - Env.MinY));
164 return m_dfArea - n1->GetArea() < m_dfArea - n2->GetArea();
170 const OGREnvelope m_Env;
175 OGREnvelope IntersectEnv = n1->GetBounds();
176 IntersectEnv.Intersect(m_Env);
177 double dfArea1 = fabs((IntersectEnv.MaxX - IntersectEnv.MinX) * (IntersectEnv.MaxY - IntersectEnv.MinY));
178 IntersectEnv = n2->GetBounds();
179 IntersectEnv.Intersect(m_Env);
180 double dfArea2 = fabs((IntersectEnv.MaxX - IntersectEnv.MinX) * (IntersectEnv.MaxY - IntersectEnv.MinY));
182 return dfArea1 < dfArea2;
191 dfX = (Env.MaxX - Env.MinX) / 2;
192 dfY = (Env.MaxY - Env.MinY) / 2;
197 OGREnvelope OtherEnv = n1->GetBounds();
199 dfXO = (OtherEnv.MaxX - OtherEnv.MinX) / 2;
200 dfYO = (OtherEnv.MaxY - OtherEnv.MinY) / 2;
201 double dfDist1 = ((dfX - dfXO) * (dfX - dfXO) + (dfY - dfYO) * (dfY - dfYO));
203 OtherEnv = n2->GetBounds();
204 dfXO = (OtherEnv.MaxX - OtherEnv.MinX) / 2;
205 dfYO = (OtherEnv.MaxY - OtherEnv.MinY) / 2;
206 double dfDist2 = ((dfX - dfXO) * (dfX - dfXO) + (dfY - dfYO) * (dfY - dfYO));
208 return dfDist1 < dfDist2;
212 struct SortBoundedItemsByEdge :
public std::binary_function< const wxGISRTreeNode * const, const wxGISRTreeNode * const, bool >
220 OGREnvelope Env1 = n1->GetBounds();
221 OGREnvelope Env2 = n2->GetBounds();
226 return Env1.MinX < Env2.MinX;
230 return Env1.MaxX < Env2.MaxX;
237 return Env1.MinY < Env2.MinY;
241 return Env1.MaxY < Env2.MaxY;
248 unsigned short m_nMinChildItems, m_nMaxChildItems;
251 wxVector<wxGISRTreeNode*> m_paNodes;
268 virtual void Remove(
long nFID);
269 virtual void RemoveAll(
void);
270 virtual wxGISSpatialTreeCursor Search(
const OGREnvelope& env);
272 virtual bool HasFID(
long nFID)
const;
281 unsigned short m_nMaxChildItems;
282 unsigned short m_nMinChildItems;
285 #include "cpl_quad_tree.h"
287 void GetGeometryBoundsFunc(
const void* hFeature, CPLRectObj* pBounds);
302 virtual void Remove(
long nFID);
303 virtual void RemoveAll(
void);
304 virtual wxGISSpatialTreeCursor Search(
const OGREnvelope& Env);
306 virtual bool HasFID(
long nFID)
const;
308 void CreateQuadTree();
309 void DestroyQuadTree();
311 CPLQuadTree* m_pQuadTree;
312 wxGISSpatialTreeCursor m_Cursor;
313 OGREnvelope m_Envelope;
Definition: gdalinh.h:333
A TrackCancel interface class.
Definition: core.h:144
Definition: spatialtree.h:129
Definition: spatialtree.h:63
Definition: spatialtree.h:168
Definition: spatialtree.h:186
Definition: spatialtree.h:114
Definition: spatialtree.h:297
Definition: spatialtree.h:263
Definition: featuredataset.h:32
Definition: spatialtree.h:154
Definition: spatialtree.h:212
Definition: spatialtree.h:37