PostGIS  2.3.8dev-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 1126 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().

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