24 #include "CUnit/Basic.h"
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);
static void test_raster_metadata()
void raster_basics_suite_setup(void)
static void test_raster_from_band()
static void test_raster_clone()
static void test_raster_replace_band()
static void test_raster_empty()
static void test_raster_new()
#define PG_ADD_TEST(suite, testfunc)
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.
void rt_band_set_ownsdata_flag(rt_band band, int flag)
void * rtalloc(size_t size)
Wrappers used for managing memory.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
void rt_raster_set_skews(rt_raster raster, double skewX, double skewY)
Set skews about the X and Y axis.
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
rt_band rt_raster_replace_band(rt_raster raster, rt_band band, int index)
Replace band at provided index with new band.
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.
uint16_t rt_raster_get_num_bands(rt_raster raster)
rt_raster rt_raster_clone(rt_raster raster, uint8_t deep)
Clone an existing raster.
uint16_t rt_raster_get_height(rt_raster raster)
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
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.
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
uint16_t rt_raster_get_width(rt_raster raster)
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.
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.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)