PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_lwgeom_scale ( void  )
static

Definition at line 1021 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, POINT4D::x, GBOX::xmax, GBOX::xmin, POINT4D::y, GBOX::ymax, GBOX::ymin, POINT4D::z, GBOX::zmax, and GBOX::zmin.

Referenced by libgeom_suite_setup().

1022 {
1023  LWGEOM *geom;
1024  POINT4D factor;
1025  char *out_ewkt;
1026  GBOX *box;
1027 
1028  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);
1029  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1030  lwgeom_scale(geom, &factor);
1031  out_ewkt = lwgeom_to_ewkt(geom);
1032  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))");
1033  lwgeom_free(geom);
1034  lwfree(out_ewkt);
1035 
1036  geom = lwgeom_from_wkt("POINT(1 1 1 1)", LW_PARSER_CHECK_NONE);
1037  lwgeom_add_bbox(geom);
1038  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1039  lwgeom_scale(geom, &factor);
1040  box = geom->bbox;
1041  ASSERT_DOUBLE_EQUAL(box->xmin, 2);
1042  ASSERT_DOUBLE_EQUAL(box->xmax, 2);
1043  ASSERT_DOUBLE_EQUAL(box->ymin, 3);
1044  ASSERT_DOUBLE_EQUAL(box->ymax, 3);
1045  ASSERT_DOUBLE_EQUAL(box->zmin, 4);
1046  ASSERT_DOUBLE_EQUAL(box->zmax, 4);
1047  ASSERT_DOUBLE_EQUAL(box->mmin, 5);
1048  ASSERT_DOUBLE_EQUAL(box->mmax, 5);
1049  lwgeom_free(geom);
1050 }
double x
Definition: liblwgeom.h:351
GBOX * bbox
Definition: liblwgeom.h:397
double m
Definition: liblwgeom.h:351
void lwfree(void *mem)
Definition: lwutil.c:242
#define ASSERT_STRING_EQUAL(o, e)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:482
double xmax
Definition: liblwgeom.h:292
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
void lwgeom_scale(LWGEOM *geom, const POINT4D *factors)
Definition: lwgeom.c:1755
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
double ymax
Definition: liblwgeom.h:294
double z
Definition: liblwgeom.h:351
double mmin
Definition: liblwgeom.h:297
double zmin
Definition: liblwgeom.h:295
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:612
double mmax
Definition: liblwgeom.h:298
#define ASSERT_DOUBLE_EQUAL(o, e)
double y
Definition: liblwgeom.h:351

Here is the call graph for this function:

Here is the caller graph for this function: