PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_geos_subdivide()

static void test_geos_subdivide ( void  )
static

Definition at line 169 of file cu_geos.c.

170{
171 char *ewkt = "LINESTRING(0 0, 10 10)";
172 char *out_ewkt;
174 /* segmentize as geography to generate a non-simple curve */
175 LWGEOM *geom2 = lwgeom_segmentize_sphere(geom1, 0.002);
176
177 LWCOLLECTION *geom3 = lwgeom_subdivide(geom2, 80);
178 out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
179 // printf("\n--------\n%s\n--------\n", out_ewkt);
180 CU_ASSERT_EQUAL(2, geom3->ngeoms);
181 lwfree(out_ewkt);
182 lwcollection_free(geom3);
183
184 geom3 = lwgeom_subdivide(geom2, 20);
185 out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
186 // printf("\n--------\n%s\n--------\n", out_ewkt);
187 CU_ASSERT_EQUAL(8, geom3->ngeoms);
188 lwfree(out_ewkt);
189 lwcollection_free(geom3);
190
191 lwgeom_free(geom2);
192 lwgeom_free(geom1);
193}
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an allocated string.
Definition lwgeom.c:593
void lwfree(void *mem)
Definition lwutil.c:248
void lwcollection_free(LWCOLLECTION *col)
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices)
Definition lwgeom.c:2642
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
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...
uint32_t ngeoms
Definition liblwgeom.h:580

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: