PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ test_lwgeom_scale()

static void test_lwgeom_scale ( void  )
static

Definition at line 1020 of file cu_libgeom.c.

References ASSERT_DOUBLE_EQUAL, ASSERT_STRING_EQUAL, LWGEOM::bbox, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_add_bbox(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_scale(), lwgeom_to_ewkt(), POINT4D::m, GBOX::mmax, GBOX::mmin, test_gbox_same_2d(), POINT4D::x, GBOX::xmax, GBOX::xmin, POINT4D::y, GBOX::ymax, GBOX::ymin, POINT4D::z, GBOX::zmax, and GBOX::zmin.

Referenced by libgeom_suite_setup().

1021 {
1022  LWGEOM *geom;
1023  POINT4D factor;
1024  char *out_ewkt;
1025  GBOX *box;
1026 
1027  geom = lwgeom_from_wkt("SRID=4326;GEOMETRYCOLLECTION(POINT(0 1 2 3),POLYGON((-1 -1 0 1,-1 2.5 0 1,2 2 0 1,2 -1 0 1,-1 -1 0 1),(0 0 1 2,0 1 1 2,1 1 1 2,1 0 2 3,0 0 1 2)),LINESTRING(0 0 0 0, 1 2 3 4))", LW_PARSER_CHECK_NONE);
1028  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1029  lwgeom_scale(geom, &factor);
1030  out_ewkt = lwgeom_to_ewkt(geom);
1031  ASSERT_STRING_EQUAL(out_ewkt, "SRID=4326;GEOMETRYCOLLECTION(POINT(0 3 8 15),POLYGON((-2 -3 0 5,-2 7.5 0 5,4 6 0 5,4 -3 0 5,-2 -3 0 5),(0 0 4 10,0 3 4 10,2 3 4 10,2 0 8 15,0 0 4 10)),LINESTRING(0 0 0 0,2 6 12 20))");
1032  lwgeom_free(geom);
1033  lwfree(out_ewkt);
1034 
1035  geom = lwgeom_from_wkt("POINT(1 1 1 1)", LW_PARSER_CHECK_NONE);
1036  lwgeom_add_bbox(geom);
1037  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1038  lwgeom_scale(geom, &factor);
1039  box = geom->bbox;
1040  ASSERT_DOUBLE_EQUAL(box->xmin, 2);
1041  ASSERT_DOUBLE_EQUAL(box->xmax, 2);
1042  ASSERT_DOUBLE_EQUAL(box->ymin, 3);
1043  ASSERT_DOUBLE_EQUAL(box->ymax, 3);
1044  ASSERT_DOUBLE_EQUAL(box->zmin, 4);
1045  ASSERT_DOUBLE_EQUAL(box->zmax, 4);
1046  ASSERT_DOUBLE_EQUAL(box->mmin, 5);
1047  ASSERT_DOUBLE_EQUAL(box->mmax, 5);
1048  lwgeom_free(geom);
1049 }
double x
Definition: liblwgeom.h:336
GBOX * bbox
Definition: liblwgeom.h:382
double m
Definition: liblwgeom.h:336
void lwfree(void *mem)
Definition: lwutil.c:214
#define ASSERT_STRING_EQUAL(o, e)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:469
double xmax
Definition: liblwgeom.h:277
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
void lwgeom_scale(LWGEOM *geom, const POINT4D *factors)
Definition: lwgeom.c:1742
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:890
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1869
double zmax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
double z
Definition: liblwgeom.h:336
double mmin
Definition: liblwgeom.h:282
double zmin
Definition: liblwgeom.h:280
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:599
double mmax
Definition: liblwgeom.h:283
#define ASSERT_DOUBLE_EQUAL(o, e)
double y
Definition: liblwgeom.h:336
Here is the call graph for this function:
Here is the caller graph for this function: