PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ 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;
507  char z[OUT_DOUBLE_BUFFER_SIZE];
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:80
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:348
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1560
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:123
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf, size_t bufsize)
Definition: lwprint.c:490
opts
Definition: ovdump.py:44
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.
Definition: stringbuffer.c:253
void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.c:134
double y
Definition: liblwgeom.h:331
double x
Definition: liblwgeom.h:331
double x
Definition: liblwgeom.h:355
double z
Definition: liblwgeom.h:355
double y
Definition: liblwgeom.h:355
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t flags
Definition: liblwgeom.h:372
unsigned int uint32_t
Definition: uthash.h:78

References POINTARRAY::flags, FLAGS_GET_Z, getPoint2d_p(), getPoint4d_p(), LW_SUCCESS, LW_X3D_FLIP_XY, lwprint_double(), POINTARRAY::npoints, ovdump::opts, OUT_DOUBLE_BUFFER_SIZE, precision, stringbuffer_append(), stringbuffer_aprintf(), POINT2D::x, POINT4D::x, pixval::x, POINT2D::y, POINT4D::y, pixval::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: