PostGIS  2.5.0dev-r@@SVN_REVISION@@
void lwgeom_add_bbox ( LWGEOM lwgeom)

Ensure there's a box in the LWGEOM.

Compute a bbox if not already computed.

If the box is already there just return, else compute it.

Definition at line 679 of file lwgeom.c.

References LWGEOM::bbox, LWGEOM::flags, FLAGS_SET_BBOX, gbox_new(), lwgeom_calculate_gbox(), and lwgeom_is_empty().

Referenced by do_lwgeom_swap_ordinates(), geom_from_kml(), GEOS2POSTGIS(), gserialized_from_lwgeom(), lw_dist2d_recursive(), LWGEOM_addBBOX(), LWGEOM_expand(), lwgeom_from_encoded_polyline(), lwgeom_from_geojson(), lwgeom_from_gml(), LWGEOM_from_WKB(), LWGEOM_geometryn_collection(), lwgeom_get_bbox(), LWGEOM_in(), LWGEOM_recv(), lwgeom_refresh_bbox(), LWGEOM_SetEffectiveArea(), LWGEOM_simplify2d(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), LWGEOMFromEWKB(), LWGEOMFromTWKB(), lwline_removepoint(), lwpoly_construct_envelope(), lwt_ChangeEdgeGeom(), SFCGALGeometry2POSTGIS(), test_gbox_same_2d(), test_lwgeom_from_gserialized(), test_lwgeom_same(), and test_lwgeom_scale().

680 {
681  /* an empty LWGEOM has no bbox */
682  if ( lwgeom_is_empty(lwgeom) ) return;
683 
684  if ( lwgeom->bbox ) return;
685  FLAGS_SET_BBOX(lwgeom->flags, 1);
686  lwgeom->bbox = gbox_new(lwgeom->flags);
687  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
688 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:39
GBOX * bbox
Definition: liblwgeom.h:397
uint8_t flags
Definition: liblwgeom.h:396
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1386
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:147
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the gbox for this goemetry, a cartesian box or geodetic box, depending on how it is flagged...
Definition: lwgeom.c:739

Here is the call graph for this function:

Here is the caller graph for this function: