PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_remove_repeated_points()

LWGEOM* lwgeom_remove_repeated_points ( LWGEOM in,
double  tolerance 
)

Remove repeated points!

Definition at line 1407 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, LWGEOM::type, and LWPOLY::type.

Referenced by _lwt_AddEdge(), _lwt_FindAdjacentEdges(), _lwt_toposnap(), lwcollection_remove_repeated_points(), and ST_RemoveRepeatedPoints().

1408 {
1409  LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s",
1410  lwtype_name(in->type));
1411 
1412  if(lwgeom_is_empty(in))
1413  {
1414  return lwgeom_clone_deep(in);
1415  }
1416 
1417  switch (in->type)
1418  {
1419  case MULTIPOINTTYPE:
1420  return lwmpoint_remove_repeated_points((LWMPOINT*)in, tolerance);
1421  break;
1422  case LINETYPE:
1423  return lwline_remove_repeated_points((LWLINE*)in, tolerance);
1424 
1425  case MULTILINETYPE:
1426  case COLLECTIONTYPE:
1427  case MULTIPOLYGONTYPE:
1428  case POLYHEDRALSURFACETYPE:
1429  return lwcollection_remove_repeated_points((LWCOLLECTION *)in, tolerance);
1430 
1431  case POLYGONTYPE:
1432  return lwpoly_remove_repeated_points((LWPOLY *)in, tolerance);
1433  break;
1434 
1435  case POINTTYPE:
1436  case TRIANGLETYPE:
1437  case TINTYPE:
1438  /* No point is repeated for a single point, or for Triangle or TIN */
1439  return lwgeom_clone_deep(in);
1440 
1441  case CIRCSTRINGTYPE:
1442  case COMPOUNDTYPE:
1443  case MULTICURVETYPE:
1444  case CURVEPOLYTYPE:
1445  case MULTISURFACETYPE:
1446  /* Dunno how to handle these, will return untouched */
1447  return lwgeom_clone_deep(in);
1448 
1449  default:
1450  lwnotice("%s: unsupported geometry type: %s",
1451  __func__, lwtype_name(in->type));
1452  return lwgeom_clone_deep(in);
1453  break;
1454  }
1455  return 0;
1456 }
#define LINETYPE
Definition: liblwgeom.h:71
#define MULTICURVETYPE
Definition: liblwgeom.h:80
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:61
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep-clone an LWGEOM object.
Definition: lwgeom.c:433
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWGEOM * lwline_remove_repeated_points(LWLINE *in, double tolerance)
Definition: lwline.c:427
#define TINTYPE
Definition: liblwgeom.h:84
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:1297
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
LWGEOM * lwpoly_remove_repeated_points(LWPOLY *in, double tolerance)
Definition: lwpoly.c:289
LWGEOM * lwmpoint_remove_repeated_points(LWMPOINT *in, double tolerance)
Definition: lwmpoint.c:79
#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
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
LWGEOM * lwcollection_remove_repeated_points(LWCOLLECTION *in, double tolerance)
Definition: lwcollection.c:440
Here is the call graph for this function:
Here is the caller graph for this function: