/**
* Remove repeated points!
*/
-extern LWGEOM* lwgeom_remove_repeated_points(LWGEOM *in, double tolerance);
+extern LWGEOM* lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance);
extern char lwtriangle_is_repeated_points(LWTRIANGLE *triangle);
/*
* Repeated points
*/
-POINTARRAY *ptarray_remove_repeated_points_minpoints(POINTARRAY *in, double tolerance, int minpoints);
-POINTARRAY *ptarray_remove_repeated_points(POINTARRAY *in, double tolerance);
-LWGEOM* lwmpoint_remove_repeated_points(LWMPOINT *in, double tolerance);
-LWGEOM* lwline_remove_repeated_points(LWLINE *in, double tolerance);
-LWGEOM* lwcollection_remove_repeated_points(LWCOLLECTION *in, double tolerance);
-LWGEOM* lwpoly_remove_repeated_points(LWPOLY *in, double tolerance);
+POINTARRAY *ptarray_remove_repeated_points_minpoints(const POINTARRAY *in, double tolerance, int minpoints);
+POINTARRAY *ptarray_remove_repeated_points(const POINTARRAY *in, double tolerance);
+LWGEOM* lwmpoint_remove_repeated_points(const LWMPOINT *in, double tolerance);
+LWGEOM* lwline_remove_repeated_points(const LWLINE *in, double tolerance);
+LWGEOM* lwcollection_remove_repeated_points(const LWCOLLECTION *in, double tolerance);
+LWGEOM* lwpoly_remove_repeated_points(const LWPOLY *in, double tolerance);
/*
* Closure test
}
LWGEOM*
-lwcollection_remove_repeated_points(LWCOLLECTION *coll, double tolerance)
+lwcollection_remove_repeated_points(const LWCOLLECTION *coll, double tolerance)
{
uint32_t i;
LWGEOM **newgeoms;
return 0;
}
-extern LWGEOM* lwgeom_remove_repeated_points(LWGEOM *in, double tolerance)
+extern LWGEOM* lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
{
LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s",
lwtype_name(in->type));
case TRIANGLETYPE:
case TINTYPE:
/* No point is repeated for a single point, or for Triangle or TIN */
- return in;
+ return lwgeom_clone_deep(in);
case CIRCSTRINGTYPE:
case COMPOUNDTYPE:
case CURVEPOLYTYPE:
case MULTISURFACETYPE:
/* Dunno how to handle these, will return untouched */
- return in;
+ return lwgeom_clone_deep(in);
default:
lwnotice("%s: unsupported geometry type: %s",
__func__, lwtype_name(in->type));
- return in;
+ return lwgeom_clone_deep(in);
break;
}
return 0;
}
LWGEOM*
-lwline_remove_repeated_points(LWLINE *lwline, double tolerance)
+lwline_remove_repeated_points(const LWLINE *lwline, double tolerance)
{
POINTARRAY* npts = ptarray_remove_repeated_points_minpoints(lwline->points, tolerance, 2);
}
LWGEOM*
-lwmpoint_remove_repeated_points(LWMPOINT *mpoint, double tolerance)
+lwmpoint_remove_repeated_points(const LWMPOINT *mpoint, double tolerance)
{
uint32_t nnewgeoms;
uint32_t i, j;
}
LWGEOM*
-lwpoly_remove_repeated_points(LWPOLY *poly, double tolerance)
+lwpoly_remove_repeated_points(const LWPOLY *poly, double tolerance)
{
uint32_t i;
POINTARRAY **newrings;
*
*/
POINTARRAY *
-ptarray_remove_repeated_points_minpoints(POINTARRAY *in, double tolerance, int minpoints)
+ptarray_remove_repeated_points_minpoints(const POINTARRAY *in, double tolerance, int minpoints)
{
POINTARRAY* out;
size_t ptsize;
}
POINTARRAY *
-ptarray_remove_repeated_points(POINTARRAY *in, double tolerance)
+ptarray_remove_repeated_points(const POINTARRAY *in, double tolerance)
{
return ptarray_remove_repeated_points_minpoints(in, tolerance, 2);
}
g_out = geometry_serialize(lwgeom_out);
if ( lwgeom_out != lwgeom_in )
+ {
lwgeom_free(lwgeom_out);
+ }
+
lwgeom_free(lwgeom_in);
PG_FREE_IF_COPY(g_in, 0);