PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_gserialized_from_lwgeom()

static void test_gserialized_from_lwgeom ( void  )
static

Definition at line 894 of file cu_geodetic.c.

895 {
896  LWGEOM *geom;
897  GSERIALIZED *g;
898  uint32_t type;
899  double *inspect; /* To poke right into the blob. */
900 
901  geom = lwgeom_from_wkt("POINT(0 0.2)", LW_PARSER_CHECK_NONE);
902  FLAGS_SET_GEODETIC(geom->flags, 1);
903  g = gserialized_from_lwgeom(geom, 0);
905  CU_ASSERT_EQUAL( type, POINTTYPE );
906  inspect = (double*)g;
907  CU_ASSERT_EQUAL(inspect[3], 0.2);
908  lwgeom_free(geom);
909  lwfree(g);
910 
911  geom = lwgeom_from_wkt("POLYGON((-1 -1, -1 2.5, 2 2, 2 -1, -1 -1), (0 0, 0 1, 1 1, 1 0, 0 0))", LW_PARSER_CHECK_NONE);
912  FLAGS_SET_GEODETIC(geom->flags, 1);
913  g = gserialized_from_lwgeom(geom, 0);
915  CU_ASSERT_EQUAL( type, POLYGONTYPE );
916  inspect = (double*)g;
917  CU_ASSERT_EQUAL(inspect[9], 2.5);
918  lwgeom_free(geom);
919  lwfree(g);
920 
921  geom = lwgeom_from_wkt("MULTILINESTRING((0 0, 1 1),(0 0.1, 1 1))", LW_PARSER_CHECK_NONE);
922  FLAGS_SET_GEODETIC(geom->flags, 1);
923  g = gserialized_from_lwgeom(geom, 0);
925  CU_ASSERT_EQUAL( type, MULTILINETYPE );
926  inspect = (double*)g;
927  CU_ASSERT_EQUAL(inspect[12], 0.1);
928  lwgeom_free(geom);
929  lwfree(g);
930 
931 }
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: g_serialized.c:86
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
void lwfree(void *mem)
Definition: lwutil.c:244
#define POLYGONTYPE
Definition: liblwgeom.h:87
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:149
type
Definition: ovdump.py:41
uint8_t flags
Definition: liblwgeom.h:400
unsigned int uint32_t
Definition: uthash.h:78

References LWGEOM::flags, FLAGS_SET_GEODETIC, gserialized_from_lwgeom(), gserialized_get_type(), LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkt(), MULTILINETYPE, POINTTYPE, POLYGONTYPE, and ovdump::type.

Referenced by geodetic_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: