* msOGRLayerGetShape() * * Returns shape from OGR data source by fid. * * Returns MS_SUCCESS/MS_FAILURE **********************************************************************/
| 2675 | * Returns MS_SUCCESS/MS_FAILURE |
| 2676 | **********************************************************************/ |
| 2677 | int msOGRLayerGetShape(layerObj *layer, shapeObj *shape, resultObj *record) |
| 2678 | { |
| 2679 | #ifdef USE_OGR |
| 2680 | msOGRFileInfo *psInfo =(msOGRFileInfo*)layer->layerinfo; |
| 2681 | |
| 2682 | long shapeindex = record->shapeindex; |
| 2683 | int tileindex = record->tileindex; |
| 2684 | int resultindex = record->resultindex; |
| 2685 | int record_is_fid = TRUE; |
| 2686 | |
| 2687 | /* set the resultindex as shapeindex if available */ |
| 2688 | if (resultindex >= 0) |
| 2689 | { |
| 2690 | record_is_fid = FALSE; |
| 2691 | shapeindex = resultindex; |
| 2692 | } |
| 2693 | |
| 2694 | if (psInfo == NULL || psInfo->hLayer == NULL) |
| 2695 | { |
| 2696 | msSetError(MS_MISCERR, "Assertion failed: OGR layer not opened!!!", "msOGRLayerGetShape()"); |
| 2697 | return(MS_FAILURE); |
| 2698 | } |
| 2699 | |
| 2700 | if( layer->tileindex == NULL ) |
| 2701 | return msOGRFileGetShape(layer, shape, shapeindex, psInfo, record_is_fid ); |
| 2702 | else |
| 2703 | { |
| 2704 | if( psInfo->poCurTile == NULL |
| 2705 | || psInfo->poCurTile->nTileId != tileindex ) |
| 2706 | { |
| 2707 | if( msOGRFileReadTile( layer, psInfo, tileindex ) != MS_SUCCESS ) |
| 2708 | return MS_FAILURE; |
| 2709 | } |
| 2710 | |
| 2711 | return msOGRFileGetShape(layer, shape, shapeindex, psInfo->poCurTile, record_is_fid ); |
| 2712 | } |
| 2713 | #else |
| 2714 | /* ------------------------------------------------------------------ |
| 2715 | * OGR Support not included... |
| 2716 | * ------------------------------------------------------------------ */ |
| 2717 | |
| 2718 | msSetError(MS_MISCERR, "OGR support is not available.", |
| 2719 | "msOGRLayerGetShape()"); |
| 2720 | return(MS_FAILURE); |
| 2721 | |
| 2722 | #endif /* USE_OGR */ |
| 2723 | } |
| 2724 | |
| 2725 | /********************************************************************** |
| 2726 | * msOGRLayerGetExtent() |
no test coverage detected