eventually add a class to the layer to get the diameter from an attribute */
| 270 | |
| 271 | /* eventually add a class to the layer to get the diameter from an attribute */ |
| 272 | int pieLayerProcessDynamicDiameter(layerObj *layer) { |
| 273 | const char *chartRangeProcessingKey=NULL; |
| 274 | char *attrib; |
| 275 | float mindiameter=-1, maxdiameter, minvalue, maxvalue; |
| 276 | classObj *newclass; |
| 277 | styleObj *newstyle; |
| 278 | const char *chartSizeProcessingKey=msLayerGetProcessingKey( layer,"CHART_SIZE" ); |
| 279 | if(chartSizeProcessingKey != NULL) |
| 280 | return MS_FALSE; |
| 281 | chartRangeProcessingKey=msLayerGetProcessingKey( layer,"CHART_SIZE_RANGE" ); |
| 282 | if(chartRangeProcessingKey==NULL) |
| 283 | return MS_FALSE; |
| 284 | attrib = msSmallMalloc(strlen(chartRangeProcessingKey)+1); |
| 285 | switch(sscanf(chartRangeProcessingKey,"%s %f %f %f %f",attrib, |
| 286 | &mindiameter,&maxdiameter,&minvalue,&maxvalue)) |
| 287 | { |
| 288 | case 1: /*we only have the attribute*/ |
| 289 | case 5: /*we have the attribute and the four range values*/ |
| 290 | break; |
| 291 | default: |
| 292 | free(attrib); |
| 293 | msSetError(MS_MISCERR, "Chart Layer format error for processing key \"CHART_RANGE\"", "msDrawChartLayer()"); |
| 294 | return MS_FAILURE; |
| 295 | } |
| 296 | /*create a new class in the layer containing the wanted attribute |
| 297 | * as the SIZE of its first STYLE*/ |
| 298 | newclass=msGrowLayerClasses(layer); |
| 299 | if(newclass==NULL) { |
| 300 | free(attrib); |
| 301 | return MS_FAILURE; |
| 302 | } |
| 303 | initClass(newclass); |
| 304 | layer->numclasses++; |
| 305 | |
| 306 | /*create and attach a new styleObj to our temp class |
| 307 | * and bind the wanted attribute to its SIZE |
| 308 | */ |
| 309 | newstyle=msGrowClassStyles(newclass); |
| 310 | if(newstyle==NULL) { |
| 311 | free(attrib); |
| 312 | return MS_FAILURE; |
| 313 | } |
| 314 | initStyle(newstyle); |
| 315 | newclass->numstyles++; |
| 316 | newclass->name=(char*)msStrdup("__MS_SIZE_ATTRIBUTE_"); |
| 317 | newstyle->bindings[MS_STYLE_BINDING_SIZE].item=msStrdup(attrib); |
| 318 | newstyle->numbindings++; |
| 319 | free(attrib); |
| 320 | |
| 321 | return MS_TRUE; |
| 322 | |
| 323 | } |
| 324 | |
| 325 | |
| 326 | int msDrawPieChartLayer(mapObj *map, layerObj *layer, imageObj *image) |
no test coverage detected