PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int ptarray_force_geodetic ( POINTARRAY pa)
static

Definition at line 2744 of file lwgeodetic.c.

References getPoint4d_p(), latitude_degrees_normalize(), longitude_degrees_normalize(), LW_FALSE, LW_TRUE, POINTARRAY::npoints, ptarray_set_point4d(), POINT4D::x, and POINT4D::y.

Referenced by lwline_force_geodetic(), lwpoint_force_geodetic(), and lwpoly_force_geodetic().

2745 {
2746  int t;
2747  int changed = LW_FALSE;
2748  POINT4D pt;
2749 
2750  assert(pa);
2751 
2752  for ( t=0; t < pa->npoints; t++ )
2753  {
2754  getPoint4d_p(pa, t, &pt);
2755  if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
2756  {
2757  pt.x = longitude_degrees_normalize(pt.x);
2758  pt.y = latitude_degrees_normalize(pt.y);
2759  ptarray_set_point4d(pa, t, &pt);
2760  changed = LW_TRUE;
2761  }
2762  }
2763  return changed;
2764 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:501
double x
Definition: liblwgeom.h:308
int npoints
Definition: liblwgeom.h:327
double longitude_degrees_normalize(double lon)
Convert a longitude to the range of -180,180.
Definition: lwgeodetic.c:83
double latitude_degrees_normalize(double lat)
Convert a latitude to the range of -90,90.
Definition: lwgeodetic.c:110
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
double y
Definition: liblwgeom.h:308
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:217

Here is the call graph for this function:

Here is the caller graph for this function: