27 #include "utils/array.h"
28 #include "utils/builtins.h"
29 #include "utils/lsyscache.h"
30 #include "utils/numeric.h"
31 #include "access/htup_details.h"
43 double xmin = 0, ymin = 0, xmax = 0, ymax = 0;
48 for (
r=0;
r < npoints;
r++) {
56 if (!
r || xmin >
x) xmin =
x;
57 if (!
r || xmax <
x) xmax =
x;
60 if (!
r || ymin >
y) ymin =
y;
61 if (!
r || ymax <
y) ymax =
y;
65 if ((mindx > 0 && xmax - xmin < mindx) ||
66 (mindy > 0 && ymax - ymin < mindy)) {
79 double mindx = 0, mindy = 0;
80 unsigned int i, j, iw, jw;
88 if (PG_GETARG_POINTER(0) == NULL) {
92 serialized_in = (
GSERIALIZED *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
94 if (PG_NARGS() == 3) {
96 if (PG_ARGISNULL(1) || PG_ARGISNULL(2)) {
98 PG_RETURN_POINTER(serialized_in);
101 mindx = PG_GETARG_FLOAT8(1);
102 mindy = PG_GETARG_FLOAT8(2);
103 if (mindx <= 0 && mindy <= 0) {
105 PG_RETURN_POINTER(serialized_in);
115 PG_RETURN_POINTER(serialized_in);
122 PG_RETURN_POINTER(serialized_in);
138 for (i=0; i<mline->
ngeoms; i++) {
144 mline->
geoms[iw++] = line;
158 for (i=0; i<polygon->
nrings; i++) {
169 for (k=0; k<polygon->
nrings; k++) {
187 for (j=0; j<mpolygon->
ngeoms; j++) {
191 for (i=0; i<polygon->
nrings; i++) {
202 for (k=0; k<polygon->
nrings; k++) {
216 mpolygon->
geoms[jw++] = polygon;
233 PG_FREE_IF_COPY(serialized_in, 0);
234 PG_RETURN_POINTER(serialized_out);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
This library is the generic geometry handling section of PostGIS.
static void ptarray_remove_dim_helper(POINTARRAY *points, double mindx, double mindy)
PG_FUNCTION_INFO_V1(ST_RemoveSmallParts)
Datum ST_RemoveSmallParts(PG_FUNCTION_ARGS)