PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ pointArray_toGML2()

static size_t pointArray_toGML2 ( POINTARRAY pa,
char *  buf,
int  precision 
)
static

Definition at line 678 of file lwout_gml.c.

679 {
680  uint32_t i;
681  char *ptr;
684  char z[OUT_DOUBLE_BUFFER_SIZE];
685 
686  ptr = output;
687 
688  if ( ! FLAGS_GET_Z(pa->flags) )
689  {
690  for (i=0; i<pa->npoints; i++)
691  {
692  const POINT2D *pt;
693  pt = getPoint2d_cp(pa, i);
694 
695  lwprint_double(pt->x, precision, x);
696  lwprint_double(pt->y, precision, y);
697 
698  if ( i ) ptr += sprintf(ptr, " ");
699  ptr += sprintf(ptr, "%s,%s", x, y);
700  }
701  }
702  else
703  {
704  for (i=0; i<pa->npoints; i++)
705  {
706  const POINT3D *pt = getPoint3d_cp(pa, i);
707  lwprint_double(pt->x, precision, x);
708  lwprint_double(pt->y, precision, y);
709  lwprint_double(pt->z, precision, z);
710 
711  if ( i ) ptr += sprintf(ptr, " ");
712  ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
713  }
714  }
715 
716  return ptr-output;
717 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf)
Definition: lwprint.c:463
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwinline.h:101
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwinline.h:113
double y
Definition: liblwgeom.h:404
double x
Definition: liblwgeom.h:404
double z
Definition: liblwgeom.h:416
double x
Definition: liblwgeom.h:416
double y
Definition: liblwgeom.h:416
lwflags_t flags
Definition: liblwgeom.h:445
uint32_t npoints
Definition: liblwgeom.h:441

References POINTARRAY::flags, FLAGS_GET_Z, getPoint2d_cp(), getPoint3d_cp(), lwprint_double(), POINTARRAY::npoints, OUT_DOUBLE_BUFFER_SIZE, precision, POINT2D::x, POINT3D::x, pixval::x, POINT2D::y, POINT3D::y, pixval::y, and POINT3D::z.

Referenced by asgml2_line_buf(), asgml2_point_buf(), asgml2_poly_buf(), and gbox_to_gml2().

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