PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ pointArray_toGML3()

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

Definition at line 1890 of file lwout_gml.c.

References POINTARRAY::flags, FLAGS_GET_Z, getPoint2d_cp(), getPoint3dz_cp(), IS_DEGREE, lwprint_double(), POINTARRAY::npoints, OUT_DOUBLE_BUFFER_SIZE, pixval::x, POINT2D::x, POINT3DZ::x, pixval::y, POINT2D::y, POINT3DZ::y, and POINT3DZ::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().

1891 {
1892  uint32_t i;
1893  char *ptr;
1894  char x[OUT_DOUBLE_BUFFER_SIZE];
1895  char y[OUT_DOUBLE_BUFFER_SIZE];
1896  char z[OUT_DOUBLE_BUFFER_SIZE];
1897 
1898  ptr = output;
1899 
1900  if ( ! FLAGS_GET_Z(pa->flags) )
1901  {
1902  for (i=0; i<pa->npoints; i++)
1903  {
1904  const POINT2D *pt;
1905  pt = getPoint2d_cp(pa, i);
1910 
1911  if ( i ) ptr += sprintf(ptr, " ");
1912  if (IS_DEGREE(opts))
1913  ptr += sprintf(ptr, "%s %s", y, x);
1914  else
1915  ptr += sprintf(ptr, "%s %s", x, y);
1916  }
1917  }
1918  else
1919  {
1920  for (i=0; i<pa->npoints; i++)
1921  {
1922  const POINT3DZ *pt;
1923  pt = getPoint3dz_cp(pa, i);
1924 
1931 
1932  if ( i ) ptr += sprintf(ptr, " ");
1933  if (IS_DEGREE(opts))
1934  ptr += sprintf(ptr, "%s %s %s", y, x, z);
1935  else
1936  ptr += sprintf(ptr, "%s %s %s", x, y, z);
1937  }
1938  }
1939 
1940  return ptr-output;
1941 }
int lwprint_double(double d, int maxdd, char *buf, size_t bufsize)
Definition: lwprint.c:488
double z
Definition: liblwgeom.h:336
double y
Definition: liblwgeom.h:336
double x
Definition: liblwgeom.h:336
#define IS_DEGREE(x)
Definition: liblwgeom.h:1551
unsigned int uint32_t
Definition: uthash.h:78
double x
Definition: liblwgeom.h:330
const POINT3DZ * getPoint3dz_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3DZ pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwgeom_api.c:378
uint8_t flags
Definition: liblwgeom.h:371
uint8_t precision
Definition: cu_in_twkb.c:25
double y
Definition: liblwgeom.h:330
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:139
#define OUT_DOUBLE_BUFFER_SIZE
opts
Definition: ovdump.py:44
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwgeom_api.c:364
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: