PostGIS  2.1.10dev-r@@SVN_REVISION@@
static LWGEOM* lwgeom_make_geos_friendly ( LWGEOM geom)
static

Definition at line 140 of file liblwgeom/lwgeom_geos_clean.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, Face_t::geom, LINETYPE, lwcollection_make_geos_friendly(), LWDEBUGF, lwerror(), lwline_make_geos_friendly(), lwpoly_make_geos_friendly(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by lwcollection_make_geos_friendly(), and lwgeom_make_valid().

141 {
142  LWDEBUGF(2, "lwgeom_make_geos_friendly enter (type %d)", geom->type);
143  switch (geom->type)
144  {
145  case POINTTYPE:
146  case MULTIPOINTTYPE:
147  /* a point is always valid */
148  return geom;
149  break;
150 
151  case LINETYPE:
152  /* lines need at least 2 points */
153  return lwline_make_geos_friendly((LWLINE *)geom);
154  break;
155 
156  case POLYGONTYPE:
157  /* polygons need all rings closed and with npoints > 3 */
158  return lwpoly_make_geos_friendly((LWPOLY *)geom);
159  break;
160 
161  case MULTILINETYPE:
162  case MULTIPOLYGONTYPE:
163  case COLLECTIONTYPE:
165  break;
166 
167  case CIRCSTRINGTYPE:
168  case COMPOUNDTYPE:
169  case CURVEPOLYTYPE:
170  case MULTISURFACETYPE:
171  case MULTICURVETYPE:
172  default:
173  lwerror("lwgeom_make_geos_friendly: unsupported input geometry type: %s (%d)", lwtype_name(geom->type), geom->type);
174  break;
175  }
176  return 0;
177 }
#define LINETYPE
Definition: liblwgeom.h:61
#define MULTICURVETYPE
Definition: liblwgeom.h:70
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
LWGEOM * lwcollection_make_geos_friendly(LWCOLLECTION *g)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
LWGEOM * geom
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
LWGEOM * lwpoly_make_geos_friendly(LWPOLY *poly)
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
LWGEOM * lwline_make_geos_friendly(LWLINE *line)
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: