PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ptarray_flip_coordinates()

POINTARRAY* ptarray_flip_coordinates ( POINTARRAY pa)

Reverse X and Y axis on a given POINTARRAY.

Definition at line 369 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().

370 {
371  int i;
372  double d;
373  POINT4D p;
374 
375  for (i=0 ; i < pa->npoints ; i++)
376  {
377  getPoint4d_p(pa, i, &p);
378  d = p.y;
379  p.y = p.x;
380  p.x = d;
381  ptarray_set_point4d(pa, i, &p);
382  }
383 
384  return pa;
385 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:437
double x
Definition: liblwgeom.h:352
int npoints
Definition: liblwgeom.h:371
double y
Definition: liblwgeom.h:352
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:122
Here is the call graph for this function:
Here is the caller graph for this function: