24 #include "CUnit/Basic.h" 31 CU_ASSERT(raster != NULL);
35 CU_ASSERT(raster != NULL);
39 CU_ASSERT(raster != NULL);
48 CU_ASSERT(raster != NULL);
54 CU_ASSERT(raster != NULL);
67 CU_ASSERT(raster != NULL);
109 CU_ASSERT(rast1 != NULL);
116 CU_ASSERT(band != NULL);
120 CU_ASSERT(rast2 != NULL);
125 CU_ASSERT_DOUBLE_EQUAL(gt[0], 0, DBL_EPSILON);
126 CU_ASSERT_DOUBLE_EQUAL(gt[1], 1, DBL_EPSILON);
127 CU_ASSERT_DOUBLE_EQUAL(gt[2], 0, DBL_EPSILON);
128 CU_ASSERT_DOUBLE_EQUAL(gt[3], 0, DBL_EPSILON);
129 CU_ASSERT_DOUBLE_EQUAL(gt[4], 0, DBL_EPSILON);
130 CU_ASSERT_DOUBLE_EQUAL(gt[5], -1, DBL_EPSILON);
136 CU_ASSERT(rast2 != NULL);
154 CU_ASSERT(raster != NULL);
156 for (x = 0; x < 5; x++) {
158 CU_ASSERT(band != NULL);
163 CU_ASSERT(rast != NULL);
183 CU_ASSERT(raster != NULL);
185 CU_ASSERT(band != NULL);
187 CU_ASSERT(band != NULL);
195 CU_ASSERT(band != NULL);
199 CU_ASSERT(rband != NULL);
201 CU_ASSERT_DOUBLE_EQUAL(nodata, 1, DBL_EPSILON);
211 CU_pSuite suite = CU_add_suite(
"raster_basics", NULL, NULL);
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
int rt_raster_get_num_bands(rt_raster raster)
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
rt_raster rt_raster_from_band(rt_raster raster, uint32_t *bandNums, int count)
Construct a new rt_raster from an existing rt_raster and an array of band numbers.
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
static void test_raster_clone()
static void test_raster_metadata()
void rt_raster_set_skews(rt_raster raster, double skewX, double skewY)
Set skews about the X and Y axis.
void * rtalloc(size_t size)
Wrappers used for managing memory.
static void test_raster_empty()
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
void rt_band_destroy(rt_band band)
Destroy a raster band.
static void test_raster_replace_band()
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void rt_band_set_ownsdata_flag(rt_band band, int flag)
static void test_raster_new()
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
rt_raster rt_raster_clone(rt_raster raster, uint8_t deep)
Clone an existing raster.
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
#define PG_ADD_TEST(suite, testfunc)
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
static void test_raster_from_band()
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
rt_band rt_raster_replace_band(rt_raster raster, rt_band band, int index)
Replace band at provided index with new band.
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
rt_band rt_band_new_inline(uint16_t width, uint16_t height, rt_pixtype pixtype, uint32_t hasnodata, double nodataval, uint8_t *data)
Create an in-db rt_band with no data.
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.
uint16_t rt_raster_get_width(rt_raster raster)
void raster_basics_suite_setup(void)
uint16_t rt_raster_get_height(rt_raster raster)
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.