PostGIS  2.1.10dev-r@@SVN_REVISION@@
static LWGEOM * lwgeom_clean ( LWGEOM lwgeom_in)
static

Definition at line 104 of file postgis/lwgeom_geos_clean.c.

References COLLECTIONTYPE, lwgeom_dimensionality(), lwgeom_make_valid(), lwnotice(), lwtype_name(), and LWGEOM::type.

Referenced by ST_CleanGeometry().

105 {
106  LWGEOM* lwgeom_out;
107 
108  lwgeom_out = lwgeom_make_valid(lwgeom_in);
109  if ( ! lwgeom_out )
110  {
111  return NULL;
112  }
113 
114  /* Check dimensionality is the same as input */
115  if ( lwgeom_dimensionality(lwgeom_in) != lwgeom_dimensionality(lwgeom_out) )
116  {
117  lwnotice("lwgeom_clean: dimensional collapse (%d to %d)",
118  lwgeom_dimensionality(lwgeom_in), lwgeom_dimensionality(lwgeom_out));
119 
120  return NULL;
121  }
122 
123  /* Check that the output is not a collection if the input wasn't */
124  if ( lwgeom_out->type == COLLECTIONTYPE &&
125  lwgeom_in->type != COLLECTIONTYPE )
126  {
127  lwnotice("lwgeom_clean: mixed-type output (%s) "
128  "from single-type input (%s)",
129  lwtype_name(lwgeom_out->type),
130  lwtype_name(lwgeom_in->type));
131  return NULL;
132  }
133 
134  /* Force right-hand-rule (will only affect polygons) */
135  /* gout := ST_ForceRHR(gout); */
136 
137  /* Remove repeated duplicated points ? */
138  /* gout = ST_RemoveRepeatedPoints(gout); */
139 
140  return lwgeom_out;
141 }
int lwgeom_dimensionality(LWGEOM *geom)
Return the dimensionality (relating to point/line/poly) of an lwgeom.
Definition: lwgeom.c:1294
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:54
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
LWGEOM * lwgeom_make_valid(LWGEOM *geom)
Attempts to make an invalid geometries valid w/out losing points.
uint8_t type
Definition: liblwgeom.h:352
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: