PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ pointArray_toGML2()

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

Definition at line 662 of file lwout_gml.c.

663 {
664  uint32_t i;
665  char *ptr;
668  char z[OUT_DOUBLE_BUFFER_SIZE];
669 
670  ptr = output;
671 
672  if ( ! FLAGS_GET_Z(pa->flags) )
673  {
674  for (i=0; i<pa->npoints; i++)
675  {
676  const POINT2D *pt;
677  pt = getPoint2d_cp(pa, i);
678 
683 
684  if ( i ) ptr += sprintf(ptr, " ");
685  ptr += sprintf(ptr, "%s,%s", x, y);
686  }
687  }
688  else
689  {
690  for (i=0; i<pa->npoints; i++)
691  {
692  const POINT3D *pt = getPoint3d_cp(pa, i);
699 
700  if ( i ) ptr += sprintf(ptr, " ");
701  ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
702  }
703  }
704 
705  return ptr-output;
706 }
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, size_t bufsize)
Definition: lwprint.c:492
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:91
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwinline.h:103
double y
Definition: liblwgeom.h:376
double x
Definition: liblwgeom.h:376
double z
Definition: liblwgeom.h:388
double x
Definition: liblwgeom.h:388
double y
Definition: liblwgeom.h:388
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t npoints
Definition: liblwgeom.h:413

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: