PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ptarray_to_x3d3_sb()

static int ptarray_to_x3d3_sb ( POINTARRAY pa,
int  precision,
int  opts,
int  is_closed,
stringbuffer_t sb 
)
static

In X3D3, coordinates are separated by a space separator.

Only output the point if it is not the last point of a closed object or it is a non-closed type

Only output the point if it is not the last point of a closed object or it is a non-closed type

Definition at line 511 of file lwout_x3d.c.

512{
513 uint32_t i;
517
518 if ( ! FLAGS_GET_Z(pa->flags) )
519 {
520 for (i=0; i<pa->npoints; i++)
521 {
523 if ( !is_closed || i < (pa->npoints - 1) )
524 {
525 POINT2D pt;
526 getPoint2d_p(pa, i, &pt);
527
528 lwprint_double(pt.x, precision, x);
529 lwprint_double(pt.y, precision, y);
530
531 if ( i ) stringbuffer_append_len(sb," ",1);
532
533 if ( ( opts & LW_X3D_FLIP_XY) )
534 stringbuffer_aprintf(sb, "%s %s", y, x);
535 else
536 stringbuffer_aprintf(sb, "%s %s", x, y);
537 }
538 }
539 }
540 else
541 {
542 for (i=0; i<pa->npoints; i++)
543 {
545 if ( !is_closed || i < (pa->npoints - 1) )
546 {
547 POINT4D pt;
548 getPoint4d_p(pa, i, &pt);
549
550 lwprint_double(pt.x, precision, x);
551 lwprint_double(pt.y, precision, y);
552 lwprint_double(pt.z, precision, z);
553
554 if ( i ) stringbuffer_append_len(sb," ",1);
555
556 if ( ( opts & LW_X3D_FLIP_XY) )
557 stringbuffer_aprintf(sb, "%s %s %s", y, x, z);
558 else
559 stringbuffer_aprintf(sb, "%s %s %s", x, y, z);
560 }
561 }
562 }
563
564 return LW_SUCCESS;
565}
static uint8_t precision
Definition cu_in_twkb.c:25
#define LW_SUCCESS
Definition liblwgeom.h:97
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition lwgeom_api.c:342
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition liblwgeom.h:1730
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition lwgeom_api.c:125
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf)
Definition lwprint.c:463
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
static void stringbuffer_append_len(stringbuffer_t *s, const char *a, size_t alen)
Append the specified string to the stringbuffer_t using known length.
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:414
double z
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414
lwflags_t flags
Definition liblwgeom.h:431
uint32_t npoints
Definition liblwgeom.h:427

References POINTARRAY::flags, FLAGS_GET_Z, getPoint2d_p(), getPoint4d_p(), LW_SUCCESS, LW_X3D_FLIP_XY, lwprint_double(), POINTARRAY::npoints, OUT_DOUBLE_BUFFER_SIZE, precision, stringbuffer_append_len(), stringbuffer_aprintf(), POINT2D::x, POINT4D::x, POINT2D::y, POINT4D::y, and POINT4D::z.

Referenced by asx3d3_line_coords_sb(), asx3d3_line_sb(), asx3d3_point_sb(), asx3d3_poly_sb(), and asx3d3_triangle_sb().

Here is the call graph for this function:
Here is the caller graph for this function: