GDAL
cpl_quad_tree.h
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id: cpl_quad_tree.h 15067 2008-07-28 22:08:58Z rouault $
3  *
4  * Project: CPL - Common Portability Library
5  * Purpose: Implementation of quadtree building and searching functions.
6  * Derived from shapelib and mapserver implementations
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  * Even Rouault, <even dot rouault at mines dash paris dot org>
9  *
10  ******************************************************************************
11  * Copyright (c) 1999-2008, Frank Warmerdam
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef _CPL_QUAD_TREE_H_INCLUDED
33 #define _CPL_QUAD_TREE_H_INCLUDED
34 
35 #include "cpl_port.h"
36 
48 CPL_C_START
49 
50 /* Types */
51 
52 typedef struct {
53  double minx, miny, maxx, maxy;
54 } CPLRectObj;
55 
56 typedef struct _CPLQuadTree CPLQuadTree;
57 
58 typedef void (*CPLQuadTreeGetBoundsFunc)(const void* hFeature, CPLRectObj* pBounds);
59 typedef int (*CPLQuadTreeForeachFunc)(void* pElt, void* pUserData);
60 typedef void (*CPLQuadTreeDumpFeatureFunc)(const void* hFeature, int nIndentLevel, void* pUserData);
61 
62 /* Functions */
63 
64 CPLQuadTree CPL_DLL *CPLQuadTreeCreate(const CPLRectObj* pGlobalBounds,
65  CPLQuadTreeGetBoundsFunc pfnGetBounds);
66 void CPL_DLL CPLQuadTreeDestroy(CPLQuadTree *hQuadtree);
67 
68 void CPL_DLL CPLQuadTreeSetBucketCapacity(CPLQuadTree *hQuadtree,
69  int nBucketCapacity);
70 int CPL_DLL CPLQuadTreeGetAdvisedMaxDepth(int nExpectedFeatures);
71 void CPL_DLL CPLQuadTreeSetMaxDepth(CPLQuadTree *hQuadtree,
72  int nMaxDepth);
73 
74 void CPL_DLL CPLQuadTreeInsert(CPLQuadTree *hQuadtree,
75  void* hFeature);
76 
77 void CPL_DLL **CPLQuadTreeSearch(const CPLQuadTree *hQuadtree,
78  const CPLRectObj* pAoi,
79  int* pnFeatureCount);
80 
81 void CPL_DLL CPLQuadTreeForeach(const CPLQuadTree *hQuadtree,
82  CPLQuadTreeForeachFunc pfnForeach,
83  void* pUserData);
84 
85 void CPL_DLL CPLQuadTreeDump(const CPLQuadTree *hQuadtree,
86  CPLQuadTreeDumpFeatureFunc pfnDumpFeatureFunc,
87  void* pUserData);
88 void CPL_DLL CPLQuadTreeGetStats(const CPLQuadTree *hQuadtree,
89  int* pnFeatureCount,
90  int* pnNodeCount,
91  int* pnMaxDepth,
92  int* pnMaxBucketCapacity);
93 
94 CPL_C_END
95 
96 #endif

Generated for GDAL by doxygen 1.8.1.