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

Method processLayer

mapkmlrenderer.cpp:219–279  ·  view source on GitHub ↗

/ processLayer */ / Set parameters that make sense to a kml output. */ /

Source from the content-addressed store, hash-verified

217/* Set parameters that make sense to a kml output. */
218/************************************************************************/
219void KmlRenderer::processLayer(layerObj *layer, outputFormatObj *format)
220{
221 int i;
222 const char *asRaster = NULL;
223 int nMaxFeatures = -1;
224 const char *pszTmp;
225 char szTmp[10];
226
227 if (!layer)
228 return;
229
230 /*turn of labelcache*/
231 layer->labelcache = MS_OFF;
232
233 /*if there are labels we want the coordinates to
234 be the center of the element.*/
235 for(i=0; i<layer->numclasses; i++)
236 layer->_class[i]->label.position = MS_XY;
237
238 /*we do not want to draw multiple styles.
239 the new rendering architecture does not allow
240 to know if we are dealing with a multi-style.
241 So here we remove all styles beside the first one*/
242
243 for(i=0; i<layer->numclasses; i++)
244 {
245 while (layer->_class[i]->numstyles > 1)
246 msDeleteStyle(layer->_class[i], layer->_class[i]->numstyles-1);
247 }
248
249 /*if layer has a metadata KML_OUTPUTASRASTER set to true, add a processing directive
250 to use an agg driver*/
251 asRaster = msLookupHashTable(&layer->metadata, "kml_outputasraster");
252 if (!asRaster)
253 asRaster = msLookupHashTable(&(layer->map->web.metadata), "kml_outputasraster");
254 if (asRaster && (strcasecmp(asRaster, "true") == 0 ||
255 strcasecmp(asRaster, "yes") == 0))
256 msLayerAddProcessing(layer, "RENDERER=png24");
257
258
259 /*set a maxfeaturestodraw, if not already set*/
260
261 pszTmp = msLookupHashTable(&layer->metadata, "maxfeaturestodraw");
262 if (pszTmp)
263 nMaxFeatures = atoi(pszTmp);
264 else
265 {
266 pszTmp = msLookupHashTable(&layer->map->web.metadata, "maxfeaturestodraw");
267 if (pszTmp)
268 nMaxFeatures = atoi(pszTmp);
269 }
270 if (nMaxFeatures < 0 && format)
271 nMaxFeatures = atoi(msGetOutputFormatOption( format, "maxfeaturestodraw", "-1"));
272
273 if (nMaxFeatures < 0 && format)
274 {
275 snprintf(szTmp, sizeof(szTmp), "%d", KML_MAXFEATURES_TODRAW);
276 msSetOutputFormatOption( format, "maxfeaturestodraw", szTmp);

Callers

nothing calls this directly

Calls 6

msDeleteStyleFunction · 0.85
msLookupHashTableFunction · 0.85
strcasecmpFunction · 0.85
msLayerAddProcessingFunction · 0.85
msGetOutputFormatOptionFunction · 0.85
msSetOutputFormatOptionFunction · 0.85

Tested by

no test coverage detected