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

Definition at line 275 of file cu_geodetic.c.

References LWGEOM::flags, FLAGS_SET_GEODETIC, gbox_data, gbox_data_length, gbox_geocentric_slow, gbox_to_string(), LW_FALSE, LW_PARSER_CHECK_NONE, LW_TRUE, lwgeom_calculate_gbox(), lwgeom_free(), lwgeom_from_wkt(), GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by geodetic_suite_setup().

276 {
277  LWGEOM *lwg;
278  GBOX gbox, gbox_slow;
279  int i;
280 
281  for ( i = 0; i < gbox_data_length; i++ )
282  {
283 #if 0
284 // if ( i != 0 ) continue; /* skip our bad case */
285  printf("\n\n------------\n");
286  printf("%s\n", gbox_data[i]);
287 #endif
289  FLAGS_SET_GEODETIC(lwg->flags, 1);
291  lwgeom_calculate_gbox(lwg, &gbox);
293  lwgeom_calculate_gbox(lwg, &gbox_slow);
295  lwgeom_free(lwg);
296 #if 0
297  printf("\nCALC: %s\n", gbox_to_string(&gbox));
298  printf("GOOD: %s\n", gbox_to_string(&gbox_slow));
299  printf("line %d: diff %.9g\n", i, fabs(gbox.xmin - gbox_slow.xmin)+fabs(gbox.ymin - gbox_slow.ymin)+fabs(gbox.zmin - gbox_slow.zmin));
300  printf("------------\n");
301 #endif
302  CU_ASSERT_DOUBLE_EQUAL(gbox.xmin, gbox_slow.xmin, 0.00000001);
303  CU_ASSERT_DOUBLE_EQUAL(gbox.ymin, gbox_slow.ymin, 0.00000001);
304  CU_ASSERT_DOUBLE_EQUAL(gbox.zmin, gbox_slow.zmin, 0.00000001);
305  CU_ASSERT_DOUBLE_EQUAL(gbox.xmax, gbox_slow.xmax, 0.00000001);
306  CU_ASSERT_DOUBLE_EQUAL(gbox.ymax, gbox_slow.ymax, 0.00000001);
307  CU_ASSERT_DOUBLE_EQUAL(gbox.zmax, gbox_slow.zmax, 0.00000001);
308  }
309 
310 }
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
Definition: g_box.c:328
uint8_t flags
Definition: liblwgeom.h:353
double xmax
Definition: liblwgeom.h:249
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:844
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:115
char gbox_data[][512]
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
Definition: lwgeom.c:608
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
double zmax
Definition: liblwgeom.h:253
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
double ymax
Definition: liblwgeom.h:251
int gbox_data_length
int gbox_geocentric_slow
For testing geodetic bounding box, we have a magic global variable.
Definition: lwgeodetic.c:22
double zmin
Definition: liblwgeom.h:252

Here is the call graph for this function:

Here is the caller graph for this function: