| 210 | /************************************************************************/ |
| 211 | |
| 212 | static void msRasterQueryAddPixel( layerObj *layer, pointObj *location, |
| 213 | float *values ) |
| 214 | |
| 215 | { |
| 216 | rasterLayerInfo *rlinfo = (rasterLayerInfo *) layer->layerinfo; |
| 217 | int red = 0, green = 0, blue = 0, nodata = FALSE; |
| 218 | int p_class = -1; |
| 219 | |
| 220 | if( rlinfo->query_results == rlinfo->query_result_hard_max ) |
| 221 | return; |
| 222 | |
| 223 | /* -------------------------------------------------------------------- */ |
| 224 | /* Is this our first time in? If so, do an initial allocation */ |
| 225 | /* for the data arrays suitable to our purposes. */ |
| 226 | /* -------------------------------------------------------------------- */ |
| 227 | if( rlinfo->query_alloc_max == 0 ) |
| 228 | { |
| 229 | rlinfo->query_alloc_max = 2; |
| 230 | |
| 231 | switch( rlinfo->raster_query_mode ) |
| 232 | { |
| 233 | case RQM_ENTRY_PER_PIXEL: |
| 234 | rlinfo->qc_x = (double *) |
| 235 | msSmallCalloc(sizeof(double),rlinfo->query_alloc_max); |
| 236 | rlinfo->qc_y = (double *) |
| 237 | msSmallCalloc(sizeof(double),rlinfo->query_alloc_max); |
| 238 | rlinfo->qc_values = (float *) |
| 239 | msSmallCalloc(sizeof(float), |
| 240 | rlinfo->query_alloc_max*rlinfo->band_count); |
| 241 | rlinfo->qc_red = (int *) |
| 242 | msSmallCalloc(sizeof(int),rlinfo->query_alloc_max); |
| 243 | rlinfo->qc_green = (int *) |
| 244 | msSmallCalloc(sizeof(int),rlinfo->query_alloc_max); |
| 245 | rlinfo->qc_blue = (int *) |
| 246 | msSmallCalloc(sizeof(int),rlinfo->query_alloc_max); |
| 247 | if( layer->numclasses > 0 ) |
| 248 | rlinfo->qc_class = (int *) |
| 249 | msSmallCalloc(sizeof(int),rlinfo->query_alloc_max); |
| 250 | break; |
| 251 | |
| 252 | case RQM_HIST_ON_CLASS: |
| 253 | break; |
| 254 | |
| 255 | case RQM_HIST_ON_VALUE: |
| 256 | break; |
| 257 | |
| 258 | default: |
| 259 | assert( FALSE ); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | /* -------------------------------------------------------------------- */ |
| 264 | /* Reallocate the data arrays larger if they are near the max */ |
| 265 | /* now. */ |
| 266 | /* -------------------------------------------------------------------- */ |
| 267 | if( rlinfo->query_results == rlinfo->query_alloc_max ) |
| 268 | { |
| 269 | rlinfo->query_alloc_max = rlinfo->query_alloc_max * 2 + 100; |
no test coverage detected