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

Method startNewLayer

mapkmlrenderer.cpp:319–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319int KmlRenderer::startNewLayer(imageObj *img, layerObj *layer)
320{
321 char *layerName=NULL;
322 const char *value=NULL;
323
324 LayerNode = xmlNewNode(NULL, BAD_CAST "Folder");
325
326 layerName = getLayerName(layer);
327 xmlNewChild(LayerNode, NULL, BAD_CAST "name", BAD_CAST layerName);
328 msFree(layerName);
329
330 const char *layerVisibility = layer->status != MS_OFF ? "1" : "0";
331 xmlNewChild(LayerNode, NULL, BAD_CAST "visibility", BAD_CAST layerVisibility);
332
333 const char *layerDsiplayFolder = msLookupHashTable(&(layer->metadata), "kml_folder_display");
334 if (layerDsiplayFolder == NULL)
335 layerDsiplayFolder = msLookupHashTable(&(layer->map->web.metadata), "kml_folder_display");
336 if (!layerDsiplayFolder || strlen(layerDsiplayFolder)<=0)
337 {
338 xmlNewChild(LayerNode, NULL, BAD_CAST "styleUrl", BAD_CAST "#LayerFolder_check");
339 }
340
341 else
342 {
343 if (strcasecmp(layerDsiplayFolder, "checkHideChildren") == 0)
344 xmlNewChild(LayerNode, NULL, BAD_CAST "styleUrl", BAD_CAST "#LayerFolder_checkHideChildren");
345 else if (strcasecmp(layerDsiplayFolder, "checkOffOnly") == 0)
346 xmlNewChild(LayerNode, NULL, BAD_CAST "styleUrl", BAD_CAST "#LayerFolder_checkOffOnly");
347 else if (strcasecmp(layerDsiplayFolder, "radioFolder") == 0)
348 xmlNewChild(LayerNode, NULL, BAD_CAST "styleUrl", BAD_CAST "#LayerFolder_radioFolder");
349 else
350 xmlNewChild(LayerNode, NULL, BAD_CAST "styleUrl", BAD_CAST "#LayerFolder_check");
351 }
352
353
354 /*Init few things on the first layer*/
355 if (FirstLayer)
356 {
357 FirstLayer = MS_FALSE;
358 map = layer->map;
359
360 if (layer->map->mappath)
361 snprintf(MapPath, sizeof(MapPath), "%s", layer->map->mappath);
362
363 /*First rendered layer - check mapfile projection*/
364 checkProjection(layer->map);
365
366 /*check for image path and image url*/
367 if (layer->map->debug && (layer->map->web.imageurl == NULL || layer->map->web.imagepath == NULL))
368 msDebug("KmlRenderer::startNewLayer: imagepath and imageurl sould be set in the web object\n");
369
370
371 /*map rect for ground overlay*/
372 MapExtent = layer->map->extent;
373 MapCellsize = layer->map->cellsize;
374 BgColor = layer->map->imagecolor;
375
376 xmlNewChild(DocNode, NULL, BAD_CAST "name", BAD_CAST layer->map->name);

Callers 1

msStartNewLayerKmlFunction · 0.80

Calls 12

msFreeFunction · 0.85
msLookupHashTableFunction · 0.85
strcasecmpFunction · 0.85
msDebugFunction · 0.85
msSelectOutputFormatFunction · 0.85
msLayerIsOpenFunction · 0.85
msLayerOpenFunction · 0.85
msSetErrorFunction · 0.85
msStringSplitFunction · 0.85
msLayerWhichItemsFunction · 0.85
msSmallCallocFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected