PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ test_lwgeom_scale()

static void test_lwgeom_scale ( void  )
static

Definition at line 1025 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().

1026 {
1027  LWGEOM *geom;
1028  POINT4D factor;
1029  char *out_ewkt;
1030  GBOX *box;
1031 
1032  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);
1033  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1034  lwgeom_scale(geom, &factor);
1035  out_ewkt = lwgeom_to_ewkt(geom);
1036  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))");
1037  lwgeom_free(geom);
1038  lwfree(out_ewkt);
1039 
1040  geom = lwgeom_from_wkt("POINT(1 1 1 1)", LW_PARSER_CHECK_NONE);
1041  lwgeom_add_bbox(geom);
1042  factor.x = 2; factor.y = 3; factor.z = 4; factor.m = 5;
1043  lwgeom_scale(geom, &factor);
1044  box = geom->bbox;
1045  ASSERT_DOUBLE_EQUAL(box->xmin, 2);
1046  ASSERT_DOUBLE_EQUAL(box->xmax, 2);
1047  ASSERT_DOUBLE_EQUAL(box->ymin, 3);
1048  ASSERT_DOUBLE_EQUAL(box->ymax, 3);
1049  ASSERT_DOUBLE_EQUAL(box->zmin, 4);
1050  ASSERT_DOUBLE_EQUAL(box->zmax, 4);
1051  ASSERT_DOUBLE_EQUAL(box->mmin, 5);
1052  ASSERT_DOUBLE_EQUAL(box->mmax, 5);
1053  lwgeom_free(geom);
1054 }
double x
Definition: liblwgeom.h:354
GBOX * bbox
Definition: liblwgeom.h:400
double m
Definition: liblwgeom.h:354
void lwfree(void *mem)
Definition: lwutil.c:244
#define ASSERT_STRING_EQUAL(o, e)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:556
double xmax
Definition: liblwgeom.h:295
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
void lwgeom_scale(LWGEOM *geom, const POINT4D *factors)
Definition: lwgeom.c:2020
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2004
double zmax
Definition: liblwgeom.h:299
double ymin
Definition: liblwgeom.h:296
double xmin
Definition: liblwgeom.h:294
double ymax
Definition: liblwgeom.h:297
double z
Definition: liblwgeom.h:354
double mmin
Definition: liblwgeom.h:300
double zmin
Definition: liblwgeom.h:298
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:686
double mmax
Definition: liblwgeom.h:301
#define ASSERT_DOUBLE_EQUAL(o, e)
double y
Definition: liblwgeom.h:354
Here is the call graph for this function:
Here is the caller graph for this function: