276{
277 uint32_t dims = 2;
278 uint32_t i;
279 int append_points = 0;
282 GEOSCoordSeq sq;
283
285
286 if (fix_ring)
287 {
289 {
290 lwerror(
"ptarray_to_GEOSCoordSeq called with fix_ring and 0 vertices in ring, cannot fix");
291 return NULL;
292 }
293 else
294 {
297 }
298 }
299
300#if POSTGIS_GEOS_VERSION >= 31000
301 if (append_points == 0) {
303 if (!sq)
304 {
306 }
307 return sq;
308 }
309#endif
310 if (!(sq = GEOSCoordSeq_create(pa->
npoints + append_points, dims)))
311 {
313 }
314
315 for (i = 0; i < pa->
npoints; i++)
316 {
317 if (dims == 3)
318 {
321 LWDEBUGF(4,
"Point: %g,%g,%g", p3d->
x, p3d->
y, p3d->
z);
322 }
323 else
324 {
327 }
328
329 if (dims == 3)
330 GEOSCoordSeq_setXYZ(sq, i, p2d->
x, p2d->
y, p3d->
z);
331 else
332 GEOSCoordSeq_setXY(sq, i, p2d->
x, p2d->
y);
333
334 }
335
336 if (append_points)
337 {
338 if (dims == 3)
339 {
342 }
343 else
346 {
347
348 GEOSCoordSeq_setXY(sq, i, p2d->
x, p2d->
y);
349
350 if (dims == 3) GEOSCoordSeq_setZ(sq, i, p3d->
z);
351 }
352 }
353
354 return sq;
355
356}
#define FLAGS_GET_Z(flags)
#define FLAGS_GET_M(flags)
int ptarray_is_closed_2d(const POINTARRAY *pa)
#define LWDEBUGF(level, msg,...)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
uint8_t * serialized_pointlist