PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_geos_subdivide()

static void test_geos_subdivide ( void  )
static

Definition at line 97 of file cu_geos.c.

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

Referenced by geos_suite_setup().

98 {
99 #if POSTGIS_GEOS_VERSION < 35
100  // printf("%d\n", POSTGIS_GEOS_VERSION);
101  return;
102 #else
103  char *ewkt = "MULTILINESTRING((0 0, 0 100))";
104  char *out_ewkt;
106  LWGEOM *geom2 = lwgeom_segmentize2d(geom1, 1.0);
107 
108  LWCOLLECTION *geom3 = lwgeom_subdivide(geom2, 80);
109  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
110  // printf("\n--------\n%s\n--------\n", out_ewkt);
111  CU_ASSERT_EQUAL(2, geom3->ngeoms);
112  lwfree(out_ewkt);
113  lwcollection_free(geom3);
114 
115  geom3 = lwgeom_subdivide(geom2, 20);
116  out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
117  // printf("\n--------\n%s\n--------\n", out_ewkt);
118  CU_ASSERT_EQUAL(8, geom3->ngeoms);
119  lwfree(out_ewkt);
120  lwcollection_free(geom3);
121 
122  lwgeom_free(geom2);
123  lwgeom_free(geom1);
124 #endif
125 }
void lwfree(void *mem)
Definition: lwutil.c:244
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:518
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, int maxvertices)
Definition: lwgeom.c:2054
LWGEOM * lwgeom_segmentize2d(LWGEOM *line, double dist)
Definition: lwgeom.c:717
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:340
Here is the call graph for this function:
Here is the caller graph for this function: