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

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

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

2810 {
2811  GSERIALIZED *geom;
2812  GEOSGeometry *g1;
2813  int result;
2814 
2815  geom = PG_GETARG_GSERIALIZED_P(0);
2816 
2817  /* Empty things can't close */
2818  if ( gserialized_is_empty(geom) )
2819  PG_RETURN_BOOL(FALSE);
2820 
2821  initGEOS(lwpgnotice, lwgeom_geos_error);
2822 
2823  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
2824  if ( 0 == g1 ) /* exception thrown at construction */
2825  {
2826  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2827  PG_RETURN_NULL();
2828  }
2829 
2830  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2831  {
2832  GEOSGeom_destroy(g1);
2833  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2834  }
2835 
2836  result = GEOSisRing(g1);
2837  GEOSGeom_destroy(g1);
2838 
2839  if (result == 2)
2840  {
2841  HANDLE_GEOS_ERROR("GEOSisRing");
2842  PG_RETURN_NULL();
2843  }
2844 
2845  PG_FREE_IF_COPY(geom, 0);
2846  PG_RETURN_BOOL(result);
2847 }
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:153
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: