/ processLayer */ / Set parameters that make sense to a kml output. */ /
| 217 | /* Set parameters that make sense to a kml output. */ |
| 218 | /************************************************************************/ |
| 219 | void 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); |
nothing calls this directly
no test coverage detected