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

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

296 {
297  LWGEOM *lwg;
298  GBOX gbox, gbox_slow;
299  int i;
300 
301  for ( i = 0; i < gbox_data_length; i++ )
302  {
303 #if 0
304 // if ( i != 0 ) continue; /* skip our bad case */
305  printf("\n\n------------\n");
306  printf("%s\n", gbox_data[i]);
307 #endif
309  FLAGS_SET_GEODETIC(lwg->flags, 1);
311  lwgeom_calculate_gbox(lwg, &gbox);
313  lwgeom_calculate_gbox(lwg, &gbox_slow);
315  lwgeom_free(lwg);
316 #if 0
317  printf("\nCALC: %s\n", gbox_to_string(&gbox));
318  printf("GOOD: %s\n", gbox_to_string(&gbox_slow));
319  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));
320  printf("------------\n");
321 #endif
322  CU_ASSERT_DOUBLE_EQUAL(gbox.xmin, gbox_slow.xmin, 0.00000001);
323  CU_ASSERT_DOUBLE_EQUAL(gbox.ymin, gbox_slow.ymin, 0.00000001);
324  CU_ASSERT_DOUBLE_EQUAL(gbox.zmin, gbox_slow.zmin, 0.00000001);
325  CU_ASSERT_DOUBLE_EQUAL(gbox.xmax, gbox_slow.xmax, 0.00000001);
326  CU_ASSERT_DOUBLE_EQUAL(gbox.ymax, gbox_slow.ymax, 0.00000001);
327  CU_ASSERT_DOUBLE_EQUAL(gbox.zmax, gbox_slow.zmax, 0.00000001);
328  }
329 
330 }
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
Definition: g_box.c:404
uint8_t flags
Definition: liblwgeom.h:396
double xmax
Definition: liblwgeom.h:292
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:148
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:665
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double ymax
Definition: liblwgeom.h:294
int gbox_data_length
int gbox_geocentric_slow
For testing geodetic bounding box, we have a magic global variable.
Definition: lwgeodetic.c:36
double zmin
Definition: liblwgeom.h:295

Here is the call graph for this function:

Here is the caller graph for this function: