375 ArrayType *mdValues = NULL;
376 Datum *_values = NULL;
377 bool *_nodata = NULL;
379 ArrayType *mdPos = NULL;
388 int lbound[3] = {1, 1, 1};
389 Datum datum = (Datum) NULL;
403 if (_values == NULL || _nodata == NULL) {
404 elog(ERROR,
"rtpg_nmapalgebra_callback: Could not allocate memory for values array");
411 for (z = 0; z < arg->
rasters; z++) {
413 for (y = 0; y < arg->
rows; y++) {
415 for (x = 0; x < arg->
columns; x++) {
419 _nodata[i] = (bool) arg->
nodata[z][y][x];
421 _values[i] = Float8GetDatum(arg->
values[z][y][x]);
423 _values[i] = (Datum) NULL;
431 get_typlenbyvalalign(FLOAT8OID, &typlen, &typbyval, &typalign);
434 mdValues = construct_md_array(
438 typlen, typbyval, typalign
443 _pos = palloc(
sizeof(Datum) * (arg->
rasters + 1) * 2);
444 _null = palloc(
sizeof(
bool) * (arg->
rasters + 1) * 2);
445 if (_pos == NULL || _null == NULL) {
447 elog(ERROR,
"rtpg_nmapalgebra_callback: Could not allocate memory for position array");
450 memset(_null, 0,
sizeof(
bool) * (arg->
rasters + 1) * 2);
459 for (z = 0; z < arg->
rasters; z++) {
468 get_typlenbyvalalign(INT4OID, &typlen, &typbyval, &typalign);
476 mdPos = construct_md_array(
480 typlen, typbyval, typalign
485 #if POSTGIS_PGSQL_VERSION < 120 486 callback->
ufc_info.arg[0] = PointerGetDatum(mdValues);
487 callback->
ufc_info.arg[1] = PointerGetDatum(mdPos);
489 callback->
ufc_info->args[0].value = PointerGetDatum(mdValues);
490 callback->
ufc_info->args[1].value = PointerGetDatum(mdPos);
494 #if POSTGIS_PGSQL_VERSION < 120 495 datum = FunctionCallInvoke(&(callback->
ufc_info));
497 datum = FunctionCallInvoke(callback->
ufc_info);
503 #if POSTGIS_PGSQL_VERSION < 120 511 *
value = DatumGetFloat8(datum);
514 *
value = (double) DatumGetFloat4(datum);
517 *
value = (double) DatumGetInt32(datum);
520 *
value = (double) DatumGetInt16(datum);
#define POSTGIS_RT_DEBUGF(level, msg,...)
FunctionCallInfoData ufc_info