PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ 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 }
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:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:547
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices)
Definition: lwgeom.c:2439
void lwfree(void *mem)
Definition: lwutil.c:242
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:357
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905
uint32_t ngeoms
Definition: liblwgeom.h:566

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: