|
GDAL
|
00001 /********************************************************************** 00002 * $Id: cpl_quad_tree.h 34931 2016-08-05 17:13:05Z rouault $ 00003 * 00004 * Project: CPL - Common Portability Library 00005 * Purpose: Implementation of quadtree building and searching functions. 00006 * Derived from shapelib and mapserver implementations 00007 * Author: Frank Warmerdam, warmerdam@pobox.com 00008 * Even Rouault, <even dot rouault at mines dash paris dot org> 00009 * 00010 ****************************************************************************** 00011 * Copyright (c) 1999-2008, Frank Warmerdam 00012 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org> 00013 * 00014 * Permission is hereby granted, free of charge, to any person obtaining a 00015 * copy of this software and associated documentation files (the "Software"), 00016 * to deal in the Software without restriction, including without limitation 00017 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00018 * and/or sell copies of the Software, and to permit persons to whom the 00019 * Software is furnished to do so, subject to the following conditions: 00020 * 00021 * The above copyright notice and this permission notice shall be included 00022 * in all copies or substantial portions of the Software. 00023 * 00024 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00025 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00026 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00027 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00028 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00029 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00030 * DEALINGS IN THE SOFTWARE. 00031 ****************************************************************************/ 00032 00033 #ifndef CPL_QUAD_TREE_H_INCLUDED 00034 #define CPL_QUAD_TREE_H_INCLUDED 00035 00036 #include "cpl_port.h" 00037 00049 CPL_C_START 00050 00051 /* Types */ 00052 00054 typedef struct { 00055 double minx; 00056 double miny; 00057 double maxx; 00058 double maxy; 00059 } CPLRectObj; 00060 00062 typedef struct _CPLQuadTree CPLQuadTree; 00063 00065 typedef void (*CPLQuadTreeGetBoundsFunc)(const void* hFeature, CPLRectObj* pBounds); 00067 typedef int (*CPLQuadTreeForeachFunc)(void* pElt, void* pUserData); 00069 typedef void (*CPLQuadTreeDumpFeatureFunc)(const void* hFeature, int nIndentLevel, void* pUserData); 00070 00071 /* Functions */ 00072 00073 CPLQuadTree CPL_DLL *CPLQuadTreeCreate(const CPLRectObj* pGlobalBounds, 00074 CPLQuadTreeGetBoundsFunc pfnGetBounds); 00075 void CPL_DLL CPLQuadTreeDestroy(CPLQuadTree *hQuadtree); 00076 00077 void CPL_DLL CPLQuadTreeSetBucketCapacity(CPLQuadTree *hQuadtree, 00078 int nBucketCapacity); 00079 int CPL_DLL CPLQuadTreeGetAdvisedMaxDepth(int nExpectedFeatures); 00080 void CPL_DLL CPLQuadTreeSetMaxDepth(CPLQuadTree *hQuadtree, 00081 int nMaxDepth); 00082 00083 void CPL_DLL CPLQuadTreeInsert(CPLQuadTree *hQuadtree, 00084 void* hFeature); 00085 void CPL_DLL CPLQuadTreeInsertWithBounds(CPLQuadTree *hQuadtree, 00086 void* hFeature, 00087 const CPLRectObj* psBounds); 00088 00089 void CPL_DLL **CPLQuadTreeSearch(const CPLQuadTree *hQuadtree, 00090 const CPLRectObj* pAoi, 00091 int* pnFeatureCount); 00092 00093 void CPL_DLL CPLQuadTreeForeach(const CPLQuadTree *hQuadtree, 00094 CPLQuadTreeForeachFunc pfnForeach, 00095 void* pUserData); 00096 00097 void CPL_DLL CPLQuadTreeDump(const CPLQuadTree *hQuadtree, 00098 CPLQuadTreeDumpFeatureFunc pfnDumpFeatureFunc, 00099 void* pUserData); 00100 void CPL_DLL CPLQuadTreeGetStats(const CPLQuadTree *hQuadtree, 00101 int* pnFeatureCount, 00102 int* pnNodeCount, 00103 int* pnMaxDepth, 00104 int* pnMaxBucketCapacity); 00105 00106 CPL_C_END 00107 00108 #endif
1.7.6.1.