PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_lwgeom_check_geodetic ( void  )
static

Definition at line 780 of file cu_geodetic.c.

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

Referenced by geodetic_suite_setup().

781 {
782  LWGEOM *geom;
783  int i = 0;
784 
785  char ewkt[][512] =
786  {
787  "POINT(0 0.2)",
788  "LINESTRING(-1 -1,-1 2.5,2 2,2 -1)",
789  "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))",
790  "POLYGON((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
791  "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)))",
792  "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))))",
793  "POINT(0 220.2)",
794  "LINESTRING(-1 -1,-1231 2.5,2 2,2 -1)",
795  "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))",
796  "POLYGON((-1 -1,-1 2.5,2 2,2 -133,-1 -1),(0 0,0 1,1 1,1 0,0 0))",
797  "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)))",
798  "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))))",
799  };
800 
801  for ( i = 0; i < 6; i++ )
802  {
803  GSERIALIZED *g;
804  geom = lwgeom_over_gserialized(ewkt[i], &g);
805  CU_ASSERT_EQUAL(lwgeom_check_geodetic(geom), LW_TRUE);
806  lwgeom_free(geom);
807  lwfree(g);
808  }
809 
810  for ( i = 6; i < 12; i++ )
811  {
812  GSERIALIZED *g;
813  //char *out_ewkt;
814  geom = lwgeom_over_gserialized(ewkt[i], &g);
815  CU_ASSERT_EQUAL(lwgeom_check_geodetic(geom), LW_FALSE);
816  //out_ewkt = lwgeom_to_ewkt(geom);
817  //printf("%s\n", out_ewkt);
818  lwgeom_free(geom);
819  lwfree(g);
820  }
821 
822 }
void lwfree(void *mem)
Definition: lwutil.c:190
int lwgeom_check_geodetic(const LWGEOM *geom)
Check that coordinates of LWGEOM are all within the geodetic range (-180, -90, 180, 90)
Definition: lwgeodetic.c:2715
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
static LWGEOM * lwgeom_over_gserialized(char *wkt, GSERIALIZED **g)
Definition: cu_geodetic.c:769

Here is the call graph for this function:

Here is the caller graph for this function: