* msOGRLayerNextShape() * * Returns shape sequentially from OGR data source. * msOGRLayerWhichShape() must have been called first. * * Returns MS_SUCCESS/MS_FAILURE **********************************************************************/
| 2617 | * Returns MS_SUCCESS/MS_FAILURE |
| 2618 | **********************************************************************/ |
| 2619 | int msOGRLayerNextShape(layerObj *layer, shapeObj *shape) |
| 2620 | { |
| 2621 | #ifdef USE_OGR |
| 2622 | msOGRFileInfo *psInfo =(msOGRFileInfo*)layer->layerinfo; |
| 2623 | int status; |
| 2624 | |
| 2625 | if (psInfo == NULL || psInfo->hLayer == NULL) |
| 2626 | { |
| 2627 | msSetError(MS_MISCERR, "Assertion failed: OGR layer not opened!!!", |
| 2628 | "msOGRLayerNextShape()"); |
| 2629 | return(MS_FAILURE); |
| 2630 | } |
| 2631 | |
| 2632 | if( layer->tileindex == NULL ) |
| 2633 | return msOGRFileNextShape( layer, shape, psInfo ); |
| 2634 | |
| 2635 | // Do we need to load the first tile? |
| 2636 | if( psInfo->poCurTile == NULL ) |
| 2637 | { |
| 2638 | status = msOGRFileReadTile( layer, psInfo ); |
| 2639 | if( status != MS_SUCCESS ) |
| 2640 | return status; |
| 2641 | } |
| 2642 | |
| 2643 | do |
| 2644 | { |
| 2645 | // Try getting a shape from this tile. |
| 2646 | status = msOGRFileNextShape( layer, shape, psInfo->poCurTile ); |
| 2647 | if( status != MS_DONE ) |
| 2648 | return status; |
| 2649 | |
| 2650 | // try next tile. |
| 2651 | status = msOGRFileReadTile( layer, psInfo ); |
| 2652 | if( status != MS_SUCCESS ) |
| 2653 | return status; |
| 2654 | } while( status == MS_SUCCESS ); |
| 2655 | |
| 2656 | return status; |
| 2657 | |
| 2658 | #else |
| 2659 | /* ------------------------------------------------------------------ |
| 2660 | * OGR Support not included... |
| 2661 | * ------------------------------------------------------------------ */ |
| 2662 | |
| 2663 | msSetError(MS_MISCERR, "OGR support is not available.", |
| 2664 | "msOGRLayerNextShape()"); |
| 2665 | return(MS_FAILURE); |
| 2666 | |
| 2667 | #endif /* USE_OGR */ |
| 2668 | } |
| 2669 | |
| 2670 | /********************************************************************** |
| 2671 | * msOGRLayerGetShape() |
no test coverage detected