PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ ptarray_flip_coordinates()

POINTARRAY* ptarray_flip_coordinates ( POINTARRAY pa)

Reverse X and Y axis on a given POINTARRAY.

Definition at line 360 of file ptarray.c.

361 {
362  uint32_t i;
363  double d;
364  POINT4D p;
365 
366  for (i=0 ; i < pa->npoints ; i++)
367  {
368  getPoint4d_p(pa, i, &p);
369  d = p.y;
370  p.y = p.x;
371  p.x = d;
372  ptarray_set_point4d(pa, i, &p);
373  }
374 
375  return pa;
376 }
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:125
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:376
double x
Definition: liblwgeom.h:400
double y
Definition: liblwgeom.h:400
uint32_t npoints
Definition: liblwgeom.h:413

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().

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