Definition at line 357 of file liblwgeom/lwgeom_geos.c.
References COLLECTIONTYPE, POINTARRAY::flags, FLAGS_NDIMS, free(), LWCOLLECTION::geoms, getPoint_internal(), LINETYPE, LWDEBUGF, lwerror(), LWGEOM2GEOS(), lwgeom_free(), lwgeom_has_arc(), lwgeom_is_empty(), lwgeom_stroke(), lwtype_name(), malloc(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTARRAY::npoints, LWPOLY::nrings, LWPOINT::point, LWLINE::points, POINTTYPE, POLYGONTYPE, ptarray_addPoint(), ptarray_to_GEOSCoordSeq(), ptarray_to_GEOSLinearRing(), LWPOLY::rings, LWGEOM::srid, and LWGEOM::type.
Referenced by _lwt_AddFaceSplit(), _lwt_CheckEdgeCrossing(), _lwt_EdgeMotionArea(), _lwt_GetEqualEdge(), boundary(), isvalid(), LWGEOM2GEOS(), lwgeom_buildarea(), lwgeom_centroid(), lwgeom_clip_by_rect(), lwgeom_delaunay_triangulation(), lwgeom_difference(), lwgeom_extract_unique_endpoints(), lwgeom_geos_noop(), lwgeom_intersection(), lwgeom_is_simple(), lwgeom_linemerge(), lwgeom_make_valid(), lwgeom_node(), lwgeom_normalize(), lwgeom_offsetcurve(), lwgeom_sharedpaths(), lwgeom_snap(), lwgeom_symdifference(), lwgeom_unaryunion(), lwgeom_union(), LWGEOMARRAY2GEOS(), lwline_split_by_line(), lwpoly_split_by_line(), lwpoly_to_points(), lwt_AddPoint(), lwt_AddPolygon(), lwt_ChangeEdgeGeom(), POSTGIS2GEOS(), PrepGeomCacheBuilder(), rt_raster_compute_skewed_raster(), rt_raster_gdal_polygonize(), rt_raster_gdal_rasterize(), rt_raster_geos_spatial_relationship(), rt_raster_intersects(), and rt_raster_surface().
361 GEOSGeom *geoms = NULL;
367 #if LWDEBUG_LEVEL >= 4 376 GEOSGeometry *g =
LWGEOM2GEOS(lwgeom_stroked, autofix);
381 switch (lwgeom->
type)
393 g = GEOSGeom_createEmptyPolygon();
398 g = GEOSGeom_createPoint(sq);
417 g = GEOSGeom_createLineString(sq);
426 lwpoly = (
LWPOLY *)lwgeom;
429 g = GEOSGeom_createEmptyPolygon();
434 if ( ! shell )
return NULL;
436 ngeoms = lwpoly->
nrings-1;
438 geoms =
malloc(
sizeof(GEOSGeom)*ngeoms);
440 for (i=1; i<lwpoly->
nrings; ++i)
446 while (i) GEOSGeom_destroy(geoms[--i]);
448 GEOSGeom_destroy(shell);
453 g = GEOSGeom_createPolygon(shell, geoms, ngeoms);
454 if (geoms)
free(geoms);
456 if ( ! g )
return NULL;
463 geostype = GEOS_MULTIPOINT;
465 geostype = GEOS_MULTILINESTRING;
467 geostype = GEOS_MULTIPOLYGON;
469 geostype = GEOS_GEOMETRYCOLLECTION;
475 geoms =
malloc(
sizeof(GEOSGeom)*ngeoms);
478 for (i=0; i<ngeoms; ++i)
488 while (j) GEOSGeom_destroy(geoms[--j]);
494 g = GEOSGeom_createCollection(geostype, geoms, j);
495 if ( geoms )
free(geoms);
496 if ( ! g )
return NULL;
504 GEOSSetSRID(g, lwgeom->
srid);
506 #if LWDEBUG_LEVEL >= 4 507 wkt = GEOSGeomToWKT(g);
508 LWDEBUGF(4,
"LWGEOM2GEOS: GEOSGeom: %s", wkt);
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
void lwgeom_free(LWGEOM *geom)
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
int lwgeom_has_arc(const LWGEOM *geom)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
GEOSCoordSeq ptarray_to_GEOSCoordSeq(const POINTARRAY *, int fix_ring)
static GEOSGeometry * ptarray_to_GEOSLinearRing(const POINTARRAY *pa, int autofix)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
#define LWDEBUGF(level, msg,...)
#define FLAGS_NDIMS(flags)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.