lwerror("unsupported type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
return LW_FAILURE;
}
+
+void gbox_float_round(GBOX *gbox)
+{
+ gbox->xmin = next_float_down(gbox->xmin);
+ gbox->xmax = next_float_up(gbox->xmax);
+
+ gbox->ymin = next_float_down(gbox->ymin);
+ gbox->ymax = next_float_up(gbox->ymax);
+
+ gbox->mmin = next_float_down(gbox->mmin);
+ gbox->mmax = next_float_up(gbox->mmax);
+
+ if ( FLAGS_GET_Z(gbox->flags) )
+ {
+ gbox->zmin = next_float_down(gbox->zmin);
+ gbox->zmax = next_float_up(gbox->zmax);
+ }
+}
+
return lwgeom_to_wkt(lwgeom_from_gserialized(g), WKT_ISO, 12, 0);
}
-/* TODO: expose to internal API ? */
-static void gbox_float_round(GBOX *gbox)
-{
- gbox->xmin = next_float_down(gbox->xmin);
- gbox->xmax = next_float_up(gbox->xmax);
-
- gbox->ymin = next_float_down(gbox->ymin);
- gbox->ymax = next_float_up(gbox->ymax);
-
- gbox->mmin = next_float_down(gbox->mmin);
- gbox->mmax = next_float_up(gbox->mmax);
-
- if ( FLAGS_GET_Z(gbox->flags) )
- {
- gbox->zmin = next_float_down(gbox->zmin);
- gbox->zmax = next_float_up(gbox->zmax);
- }
-}
-
int gserialized_read_gbox_p(const GSERIALIZED *g, GBOX *gbox)
{
*/
extern int gbox_same(const GBOX *g1, const GBOX *g2);
+/**
+ * Round given GBOX to float boundaries
+ *
+ * This turns a GBOX into the version it would become
+ * after a serialize/deserialize round trip.
+ */
+extern void gbox_float_round(GBOX *gbox);
+
/**
* Utility function to get type number from string. For example, a string 'POINTZ'
* would return type of 1 and z of 1 and m of 0. Valid