| 2073 | /************************************************************************/ |
| 2074 | |
| 2075 | int msOGRFileReadTile( layerObj *layer, msOGRFileInfo *psInfo, |
| 2076 | int targetTile = -1 ) |
| 2077 | |
| 2078 | { |
| 2079 | int nFeatureId; |
| 2080 | |
| 2081 | /* -------------------------------------------------------------------- */ |
| 2082 | /* Close old tile if one is open. */ |
| 2083 | /* -------------------------------------------------------------------- */ |
| 2084 | if( psInfo->poCurTile != NULL ) |
| 2085 | { |
| 2086 | msOGRFileClose( layer, psInfo->poCurTile ); |
| 2087 | psInfo->poCurTile = NULL; |
| 2088 | } |
| 2089 | |
| 2090 | /* -------------------------------------------------------------------- */ |
| 2091 | /* If -2 is passed, then seek reset reading of the tileindex. */ |
| 2092 | /* We want to start from the beginning even if this file is */ |
| 2093 | /* shared between layers or renders. */ |
| 2094 | /* -------------------------------------------------------------------- */ |
| 2095 | ACQUIRE_OGR_LOCK; |
| 2096 | if( targetTile == -2 ) |
| 2097 | { |
| 2098 | OGR_L_ResetReading( psInfo->hLayer ); |
| 2099 | } |
| 2100 | |
| 2101 | /* -------------------------------------------------------------------- */ |
| 2102 | /* Get the name (connection string really) of the next tile. */ |
| 2103 | /* -------------------------------------------------------------------- */ |
| 2104 | OGRFeatureH hFeature; |
| 2105 | char *connection = NULL; |
| 2106 | msOGRFileInfo *psTileInfo = NULL; |
| 2107 | int status; |
| 2108 | |
| 2109 | #ifndef IGNORE_MISSING_DATA |
| 2110 | NextFile: |
| 2111 | #endif |
| 2112 | |
| 2113 | if( targetTile < 0 ) |
| 2114 | hFeature = OGR_L_GetNextFeature( psInfo->hLayer ); |
| 2115 | |
| 2116 | else |
| 2117 | hFeature = OGR_L_GetFeature( psInfo->hLayer, targetTile ); |
| 2118 | |
| 2119 | if( hFeature == NULL ) |
| 2120 | { |
| 2121 | RELEASE_OGR_LOCK; |
| 2122 | if( targetTile == -1 ) |
| 2123 | return MS_DONE; |
| 2124 | else |
| 2125 | return MS_FAILURE; |
| 2126 | |
| 2127 | } |
| 2128 | |
| 2129 | connection = msStrdup( OGR_F_GetFieldAsString( hFeature, |
| 2130 | layer->tileitemindex )); |
| 2131 | |
| 2132 | nFeatureId = OGR_F_GetFID( hFeature ); |
no test coverage detected