PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ pointArray_toGML3()

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

Definition at line 1897 of file lwout_gml.c.

1898 {
1899  uint32_t i;
1900  char *ptr;
1901  char x[OUT_DOUBLE_BUFFER_SIZE];
1902  char y[OUT_DOUBLE_BUFFER_SIZE];
1903  char z[OUT_DOUBLE_BUFFER_SIZE];
1904 
1905  ptr = output;
1906 
1907  if ( ! FLAGS_GET_Z(pa->flags) )
1908  {
1909  for (i=0; i<pa->npoints; i++)
1910  {
1911  const POINT2D *pt;
1912  pt = getPoint2d_cp(pa, i);
1913  lwprint_double(pt->x, precision, x);
1914  lwprint_double(pt->y, precision, y);
1915 
1916  if ( i ) ptr += sprintf(ptr, " ");
1917  if (IS_DEGREE(opts))
1918  ptr += sprintf(ptr, "%s %s", y, x);
1919  else
1920  ptr += sprintf(ptr, "%s %s", x, y);
1921  }
1922  }
1923  else
1924  {
1925  for (i=0; i<pa->npoints; i++)
1926  {
1927  const POINT3D *pt = getPoint3d_cp(pa, i);
1928 
1929  lwprint_double(pt->x, precision, x);
1930  lwprint_double(pt->y, precision, y);
1931  lwprint_double(pt->z, precision, z);
1932 
1933  if ( i ) ptr += sprintf(ptr, " ");
1934  if (IS_DEGREE(opts))
1935  ptr += sprintf(ptr, "%s %s %s", y, x, z);
1936  else
1937  ptr += sprintf(ptr, "%s %s %s", x, y, z);
1938  }
1939  }
1940 
1941  return ptr-output;
1942 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:180
#define IS_DEGREE(x)
Definition: liblwgeom.h:1700
#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
opts
Definition: ovdump.py:45
double y
Definition: liblwgeom.h:405
double x
Definition: liblwgeom.h:405
double z
Definition: liblwgeom.h:417
double x
Definition: liblwgeom.h:417
double y
Definition: liblwgeom.h:417
lwflags_t flags
Definition: liblwgeom.h:446
uint32_t npoints
Definition: liblwgeom.h:442

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

Referenced by asgml3_circstring_buf(), asgml3_compound_buf(), asgml3_curvepoly_buf(), asgml3_line_buf(), asgml3_point_buf(), asgml3_poly_buf(), asgml3_triangle_buf(), and gbox_to_gml3().

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