Definition at line 410 of file liblwgeom/lwgeom_geos.c.
414 GEOSGeom* geoms = NULL;
415 uint32_t ngeoms, i, j;
417 #if LWDEBUG_LEVEL >= 4
433 GEOSGeometry* g =
LWGEOM2GEOS(lwgeom_stroked, autofix);
443 switch (lwgeom->
type)
449 g = GEOSGeom_createEmptyPoint();
452 #if POSTGIS_GEOS_VERSION < 30800
454 g = GEOSGeom_createPoint(sq);
459 g = GEOSGeom_createPoint(sq);
464 g = GEOSGeom_createPointFromXY(p->
x, p->
y);
483 g = GEOSGeom_createLineString(sq);
490 g = GEOSGeom_createEmptyPolygon();
494 if (!shell)
return NULL;
495 ngeoms = lwpoly->
nrings - 1;
496 if (ngeoms > 0) geoms =
lwalloc(
sizeof(GEOSGeom) * ngeoms);
498 for (i = 1; i < lwpoly->
nrings; i++)
504 for (k = 0; k < i - 1; k++)
505 GEOSGeom_destroy(geoms[k]);
507 GEOSGeom_destroy(shell);
511 g = GEOSGeom_createPolygon(shell, geoms, ngeoms);
519 g = GEOSGeom_createEmptyPolygon();
526 g = GEOSGeom_createPolygon(shell, NULL, 0);
537 geostype = GEOS_MULTIPOINT;
539 geostype = GEOS_MULTILINESTRING;
541 geostype = GEOS_MULTIPOLYGON;
543 geostype = GEOS_GEOMETRYCOLLECTION;
548 if (ngeoms > 0) geoms =
lwalloc(
sizeof(GEOSGeom) * ngeoms);
551 for (i = 0; i < ngeoms; ++i)
561 for (k = 0; k < j; k++)
562 GEOSGeom_destroy(geoms[k]);
568 g = GEOSGeom_createCollection(geostype, geoms, j);
569 if (ngeoms > 0)
lwfree(geoms);
578 GEOSSetSRID(g, lwgeom->
srid);
580 #if LWDEBUG_LEVEL >= 4
581 wkt = GEOSGeomToWKT(g);
582 LWDEBUGF(4,
"LWGEOM2GEOS: GEOSGeom: %s", wkt);
static GEOSGeometry * ptarray_to_GEOSLinearRing(const POINTARRAY *pa, uint8_t autofix)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
GEOSCoordSeq ptarray_to_GEOSCoordSeq(const POINTARRAY *, uint8_t fix_ring)
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.
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Convert type with arcs into equivalent linearized type.
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
int lwgeom_type_arc(const LWGEOM *geom)
Geometry type is one of the potentially "arc containing" types (circstring, multicurve,...
#define FLAGS_NDIMS(flags)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
void * lwalloc(size_t size)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
References COLLECTIONTYPE, POINTARRAY::flags, FLAGS_NDIMS, free(), LWCOLLECTION::geoms, getPoint2d_cp(), getPoint_internal(), LINETYPE, LW_FALSE, lwalloc(), LWDEBUGF, lwerror(), lwfree(), lwgeom_free(), lwgeom_has_z(), lwgeom_is_empty(), lwgeom_stroke(), lwgeom_type_arc(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTARRAY::npoints, LWPOLY::nrings, LWPOINT::point, LWLINE::points, LWTRIANGLE::points, POINTTYPE, POLYGONTYPE, ptarray_addPoint(), ptarray_to_GEOSCoordSeq(), ptarray_to_GEOSLinearRing(), LWPOLY::rings, LWGEOM::srid, TINTYPE, TRIANGLETYPE, LWGEOM::type, POINT2D::x, and POINT2D::y.
Referenced by _lwt_CheckEdgeCrossing(), _lwt_FindFaceContainingRing(), _lwt_GetEqualEdge(), isvalid(), lwgeom_buildarea(), lwgeom_centroid(), lwgeom_clip_by_rect(), lwgeom_delaunay_triangulation(), lwgeom_difference_prec(), lwgeom_extract_unique_endpoints(), lwgeom_geos_noop(), lwgeom_intersection_prec(), lwgeom_is_simple(), lwgeom_linemerge_directed(), lwgeom_make_valid_params(), lwgeom_node(), lwgeom_normalize(), lwgeom_pointonsurface(), lwgeom_reduceprecision(), lwgeom_sharedpaths(), lwgeom_snap(), lwgeom_symdifference_prec(), lwgeom_unaryunion_prec(), lwgeom_union_prec(), LWGEOMARRAY2GEOS(), lwline_offsetcurve(), lwline_split_by_line(), lwpoly_split_by_line(), lwpoly_to_points(), lwt_AddPolygon(), POSTGIS2GEOS(), PrepGeomCacheBuilder(), rt_raster_compute_skewed_raster(), rt_raster_geos_spatial_relationship(), rt_raster_intersects(), rt_raster_surface(), and topologypreservesimplify().