547 {
548 int i = 0;
549 int hasband = 0;
550
551 _param->
count = itrcount;
556
557
562
564
570
571 if (
574 _param->
width == NULL ||
582 ) {
583 rterror(
"_rti_iterator_arg_populate: Could not allocate memory for children of _rti_iterator_arg");
584 return 0;
585 }
586
587 *allnull = 0;
588 *allempty = 0;
589
590
591
592
593
594
595 for (i = 0; i < itrcount; i++) {
596
599 _param->
width[i] = 0;
601
603
609
610
611 if (itrset[i].raster == NULL) {
613
614 (*allnull)++;
615 (*allempty)++;
616
617 continue;
618 }
621
622 (*allempty)++;
623
624 continue;
625 }
626
627
629 if (!hasband) {
630 if (!itrset[i].nbnodata) {
631 rterror(
"_rti_iterator_arg_populate: Band %d not found for raster %d", itrset[i].nband, i);
632 return 0;
633 }
634 else {
635 RASTER_DEBUGF(4,
"Band %d not found for raster %d. Using NODATA", itrset[i].nband, i);
636 }
637 }
638
640 if (hasband) {
643 rterror(
"_rti_iterator_arg_populate: Could not get band %d for raster %d", itrset[i].nband, i);
644 return 0;
645 }
646
647
649
650
652
654
655
657 }
658
659 else {
660
662 }
663 }
664
665
668
669
671 if (_param->
offset[i] == NULL) {
672 rterror(
"_rti_iterator_arg_populate: Could not allocate memory for offsets");
673 return 0;
674 }
675 }
676
677 return 1;
678}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
#define RASTER_DEBUGF(level, msg,...)
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
double rt_band_get_min_value(rt_band band)
Returns the minimal possible value for the band according to the pixel type.
uint16_t rt_raster_get_height(rt_raster raster)
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
uint16_t rt_raster_get_width(rt_raster raster)
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
struct _rti_iterator_arg_t::@17 distance
struct _rti_iterator_arg_t::@16 band
struct _rti_iterator_arg_t::@18 dimension