PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_geos_subdivide()

static void test_geos_subdivide ( void  )
static

Definition at line 157 of file cu_geos.c.

158 {
159  char *ewkt = "LINESTRING(0 0, 10 10)";
160  char *out_ewkt;
162  /* segmentize as geography to generate a non-simple curve */
163  LWGEOM *geom2 = lwgeom_segmentize_sphere(geom1, 0.002);
164 
165  LWCOLLECTION *geom3 = lwgeom_subdivide(geom2, 80);
166  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
167  // printf("\n--------\n%s\n--------\n", out_ewkt);
168  CU_ASSERT_EQUAL(2, geom3->ngeoms);
169  lwfree(out_ewkt);
170  lwcollection_free(geom3);
171 
172  geom3 = lwgeom_subdivide(geom2, 20);
173  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
174  // printf("\n--------\n%s\n--------\n", out_ewkt);
175  CU_ASSERT_EQUAL(8, geom3->ngeoms);
176  lwfree(out_ewkt);
177  lwcollection_free(geom3);
178 
179  lwgeom_free(geom2);
180  lwgeom_free(geom1);
181 }
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:1743
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:556
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices)
Definition: lwgeom.c:2448
void lwfree(void *mem)
Definition: lwutil.c:244
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:356
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
uint32_t ngeoms
Definition: liblwgeom.h:510

References LW_PARSER_CHECK_NONE, lwcollection_free(), lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_segmentize_sphere(), lwgeom_subdivide(), lwgeom_to_ewkt(), and LWCOLLECTION::ngeoms.

Referenced by geos_suite_setup().

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