PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ ptarray_flip_coordinates()

POINTARRAY* ptarray_flip_coordinates ( POINTARRAY pa)

Reverse X and Y axis on a given POINTARRAY.

Definition at line 356 of file ptarray.c.

References getPoint4d_p(), POINTARRAY::npoints, ptarray_set_point4d(), POINT4D::x, and POINT4D::y.

Referenced by parse_gml_curve(), parse_gml_data(), parse_gml_line(), parse_gml_linearring(), parse_gml_patch(), parse_gml_point(), parse_gml_polygon(), and parse_gml_triangle().

357 {
358  uint32_t i;
359  double d;
360  POINT4D p;
361 
362  for (i=0 ; i < pa->npoints ; i++)
363  {
364  getPoint4d_p(pa, i, &p);
365  d = p.y;
366  p.y = p.x;
367  p.x = d;
368  ptarray_set_point4d(pa, i, &p);
369  }
370 
371  return pa;
372 }
double x
Definition: liblwgeom.h:354
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:404
unsigned int uint32_t
Definition: uthash.h:78
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:112
double y
Definition: liblwgeom.h:354
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: