MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLQuadTreeCreate

Function CPLQuadTreeCreate

port/cpl_quad_tree.cpp:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136 */
137
138CPLQuadTree *CPLQuadTreeCreate(const CPLRectObj *pGlobalBounds,
139 CPLQuadTreeGetBoundsFunc pfnGetBounds)
140{
141 CPLAssert(pGlobalBounds);
142
143 /* -------------------------------------------------------------------- */
144 /* Allocate the hQuadTree object */
145 /* -------------------------------------------------------------------- */
146 CPLQuadTree *hQuadTree =
147 static_cast<CPLQuadTree *>(CPLMalloc(sizeof(CPLQuadTree)));
148
149 hQuadTree->nFeatures = 0;
150 hQuadTree->pfnGetBounds = pfnGetBounds;
151 hQuadTree->pfnGetBoundsEx = nullptr;
152 hQuadTree->nMaxDepth = 0;
153 hQuadTree->nBucketCapacity = 8;
154
155 hQuadTree->dfSplitRatio = DEFAULT_SPLIT_RATIO;
156 hQuadTree->bForceUseOfSubNodes = false;
157
158 /* -------------------------------------------------------------------- */
159 /* Allocate the psRoot psNode. */
160 /* -------------------------------------------------------------------- */
161 hQuadTree->psRoot = CPLQuadTreeNodeCreate(pGlobalBounds);
162
163 hQuadTree->pUserData = nullptr;
164
165 return hQuadTree;
166}
167
168/************************************************************************/
169/* CPLQuadTreeCreateEx() */

Calls 2

CPLMallocFunction · 0.85
CPLQuadTreeNodeCreateFunction · 0.85

Tested by 1

TEST_FFunction · 0.68