PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_gserialized_get_gbox_geocentric()

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:397
double xmax
Definition: liblwgeom.h:293
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:149
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:701
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
double zmax
Definition: liblwgeom.h:297
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
double ymax
Definition: liblwgeom.h:295
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:296
Here is the call graph for this function:
Here is the caller graph for this function: