PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void do_lwgeom_flip_coordinates ( char *  in,
char *  out 
)
static

Definition at line 514 of file cu_libgeom.c.

References LWGEOM::bbox, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_add_bbox(), lwgeom_flip_coordinates(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_to_wkt(), WKT_EXTENDED, GBOX::xmax, and GBOX::ymax.

Referenced by test_lwgeom_flip_coordinates().

515 {
516  LWGEOM *g;
517  char * t;
518  double xmax, ymax;
519  int testbox;
520 
522  lwgeom_add_bbox(g);
523 
524  testbox = (g->bbox != NULL);
525  if ( testbox )
526  {
527  xmax = g->bbox->xmax;
528  ymax = g->bbox->ymax;
529  }
530 
532 
533  if ( testbox )
534  {
535  CU_ASSERT_DOUBLE_EQUAL(g->bbox->xmax, ymax, 0.00001);
536  CU_ASSERT_DOUBLE_EQUAL(g->bbox->ymax, xmax, 0.00001);
537  }
538 
539  t = lwgeom_to_wkt(g, WKT_EXTENDED, 8, NULL);
540  if (t == NULL) fprintf(stderr, "In:%s", in);
541  if (strcmp(t, out))
542  fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", in, t, out);
543 
544  CU_ASSERT_STRING_EQUAL(t, out)
545 
546  lwgeom_free(g);
547  lwfree(t);
548 }
GBOX * bbox
Definition: liblwgeom.h:382
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:655
void lwfree(void *mem)
Definition: lwutil.c:214
double xmax
Definition: liblwgeom.h:277
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:890
LWGEOM * lwgeom_flip_coordinates(LWGEOM *in)
Reverse the X and Y coordinate order.
Definition: lwgeom.c:1458
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1869
double ymax
Definition: liblwgeom.h:279
#define WKT_EXTENDED
Definition: liblwgeom.h:1941
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:599

Here is the call graph for this function:

Here is the caller graph for this function: