MCPcopy Index your code
hub / github.com/MapServer/MapServer / msUnionLayerInitItemInfo

Function msUnionLayerInitItemInfo

mapunion.c:259–334  ·  view source on GitHub ↗

allocate the iteminfo index array - same order as the item list */

Source from the content-addressed store, hash-verified

257
258/* allocate the iteminfo index array - same order as the item list */
259int msUnionLayerInitItemInfo(layerObj *layer)
260{
261 int i, numitems;
262 int *itemindexes;
263 char* itemlist = NULL;
264
265 msUnionLayerInfo* layerinfo = (msUnionLayerInfo*)layer->layerinfo;
266
267 if(layer->numitems == 0)
268 {
269 return MS_SUCCESS;
270 }
271
272 if (!layerinfo || !layer->map)
273 return MS_FAILURE;
274
275 /* Cleanup any previous item selection */
276 msUnionLayerFreeItemInfo(layer);
277
278 layer->iteminfo = (int *) malloc(sizeof(int) * layer->numitems);
279 MS_CHECK_ALLOC(layer->iteminfo, sizeof(int) * layer->numitems, MS_FAILURE);
280
281 itemindexes = (int*)layer->iteminfo;
282
283 /* check whether we require attributes from the source layers also */
284 numitems = 0;
285 for (i = 0; i < layer->numitems; i++)
286 {
287 if (EQUAL(layer->items[i], MSUNION_SOURCELAYERNAME))
288 itemindexes[i] = MSUNION_SOURCELAYERNAMEINDEX;
289 else if (EQUAL(layer->items[i], MSUNION_SOURCELAYERGROUP))
290 itemindexes[i] = MSUNION_SOURCELAYERGROUPINDEX;
291 else if (EQUAL(layer->items[i], MSUNION_SOURCELAYERVISIBLE))
292 itemindexes[i] = MSUNION_SOURCELAYERVISIBLEINDEX;
293 else
294 {
295 itemindexes[i] = numitems++;
296 if (itemlist)
297 {
298 itemlist = msStringConcatenate(itemlist, ",");
299 itemlist = msStringConcatenate(itemlist, layer->items[i]);
300 }
301 else
302 {
303 itemlist = msStrdup(layer->items[i]);
304 }
305 }
306 }
307
308 for (i = 0; i < layerinfo->layerCount; i++)
309 {
310 layerObj* srclayer = &layerinfo->layers[i];
311
312 msUnionLayerFreeExpressionTokens(srclayer);
313
314 if (itemlist)
315 {
316 /* get items requested by the union layer plus the required items */

Callers 1

msUnionLayerGetItemsFunction · 0.85

Calls 7

msUnionLayerFreeItemInfoFunction · 0.85
msStringConcatenateFunction · 0.85
msStrdupFunction · 0.85
msLayerSetProcessingKeyFunction · 0.85
msLayerWhichItemsFunction · 0.85
msFreeFunction · 0.85

Tested by

no test coverage detected