PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_lwgeom_check_geodetic()

static void test_lwgeom_check_geodetic ( void  )
static

Definition at line 806 of file cu_geodetic.c.

807 {
808  LWGEOM *geom;
809  int i = 0;
810 
811  char ewkt[][512] =
812  {
813  "POINT(0 0.2)",
814  "LINESTRING(-1 -1,-1 2.5,2 2,2 -1)",
815  "SRID=1;MULTILINESTRING((-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))",
816  "POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
817  "SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))",
818  "SRID=4326;GEOMETRYCOLLECTION(POINT(0 1),POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0)),MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5))))",
819  "POINT(0 220.2)",
820  "LINESTRING(-1 -1,-1231 2.5,2 2,2 -1)",
821  "SRID=1;MULTILINESTRING((-1 -131,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))",
822  "POLYGON((-1 -1,-1 2.5,2 2,2 -133,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
823  "SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,211 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))",
824  "SRID=4326;GEOMETRYCOLLECTION(POINT(0 1),POLYGON((-1 -1,-1111 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0)),MULTIPOLYGON(((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5))))",
825  };
826 
827  for ( i = 0; i < 6; i++ )
828  {
829  GSERIALIZED *g;
830  geom = lwgeom_over_gserialized(ewkt[i], &g);
831  CU_ASSERT_EQUAL(lwgeom_check_geodetic(geom), LW_TRUE);
832  lwgeom_free(geom);
833  lwfree(g);
834  }
835 
836  for ( i = 6; i < 12; i++ )
837  {
838  GSERIALIZED *g;
839  //char *out_ewkt;
840  geom = lwgeom_over_gserialized(ewkt[i], &g);
841  CU_ASSERT_EQUAL(lwgeom_check_geodetic(geom), LW_FALSE);
842  //out_ewkt = lwgeom_to_ewkt(geom);
843  //printf("%s\n", out_ewkt);
844  lwgeom_free(geom);
845  lwfree(g);
846  }
847 
848 }
static LWGEOM * lwgeom_over_gserialized(char *wkt, GSERIALIZED **g)
Definition: cu_geodetic.c:795
#define LW_FALSE
Definition: liblwgeom.h:77
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
int lwgeom_check_geodetic(const LWGEOM *geom)
Check that coordinates of LWGEOM are all within the geodetic range (-180, -90, 180,...
Definition: lwgeodetic.c:3131
void lwfree(void *mem)
Definition: lwutil.c:244
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76

References LW_FALSE, LW_TRUE, lwfree(), lwgeom_check_geodetic(), lwgeom_free(), and lwgeom_over_gserialized().

Referenced by geodetic_suite_setup().

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