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

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

507 {
508  LWGEOM *g;
509  char * t;
510  double xmax, ymax;
511  int testbox;
512 
514  lwgeom_add_bbox(g);
515 
516  testbox = (g->bbox != NULL);
517  if ( testbox )
518  {
519  xmax = g->bbox->xmax;
520  ymax = g->bbox->ymax;
521  }
522 
524 
525  if ( testbox )
526  {
527  CU_ASSERT_DOUBLE_EQUAL(g->bbox->xmax, ymax, 0.00001);
528  CU_ASSERT_DOUBLE_EQUAL(g->bbox->ymax, xmax, 0.00001);
529  }
530 
531  t = lwgeom_to_wkt(g, WKT_EXTENDED, 8, NULL);
532  if (t == NULL) fprintf(stderr, "In:%s", in);
533  if (strcmp(t, out))
534  fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", in, t, out);
535 
536  CU_ASSERT_STRING_EQUAL(t, out)
537 
538  lwgeom_free(g);
539  lwfree(t);
540 }
GBOX * bbox
Definition: liblwgeom.h:354
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:190
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
LWGEOM * lwgeom_flip_coordinates(LWGEOM *in)
Reverse the X and Y coordinate order.
Definition: lwgeom.c:1390
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
double ymax
Definition: liblwgeom.h:251
#define WKT_EXTENDED
Definition: liblwgeom.h:1778
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:555

Here is the call graph for this function:

Here is the caller graph for this function: