PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_make_geos_friendly()

static LWGEOM* lwgeom_make_geos_friendly ( LWGEOM geom)
static

Definition at line 139 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, ptarray_close2d(), LWGEOM::type, and LWCOLLECTION::type.

Referenced by lwcollection_make_geos_friendly(), and lwgeom_make_valid().

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