| 2536 | } |
| 2537 | |
| 2538 | int msSHPLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) |
| 2539 | { |
| 2540 | int i, n1=0, n2=0; |
| 2541 | int status; |
| 2542 | shapefileObj *shpfile; |
| 2543 | |
| 2544 | shpfile = layer->layerinfo; |
| 2545 | |
| 2546 | if(!shpfile) { |
| 2547 | msSetError(MS_SHPERR, "Shapefile layer has not been opened.", "msSHPLayerWhichShapes()"); |
| 2548 | return MS_FAILURE; |
| 2549 | } |
| 2550 | |
| 2551 | status = msShapefileWhichShapes(shpfile, rect, layer->debug); |
| 2552 | if(status != MS_SUCCESS) { |
| 2553 | return status; |
| 2554 | } |
| 2555 | |
| 2556 | /* now apply the maxshapes criteria (NOTE: this ignores the filter so you could get less than maxfeatures) */ |
| 2557 | if(layer->maxfeatures > 0) { |
| 2558 | |
| 2559 | for( i = (shpfile->numshapes - 1); i >= 0; i-- ) { |
| 2560 | n2 = msGetBit(shpfile->status, i); |
| 2561 | n1 += n2; |
| 2562 | if( n2 && n1 > layer->maxfeatures ) { |
| 2563 | msSetBit(shpfile->status, i, 0); |
| 2564 | } |
| 2565 | } |
| 2566 | |
| 2567 | } |
| 2568 | |
| 2569 | return MS_SUCCESS; |
| 2570 | } |
| 2571 | |
| 2572 | int msSHPLayerNextShape(layerObj *layer, shapeObj *shape) |
| 2573 | { |
nothing calls this directly
no test coverage detected