77 {
78
79 double mindx = 0, mindy = 0;
80 unsigned int i, j, iw, jw;
81
84
86
87
88 if (PG_GETARG_POINTER(0) == NULL) {
89 PG_RETURN_NULL();
90 }
91
92 serialized_in = (
GSERIALIZED *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
93
94 if (PG_NARGS() == 3) {
95
96 if (PG_ARGISNULL(1) || PG_ARGISNULL(2)) {
97
98 PG_RETURN_POINTER(serialized_in);
99 }
100
101 mindx = PG_GETARG_FLOAT8(1);
102 mindy = PG_GETARG_FLOAT8(2);
103 if (mindx <= 0 && mindy <= 0) {
104
105 PG_RETURN_POINTER(serialized_in);
106 }
107
108
113
114
115 PG_RETURN_POINTER(serialized_in);
116 }
117
118 }
119
120 else {
121
122 PG_RETURN_POINTER(serialized_in);
123 }
124
125
127
129
132 }
133
135
137 iw = 0;
138 for (i=0; i<mline->
ngeoms; i++) {
141
143
144 mline->
geoms[iw++] = line;
145 }
146 else {
147
149 }
150 }
152 }
153
155
157 iw = 0;
158 for (i=0; i<polygon->
nrings; i++) {
160
162
164 }
165 else {
166 if (!i) {
167
168 unsigned int k;
169 for (k=0; k<polygon->
nrings; k++) {
171 }
172 break;
173 }
174 else {
175
177 }
178 }
179 }
181 }
182
184
186 jw = 0;
187 for (j=0; j<mpolygon->
ngeoms; j++) {
188
190 iw = 0;
191 for (i=0; i<polygon->
nrings; i++) {
193
195
197 }
198 else {
199 if (!i) {
200
201 unsigned int k;
202 for (k=0; k<polygon->
nrings; k++) {
204 }
205 break;
206 }
207 else {
208
210 }
211 }
212 }
214
215 if (iw) {
216 mpolygon->
geoms[jw++] = polygon;
217 }
218 else {
219
221 }
222 }
224 }
225
226
229
232
233 PG_FREE_IF_COPY(serialized_in, 0);
234 PG_RETURN_POINTER(serialized_out);
235}
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
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,...
void lwgeom_free(LWGEOM *geom)
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
static void ptarray_remove_dim_helper(POINTARRAY *points, double mindx, double mindy)