PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ rtpg_setvalues_geomval_callback()

static int rtpg_setvalues_geomval_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 1127 of file rtpg_pixel.c.

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

Referenced by RASTER_setPixelValuesGeomval().

1130  {
1131  rtpg_setvaluesgv_arg funcarg = (rtpg_setvaluesgv_arg) userarg;
1132  int i = 0;
1133  int j = 0;
1134 
1135  *value = 0;
1136  *nodata = 0;
1137 
1138  POSTGIS_RT_DEBUGF(4, "keepnodata = %d", funcarg->keepnodata);
1139 
1140  /* keepnodata = TRUE */
1141  if (funcarg->keepnodata && arg->nodata[0][0][0]) {
1142  POSTGIS_RT_DEBUG(3, "keepnodata = 1 AND source raster pixel is NODATA");
1143  *nodata = 1;
1144  return 1;
1145  }
1146 
1147  for (i = arg->rasters - 1, j = funcarg->ngv - 1; i > 0; i--, j--) {
1148  POSTGIS_RT_DEBUGF(4, "checking raster %d", i);
1149 
1150  /* mask is NODATA */
1151  if (arg->nodata[i][0][0])
1152  continue;
1153  /* mask is NOT NODATA */
1154  else {
1155  POSTGIS_RT_DEBUGF(4, "Using information from geometry %d", j);
1156 
1157  if (funcarg->gv[j].pixval.nodata)
1158  *nodata = 1;
1159  else
1160  *value = funcarg->gv[j].pixval.value;
1161 
1162  return 1;
1163  }
1164  }
1165 
1166  POSTGIS_RT_DEBUG(4, "Using information from source raster");
1167 
1168  /* still here */
1169  if (arg->nodata[0][0][0])
1170  *nodata = 1;
1171  else
1172  *value = arg->values[0][0][0];
1173 
1174  return 1;
1175 }
struct rtpg_setvaluesgv_geomval_t::@21 pixval
rtpg_setvaluesgv_geomval gv
Definition: rtpg_pixel.c:1081
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:65
uint16_t rasters
Definition: librtcore.h:2451
struct rtpg_setvaluesgv_arg_t * rtpg_setvaluesgv_arg
Definition: rtpg_pixel.c:1076
double *** values
Definition: librtcore.h:2459
int value
Definition: genraster.py:61
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rtpostgis.h:61
Here is the call graph for this function:
Here is the caller graph for this function: