379 ArrayType *mdValues = NULL;
380 Datum *_values = NULL;
381 bool *_nodata = NULL;
383 ArrayType *mdPos = NULL;
392 int lbound[3] = {1, 1, 1};
393 Datum datum = (Datum) NULL;
407 if (_values == NULL || _nodata == NULL) {
408 elog(ERROR,
"rtpg_nmapalgebra_callback: Could not allocate memory for values array");
415 for (z = 0; z < arg->
rasters; z++) {
417 for (
y = 0;
y < arg->
rows;
y++) {
423 _nodata[i] = (bool) arg->
nodata[z][
y][
x];
425 _values[i] = Float8GetDatum(arg->
values[z][
y][
x]);
427 _values[i] = (Datum) NULL;
435 get_typlenbyvalalign(FLOAT8OID, &typlen, &typbyval, &typalign);
438 mdValues = construct_md_array(
442 typlen, typbyval, typalign
447 _pos = palloc(
sizeof(Datum) * (arg->
rasters + 1) * 2);
448 _null = palloc(
sizeof(
bool) * (arg->
rasters + 1) * 2);
449 if (_pos == NULL || _null == NULL) {
451 elog(ERROR,
"rtpg_nmapalgebra_callback: Could not allocate memory for position array");
454 memset(_null, 0,
sizeof(
bool) * (arg->
rasters + 1) * 2);
463 for (z = 0; z < arg->
rasters; z++) {
464 _pos[i] = (Datum)arg->
src_pixel[z][0] + 1;
467 _pos[i] = (Datum)arg->
src_pixel[z][1] + 1;
472 get_typlenbyvalalign(INT4OID, &typlen, &typbyval, &typalign);
480 mdPos = construct_md_array(
484 typlen, typbyval, typalign
489 callback->
ufc_info->args[0].value = PointerGetDatum(mdValues);
490 callback->
ufc_info->args[1].value = PointerGetDatum(mdPos);
493 datum = FunctionCallInvoke(callback->
ufc_info);
502 *
value = DatumGetFloat8(datum);
505 *
value = (double) DatumGetFloat4(datum);
508 *
value = (double) DatumGetInt32(datum);
511 *
value = (double) DatumGetInt16(datum);
#define POSTGIS_RT_DEBUGF(level, msg,...)
FunctionCallInfo ufc_info