PostGIS  2.3.7dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_remove_repeated_points ( const LWGEOM in,
double  tolerance 
)

Remove repeated points!

Definition at line 1420 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 _lwt_AddEdge(), _lwt_FindAdjacentEdges(), _lwt_toposnap(), lwcollection_remove_repeated_points(), and ST_RemoveRepeatedPoints().

1421 {
1422  LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s",
1423  lwtype_name(in->type));
1424 
1425  if(lwgeom_is_empty(in))
1426  {
1427  return lwgeom_clone_deep(in);
1428  }
1429 
1430  switch (in->type)
1431  {
1432  case MULTIPOINTTYPE:
1433  return lwmpoint_remove_repeated_points((LWMPOINT*)in, tolerance);
1434  break;
1435  case LINETYPE:
1436  return lwline_remove_repeated_points((LWLINE*)in, tolerance);
1437 
1438  case MULTILINETYPE:
1439  case COLLECTIONTYPE:
1440  case MULTIPOLYGONTYPE:
1441  case POLYHEDRALSURFACETYPE:
1442  return lwcollection_remove_repeated_points((LWCOLLECTION *)in, tolerance);
1443 
1444  case POLYGONTYPE:
1445  return lwpoly_remove_repeated_points((LWPOLY *)in, tolerance);
1446  break;
1447 
1448  case POINTTYPE:
1449  case TRIANGLETYPE:
1450  case TINTYPE:
1451  /* No point is repeated for a single point, or for Triangle or TIN */
1452  return lwgeom_clone_deep(in);
1453 
1454  case CIRCSTRINGTYPE:
1455  case COMPOUNDTYPE:
1456  case MULTICURVETYPE:
1457  case CURVEPOLYTYPE:
1458  case MULTISURFACETYPE:
1459  /* Dunno how to handle these, will return untouched */
1460  return lwgeom_clone_deep(in);
1461 
1462  default:
1463  lwnotice("%s: unsupported geometry type: %s",
1464  __func__, lwtype_name(in->type));
1465  return lwgeom_clone_deep(in);
1466  break;
1467  }
1468  return 0;
1469 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:89
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:97
LWGEOM * lwmpoint_remove_repeated_points(const LWMPOINT *in, double tolerance)
Definition: lwmpoint.c:92
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
LWGEOM * lwcollection_remove_repeated_points(const LWCOLLECTION *in, double tolerance)
Definition: lwcollection.c:453
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep-clone an LWGEOM object.
Definition: lwgeom.c:446
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define TINTYPE
Definition: liblwgeom.h:98
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:1310
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
LWGEOM * lwline_remove_repeated_points(const LWLINE *in, double tolerance)
Definition: lwline.c:456
LWGEOM * lwpoly_remove_repeated_points(const LWPOLY *in, double tolerance)
Definition: lwpoly.c:360
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define COLLECTIONTYPE
Definition: liblwgeom.h:90

Here is the call graph for this function:

Here is the caller graph for this function: