PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ test_geos_subdivide()

static void test_geos_subdivide ( void  )
static

Definition at line 145 of file cu_geos.c.

References geos_suite_setup(), LW_PARSER_CHECK_NONE, lwcollection_free(), lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_segmentize_sphere(), lwgeom_subdivide(), and lwgeom_to_ewkt().

Referenced by geos_suite_setup().

146 {
147  char *ewkt = "LINESTRING(0 0, 10 10)";
148  char *out_ewkt;
150  /* segmentize as geography to generate a non-simple curve */
151  LWGEOM *geom2 = lwgeom_segmentize_sphere(geom1, 0.002);
152 
153  LWCOLLECTION *geom3 = lwgeom_subdivide(geom2, 80);
154  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
155  // printf("\n--------\n%s\n--------\n", out_ewkt);
156  CU_ASSERT_EQUAL(2, geom3->ngeoms);
157  lwfree(out_ewkt);
158  lwcollection_free(geom3);
159 
160  geom3 = lwgeom_subdivide(geom2, 20);
161  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
162  // printf("\n--------\n%s\n--------\n", out_ewkt);
163  CU_ASSERT_EQUAL(8, geom3->ngeoms);
164  lwfree(out_ewkt);
165  lwcollection_free(geom3);
166 
167  lwgeom_free(geom2);
168  lwgeom_free(geom1);
169 }
void lwfree(void *mem)
Definition: lwutil.c:244
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:556
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
uint32_t ngeoms
Definition: liblwgeom.h:509
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2004
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices)
Definition: lwgeom.c:2425
LWGEOM * lwgeom_segmentize_sphere(const LWGEOM *lwg_in, double max_seg_length)
Derive a new geometry with vertices added to ensure no vertex is more than max_seg_length (in radians...
Definition: lwgeodetic.c:1656
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:356
Here is the call graph for this function:
Here is the caller graph for this function: