PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum isring ( PG_FUNCTION_ARGS  )

Definition at line 3120 of file postgis/lwgeom_geos.c.

References FALSE, dumpnode::geom, gserialized_is_empty(), HANDLE_GEOS_ERROR, lwgeom_geos_error(), and POSTGIS2GEOS().

3121 {
3122  GSERIALIZED *geom;
3123  GEOSGeometry *g1;
3124  int result;
3125 
3126  geom = PG_GETARG_GSERIALIZED_P(0);
3127 
3128  /* Empty things can't close */
3129  if ( gserialized_is_empty(geom) )
3130  PG_RETURN_BOOL(FALSE);
3131 
3132  initGEOS(lwpgnotice, lwgeom_geos_error);
3133 
3134  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
3135  if ( 0 == g1 ) /* exception thrown at construction */
3136  {
3137  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
3138  PG_RETURN_NULL();
3139  }
3140 
3141  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
3142  {
3143  GEOSGeom_destroy(g1);
3144  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
3145  }
3146 
3147  result = GEOSisRing(g1);
3148  GEOSGeom_destroy(g1);
3149 
3150  if (result == 2)
3151  {
3152  HANDLE_GEOS_ERROR("GEOSisRing");
3153  PG_RETURN_NULL();
3154  }
3155 
3156  PG_FREE_IF_COPY(geom, 0);
3157  PG_RETURN_BOOL(result);
3158 }
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:139
LWGEOM * geom
void lwgeom_geos_error(const char *fmt,...)
#define FALSE
Definition: dbfopen.c:168
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

Here is the call graph for this function: