PostGIS 3.0.6dev-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 502 of file lwout_x3d.c.

503{
504 uint32_t i;
508
509 if ( ! FLAGS_GET_Z(pa->flags) )
510 {
511 for (i=0; i<pa->npoints; i++)
512 {
514 if ( !is_closed || i < (pa->npoints - 1) )
515 {
516 POINT2D pt;
517 getPoint2d_p(pa, i, &pt);
518
523
524 if ( i ) stringbuffer_append(sb," ");
525
526 if ( ( opts & LW_X3D_FLIP_XY) )
527 stringbuffer_aprintf(sb, "%s %s", y, x);
528 else
529 stringbuffer_aprintf(sb, "%s %s", x, y);
530 }
531 }
532 }
533 else
534 {
535 for (i=0; i<pa->npoints; i++)
536 {
538 if ( !is_closed || i < (pa->npoints - 1) )
539 {
540 POINT4D pt;
541 getPoint4d_p(pa, i, &pt);
542
549
550 if ( i ) stringbuffer_append(sb," ");
551
552 if ( ( opts & LW_X3D_FLIP_XY) )
553 stringbuffer_aprintf(sb, "%s %s %s", y, x, z);
554 else
555 stringbuffer_aprintf(sb, "%s %s %s", x, y, z);
556 }
557 }
558 }
559
560 return LW_SUCCESS;
561}
static uint8_t precision
Definition cu_in_twkb.c:25
#define LW_SUCCESS
Definition liblwgeom.h:111
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition lwgeom_api.c:349
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition liblwgeom.h:1666
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
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, size_t bufsize)
Definition lwprint.c:492
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(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:400
double z
Definition liblwgeom.h:400
double y
Definition liblwgeom.h:400
lwflags_t flags
Definition liblwgeom.h:417
uint32_t npoints
Definition liblwgeom.h:413

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(), 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: