PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int rtpg_setvalues_geomval_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 3777 of file rt_pg.c.

References rtpg_setvaluesgv_arg_t::gv, rtpg_setvaluesgv_arg_t::keepnodata, rtpg_setvaluesgv_arg_t::ngv, rt_iterator_arg_t::nodata, rtpg_setvaluesgv_geomval_t::nodata, rtpg_setvaluesgv_geomval_t::pixval, POSTGIS_RT_DEBUG, POSTGIS_RT_DEBUGF, rt_iterator_arg_t::rasters, rtpg_setvaluesgv_geomval_t::value, and rt_iterator_arg_t::values.

Referenced by RASTER_setPixelValuesGeomval().

3780  {
3781  rtpg_setvaluesgv_arg funcarg = (rtpg_setvaluesgv_arg) userarg;
3782  int i = 0;
3783  int j = 0;
3784 
3785  *value = 0;
3786  *nodata = 0;
3787 
3788  POSTGIS_RT_DEBUGF(4, "keepnodata = %d", funcarg->keepnodata);
3789 
3790  /* keepnodata = TRUE */
3791  if (funcarg->keepnodata && arg->nodata[0][0][0]) {
3792  POSTGIS_RT_DEBUG(3, "keepnodata = 1 AND source raster pixel is NODATA");
3793  *nodata = 1;
3794  return 1;
3795  }
3796 
3797  for (i = arg->rasters - 1, j = funcarg->ngv - 1; i > 0; i--, j--) {
3798  POSTGIS_RT_DEBUGF(4, "checking raster %d", i);
3799 
3800  /* mask is NODATA */
3801  if (arg->nodata[i][0][0])
3802  continue;
3803  /* mask is NOT NODATA */
3804  else {
3805  POSTGIS_RT_DEBUGF(4, "Using information from geometry %d", j);
3806 
3807  if (funcarg->gv[j].pixval.nodata)
3808  *nodata = 1;
3809  else
3810  *value = funcarg->gv[j].pixval.value;
3811 
3812  return 1;
3813  }
3814  }
3815 
3816  POSTGIS_RT_DEBUG(4, "Using information from source raster");
3817 
3818  /* still here */
3819  if (arg->nodata[0][0][0])
3820  *nodata = 1;
3821  else
3822  *value = arg->values[0][0][0];
3823 
3824  return 1;
3825 }
rtpg_setvaluesgv_geomval gv
Definition: rt_pg.c:3731
uint16_t rasters
Definition: rt_api.h:2368
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rt_pg.h:58
struct rtpg_setvaluesgv_arg_t * rtpg_setvaluesgv_arg
Definition: rt_pg.c:3726
double *** values
Definition: rt_api.h:2376
struct rtpg_setvaluesgv_geomval_t::@16 pixval
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rt_pg.h:62
int *** nodata
Definition: rt_api.h:2378

Here is the caller graph for this function: