find the next shape with the appropriate shape type */ also, load in the attribute data */ MS_DONE => no more data */
| 422 | /* also, load in the attribute data */ |
| 423 | /* MS_DONE => no more data */ |
| 424 | int msUnionLayerNextShape(layerObj *layer, shapeObj *shape) |
| 425 | { |
| 426 | int rv; |
| 427 | layerObj* srclayer; |
| 428 | msUnionLayerInfo* layerinfo = (msUnionLayerInfo*)layer->layerinfo; |
| 429 | |
| 430 | if (!layerinfo || !layer->map) |
| 431 | return MS_FAILURE; |
| 432 | |
| 433 | if (layerinfo->layerIndex < 0 || layerinfo->layerIndex >= layerinfo->layerCount) |
| 434 | return MS_FAILURE; |
| 435 | |
| 436 | rv = MS_DONE; |
| 437 | |
| 438 | while (layerinfo->layerIndex < layerinfo->layerCount) |
| 439 | { |
| 440 | srclayer = &layerinfo->layers[layerinfo->layerIndex]; |
| 441 | if (layerinfo->status[layerinfo->layerIndex] == MS_SUCCESS) |
| 442 | { |
| 443 | while ((rv = srclayer->vtable->LayerNextShape(srclayer, shape)) == MS_SUCCESS) |
| 444 | { |
| 445 | if(layer->styleitem) |
| 446 | { |
| 447 | /* need to retrieve the source layer classindex if styleitem AUTO is set */ |
| 448 | layerinfo->classIndex = msShapeGetClass(srclayer, layer->map, shape, layerinfo->classgroup, layerinfo->nclasses); |
| 449 | if(layerinfo->classIndex < 0 || layerinfo->classIndex >= srclayer->numclasses) |
| 450 | { |
| 451 | // this shape is not visible, skip it |
| 452 | msFreeShape(shape); |
| 453 | if (rv == MS_SUCCESS) |
| 454 | continue; |
| 455 | else |
| 456 | break; |
| 457 | } |
| 458 | if(srclayer->styleitem && strcasecmp(srclayer->styleitem, "AUTO") != 0) |
| 459 | { |
| 460 | /* Generic feature style handling as per RFC-61 */ |
| 461 | msLayerGetFeatureStyle(layer->map, srclayer, srclayer->class[layerinfo->classIndex], shape); |
| 462 | } |
| 463 | /* set up annotation */ |
| 464 | msFree(layerinfo->classText); |
| 465 | if((srclayer->class[layerinfo->classIndex]->text.string || srclayer->labelitem) && |
| 466 | srclayer->class[layerinfo->classIndex]->label.size != -1) |
| 467 | layerinfo->classText = msShapeGetAnnotation(srclayer, shape); |
| 468 | else |
| 469 | layerinfo->classText = NULL; |
| 470 | } |
| 471 | |
| 472 | #ifdef USE_PROJ |
| 473 | /* reproject to the target layer */ |
| 474 | if(srclayer->project && msProjectionsDiffer(&(srclayer->projection), &(layer->projection))) |
| 475 | msProjectShape(&(srclayer->projection), &(layer->projection), shape); |
| 476 | else |
| 477 | srclayer->project = MS_FALSE; |
| 478 | #endif |
| 479 | /* update the layer styles with the bound values */ |
| 480 | if(msBindLayerToShape(srclayer, shape, MS_FALSE) != MS_SUCCESS) |
| 481 | return MS_FAILURE; |
nothing calls this directly
no test coverage detected