PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum LWGEOM_to_BOX2DF ( PG_FUNCTION_ARGS  )

Definition at line 127 of file lwgeom_box.c.

References GBOX::flags, FLAGS_SET_M, FLAGS_SET_Z, gbox_copy(), gserialized_get_gbox_p(), and LW_FAILURE.

128 {
129  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
130  GBOX gbox;
131 
132  if ( gserialized_get_gbox_p(geom, &gbox) == LW_FAILURE )
133  PG_RETURN_NULL();
134 
135  /* Strip out higher dimensions */
136  FLAGS_SET_Z(gbox.flags, 0);
137  FLAGS_SET_M(gbox.flags, 0);
138 
139  PG_FREE_IF_COPY(geom, 0);
140  PG_RETURN_POINTER(gbox_copy(&gbox));
141 }
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Read the bounding box off a serialization and calculate one if it is not already there.
Definition: g_serialized.c:371
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:403
#define LW_FAILURE
Definition: liblwgeom.h:64
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:130
uint8_t flags
Definition: liblwgeom.h:275
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:131

Here is the call graph for this function: