PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ do_lwgeom_flip_coordinates()

static void do_lwgeom_flip_coordinates ( char *  in,
char *  out 
)
static

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

516 {
517  LWGEOM *g;
518  char * t;
519  double xmax, ymax;
520  int testbox;
521 
523  lwgeom_add_bbox(g);
524 
525  testbox = (g->bbox != NULL);
526  if ( testbox )
527  {
528  xmax = g->bbox->xmax;
529  ymax = g->bbox->ymax;
530  }
531 
533 
534  if ( testbox )
535  {
536  CU_ASSERT_DOUBLE_EQUAL(g->bbox->xmax, ymax, 0.00001);
537  CU_ASSERT_DOUBLE_EQUAL(g->bbox->ymax, xmax, 0.00001);
538  }
539 
540  t = lwgeom_to_wkt(g, WKT_EXTENDED, 8, NULL);
541  if (t == NULL) fprintf(stderr, "In:%s", in);
542  if (strcmp(t, out))
543  fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", in, t, out);
544 
545  CU_ASSERT_STRING_EQUAL(t, out)
546 
547  lwgeom_free(g);
548  lwfree(t);
549 }
GBOX * bbox
Definition: liblwgeom.h:398
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:669
void lwfree(void *mem)
Definition: lwutil.c:244
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
LWGEOM * lwgeom_flip_coordinates(LWGEOM *in)
Reverse the X and Y coordinate order.
Definition: lwgeom.c:1507
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
double ymax
Definition: liblwgeom.h:295
#define WKT_EXTENDED
Definition: liblwgeom.h:2085
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:648
Here is the call graph for this function:
Here is the caller graph for this function: