MCPcopy Index your code
hub / github.com/MapServer/MapServer / msRasterQueryAddPixel

Function msRasterQueryAddPixel

maprasterquery.c:212–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210/************************************************************************/
211
212static 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;

Callers 1

msRasterQueryByRectLowFunction · 0.85

Calls 4

msSmallCallocFunction · 0.85
msSmallReallocFunction · 0.85
msGetClass_FloatRGBFunction · 0.85
addResultFunction · 0.70

Tested by

no test coverage detected