MCPcopy Create free account
hub / github.com/MapServer/MapServer / msPostGISLayerInitItemInfo

Function msPostGISLayerInitItemInfo

mappostgis.c:2360–2395  ·  view source on GitHub ↗

** msPostGISLayerInitItemInfo() ** ** Registered vtable->LayerInitItemInfo function. ** Our iteminfo is list of indexes from 1..numitems. */

Source from the content-addressed store, hash-verified

2358** Our iteminfo is list of indexes from 1..numitems.
2359*/
2360int msPostGISLayerInitItemInfo(layerObj *layer) {
2361#ifdef USE_POSTGIS
2362 int i;
2363 int *itemindexes ;
2364
2365 if (layer->debug) {
2366 msDebug("msPostGISLayerInitItemInfo called.\n");
2367 }
2368
2369 if (layer->numitems == 0) {
2370 return MS_SUCCESS;
2371 }
2372
2373 if (layer->iteminfo) {
2374 free(layer->iteminfo);
2375 }
2376
2377 layer->iteminfo = msSmallMalloc(sizeof(int) * layer->numitems);
2378 if (!layer->iteminfo) {
2379 msSetError(MS_MEMERR, "Out of memory.", "msPostGISLayerInitItemInfo()");
2380 return MS_FAILURE;
2381 }
2382
2383 itemindexes = (int*)layer->iteminfo;
2384 for (i = 0; i < layer->numitems; i++) {
2385 itemindexes[i] = i; /* Last item is always the geometry. The rest are non-geometry. */
2386 }
2387
2388 return MS_SUCCESS;
2389#else
2390 msSetError( MS_MISCERR,
2391 "PostGIS support is not available.",
2392 "msPostGISLayerInitItemInfo()");
2393 return MS_FAILURE;
2394#endif
2395}
2396
2397/*
2398** msPostGISLayerWhichShapes()

Callers 1

msPostGISLayerGetItemsFunction · 0.85

Calls 3

msDebugFunction · 0.85
msSmallMallocFunction · 0.85
msSetErrorFunction · 0.85

Tested by

no test coverage detected