1255 GEOSGeometry *geos_result, *shp;
1256 GEOSGeometry
const *vgeoms[1];
1258 int srid = GEOSGetSRID(geom_in);
1261 vgeoms[0] = geom_in;
1262 #ifdef LWGEOM_PROFILE_BUILDAREA 1265 geos_result = GEOSPolygonize(vgeoms, 1);
1267 LWDEBUGF(3,
"GEOSpolygonize returned @ %p", geos_result);
1270 if ( ! geos_result )
return 0;
1275 #if PARANOIA_LEVEL > 0 1278 GEOSGeom_destroy(geos_result);
1279 lwerror(
"%s [%d] Unexpected return from GEOSpolygonize", __FILE__, __LINE__);
1284 ngeoms = GEOSGetNumGeometries(geos_result);
1285 #ifdef LWGEOM_PROFILE_BUILDAREA 1286 lwnotice(
"Num geometries from polygonizer: %d", ngeoms);
1290 LWDEBUGF(3,
"GEOSpolygonize: ngeoms in polygonize output: %d", ngeoms);
1291 LWDEBUGF(3,
"GEOSpolygonize: polygonized:%s",
1299 GEOSSetSRID(geos_result, srid);
1309 tmp = (GEOSGeometry *)GEOSGetGeometryN(geos_result, 0);
1312 GEOSGeom_destroy(geos_result);
1315 shp = GEOSGeom_clone(tmp);
1316 GEOSGeom_destroy(geos_result);
1317 GEOSSetSRID(shp, srid);
1321 LWDEBUGF(2,
"Polygonize returned %d geoms", ngeoms);
1351 #ifdef LWGEOM_PROFILE_BUILDAREA 1352 lwnotice(
"Preparing face structures");
1357 for (i=0; i<ngeoms; ++i)
1358 geoms[i] =
newFace(GEOSGetGeometryN(geos_result, i));
1360 #ifdef LWGEOM_PROFILE_BUILDAREA 1367 #ifdef LWGEOM_PROFILE_BUILDAREA 1368 lwnotice(
"Colletting even ancestor faces");
1375 #ifdef LWGEOM_PROFILE_BUILDAREA 1380 for (i=0; i<ngeoms; ++i)
delFace(geoms[i]);
1385 GEOSGeom_destroy(geos_result);
1387 #ifdef LWGEOM_PROFILE_BUILDAREA 1392 shp = GEOSUnionCascaded(tmp);
1395 GEOSGeom_destroy(tmp);
1399 #ifdef LWGEOM_PROFILE_BUILDAREA 1403 GEOSGeom_destroy(tmp);
1405 GEOSSetSRID(shp, srid);
static void delFace(Face *f)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
static void findFaceHoles(Face **faces, int nfaces)
static GEOSGeometry * collectFacesWithEvenAncestors(Face **faces, int nfaces)
static Face * newFace(const GEOSGeometry *g)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
void * lwalloc(size_t size)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.