PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ do_lwgeom_swap_ordinates()

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

Definition at line 515 of file cu_libgeom.c.

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 }
@ LWORD_Y
Definition: liblwgeom.h:115
@ LWORD_X
Definition: liblwgeom.h:114
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
#define WKT_EXTENDED
Definition: liblwgeom.h:2077
void lwfree(void *mem)
Definition: lwutil.c:244
void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2)
Swap ordinate values in every vertex of the geometry.
Definition: lwgeom.c:1510
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:676
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:686
double ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
GBOX * bbox
Definition: liblwgeom.h:401

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

Referenced by test_lwgeom_swap_ordinates().

Here is the call graph for this function:
Here is the caller graph for this function: