24 #include "CUnit/Basic.h"
31 double gt[6] = {-128.604911499087763, 0.002424431085498, 0, 53.626968388905752, 0, -0.002424431085498};
40 CU_ASSERT_DOUBLE_EQUAL(xw,
gt[0], DBL_EPSILON);
41 CU_ASSERT_DOUBLE_EQUAL(yw,
gt[3], DBL_EPSILON);
50 double gt[6] = {-128.604911499087763, 0.002424431085498, 0, 53.626968388905752, 0, -0.002424431085498};
59 CU_ASSERT_DOUBLE_EQUAL(xr, 0, DBL_EPSILON);
60 CU_ASSERT_DOUBLE_EQUAL(yr, 0, DBL_EPSILON);
70 double offset[4] = {0.};
73 CU_ASSERT(rast1 != NULL);
78 CU_ASSERT(rast2 != NULL);
88 CU_ASSERT(
rast != NULL);
91 CU_ASSERT_DOUBLE_EQUAL(offset[0], 0, DBL_EPSILON);
92 CU_ASSERT_DOUBLE_EQUAL(offset[1], 0, DBL_EPSILON);
93 CU_ASSERT_DOUBLE_EQUAL(offset[2], 2, DBL_EPSILON);
94 CU_ASSERT_DOUBLE_EQUAL(offset[3], 2, DBL_EPSILON);
104 CU_ASSERT(
rast != NULL);
107 CU_ASSERT_DOUBLE_EQUAL(offset[0], -2, DBL_EPSILON);
108 CU_ASSERT_DOUBLE_EQUAL(offset[1], -2, DBL_EPSILON);
109 CU_ASSERT_DOUBLE_EQUAL(offset[2], 0, DBL_EPSILON);
110 CU_ASSERT_DOUBLE_EQUAL(offset[3], 0, DBL_EPSILON);
120 CU_ASSERT(
rast != NULL);
123 CU_ASSERT_DOUBLE_EQUAL(offset[0], -2, DBL_EPSILON);
124 CU_ASSERT_DOUBLE_EQUAL(offset[1], -2, DBL_EPSILON);
125 CU_ASSERT_DOUBLE_EQUAL(offset[2], 0, DBL_EPSILON);
126 CU_ASSERT_DOUBLE_EQUAL(offset[3], 0, DBL_EPSILON);
136 CU_ASSERT(
rast != NULL);
139 CU_ASSERT_DOUBLE_EQUAL(offset[0], 0, DBL_EPSILON);
140 CU_ASSERT_DOUBLE_EQUAL(offset[1], 0, DBL_EPSILON);
141 CU_ASSERT_DOUBLE_EQUAL(offset[2], 2, DBL_EPSILON);
142 CU_ASSERT_DOUBLE_EQUAL(offset[3], 2, DBL_EPSILON);
152 CU_ASSERT_NOT_EQUAL(err,
ES_NONE);
162 CU_ASSERT_NOT_EQUAL(err,
ES_NONE);
172 CU_ASSERT_NOT_EQUAL(err,
ES_NONE);
181 double skew[2] = {0.25, 0.25};
182 double scale[2] = {1, -1};
198 CU_ASSERT(
rast != NULL);
211 CU_pSuite suite = CU_add_suite(
"raster_misc", NULL, NULL);
static void test_raster_cell_to_geopoint()
static void test_raster_from_two_rasters()
void raster_misc_suite_setup(void)
static void test_raster_compute_skewed_raster()
static void test_raster_geopoint_to_cell()
#define PG_ADD_TEST(suite, testfunc)
rt_errorstate rt_raster_cell_to_geopoint(rt_raster raster, double xr, double yr, double *xw, double *yw, double *gt)
Convert an xr, yr raster point to an xw, yw point on map.
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
void rt_raster_set_geotransform_matrix(rt_raster raster, double *gt)
Set raster's geotransform using 6-element array.
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
rt_errorstate rt_raster_geopoint_to_cell(rt_raster raster, double xw, double yw, double *xr, double *yr, double *igt)
Convert an xw, yw map point to a xr, yr raster point.
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.
rt_raster rt_raster_compute_skewed_raster(rt_envelope extent, double *skew, double *scale, double tolerance)
uint16_t rt_raster_get_height(rt_raster raster)
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
uint16_t rt_raster_get_width(rt_raster raster)
rt_errorstate rt_raster_from_two_rasters(rt_raster rast1, rt_raster rast2, rt_extenttype extenttype, rt_raster *rtnraster, double *offset)
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
void cu_free_raster(rt_raster raster)