PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_remove_repeated_points ( LWGEOM in)

Remove repeated points!

Definition at line 1339 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwcollection_remove_repeated_points(), LWDEBUGF, lwgeom_clone_deep(), lwgeom_is_empty(), lwline_remove_repeated_points(), lwmpoint_remove_repeated_points(), lwnotice(), lwpoly_remove_repeated_points(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwcollection_remove_repeated_points(), and ST_RemoveRepeatedPoints().

1340 {
1341  LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s",
1342  lwtype_name(in->type));
1343 
1344  if(lwgeom_is_empty(in))
1345  {
1346  return lwgeom_clone_deep(in);
1347  }
1348 
1349  switch (in->type)
1350  {
1351  case MULTIPOINTTYPE:
1353  break;
1354  case LINETYPE:
1356 
1357  case MULTILINETYPE:
1358  case COLLECTIONTYPE:
1359  case MULTIPOLYGONTYPE:
1360  case POLYHEDRALSURFACETYPE:
1362 
1363  case POLYGONTYPE:
1364  return lwpoly_remove_repeated_points((LWPOLY *)in);
1365  break;
1366 
1367  case POINTTYPE:
1368  case TRIANGLETYPE:
1369  case TINTYPE:
1370  /* No point is repeated for a single point, or for Triangle or TIN */
1371  return lwgeom_clone_deep(in);
1372 
1373  case CIRCSTRINGTYPE:
1374  case COMPOUNDTYPE:
1375  case MULTICURVETYPE:
1376  case CURVEPOLYTYPE:
1377  case MULTISURFACETYPE:
1378  /* Dunno how to handle these, will return untouched */
1379  return lwgeom_clone_deep(in);
1380 
1381  default:
1382  lwnotice("lwgeom_remove_repeated_points: unsupported geometry type: %s",
1383  lwtype_name(in->type));
1384  return lwgeom_clone_deep(in);
1385  break;
1386  }
1387  return 0;
1388 }
#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
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep-clone an LWGEOM object.
Definition: lwgeom.c:389
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
#define TINTYPE
Definition: liblwgeom.h:74
LWGEOM * lwline_remove_repeated_points(LWLINE *in)
Definition: lwline.c:423
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1229
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
LWGEOM * lwmpoint_remove_repeated_points(LWMPOINT *in)
Definition: lwmpoint.c:79
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
LWGEOM * lwpoly_remove_repeated_points(LWPOLY *in)
Definition: lwpoly.c:284
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define COLLECTIONTYPE
Definition: liblwgeom.h:66
LWGEOM * lwcollection_remove_repeated_points(LWCOLLECTION *in)
Definition: lwcollection.c:430

Here is the call graph for this function:

Here is the caller graph for this function: