PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ lwgeom_make_geos_friendly()

static LWGEOM* lwgeom_make_geos_friendly ( LWGEOM geom)
static

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

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