PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum issimple ( PG_FUNCTION_ARGS  )

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

References gserialized_is_empty(), lwerror(), lwgeom_geos_errmsg, lwgeom_geos_error(), lwnotice(), POSTGIS2GEOS(), result, and TRUE.

3090 {
3091  GSERIALIZED *geom;
3092  GEOSGeometry *g1;
3093  int result;
3094 
3095  POSTGIS_DEBUG(2, "issimple called");
3096 
3097  geom = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
3098 
3099  if ( gserialized_is_empty(geom) )
3100  PG_RETURN_BOOL(TRUE);
3101 
3102  initGEOS(lwnotice, lwgeom_geos_error);
3103 
3104  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
3105  if ( 0 == g1 ) /* exception thrown at construction */
3106  {
3107  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
3108  PG_RETURN_NULL();
3109  }
3110  result = GEOSisSimple(g1);
3111  GEOSGeom_destroy(g1);
3112 
3113  if (result == 2)
3114  {
3115  lwerror("GEOSisSimple: %s", lwgeom_geos_errmsg);
3116  PG_RETURN_NULL(); /*never get here */
3117  }
3118 
3119  PG_FREE_IF_COPY(geom, 0);
3120 
3121  PG_RETURN_BOOL(result);
3122 }
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
char ** result
Definition: liblwgeom.h:218
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:140
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:54
LWGEOM * geom
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
#define TRUE
Definition: dbfopen.c:170

Here is the call graph for this function: