PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_make_geos_friendly()

static LWGEOM* lwgeom_make_geos_friendly ( LWGEOM geom)
static

Definition at line 129 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().

130 {
131  LWDEBUGF(2, "lwgeom_make_geos_friendly enter (type %d)", geom->type);
132  switch (geom->type)
133  {
134  case POINTTYPE:
135  case MULTIPOINTTYPE:
136  /* a point is always valid */
137  return geom;
138  break;
139 
140  case LINETYPE:
141  /* lines need at least 2 points */
142  return lwline_make_geos_friendly((LWLINE *)geom);
143  break;
144 
145  case POLYGONTYPE:
146  /* polygons need all rings closed and with npoints > 3 */
147  return lwpoly_make_geos_friendly((LWPOLY *)geom);
148  break;
149 
150  case MULTILINETYPE:
151  case MULTIPOLYGONTYPE:
152  case COLLECTIONTYPE:
154  break;
155 
156  case CIRCSTRINGTYPE:
157  case COMPOUNDTYPE:
158  case CURVEPOLYTYPE:
159  case MULTISURFACETYPE:
160  case MULTICURVETYPE:
161  default:
162  lwerror("lwgeom_make_geos_friendly: unsupported input geometry type: %s (%d)", lwtype_name(geom->type), geom->type);
163  break;
164  }
165  return 0;
166 }
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
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:218
LWGEOM * geom
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
LWGEOM * lwpoly_make_geos_friendly(LWPOLY *poly)
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
LWGEOM * lwline_make_geos_friendly(LWLINE *line)
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: