PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_add_bbox()

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 695 of file lwgeom.c.

696 {
697  /* an empty LWGEOM has no bbox */
698  if ( lwgeom_is_empty(lwgeom) ) return;
699 
700  if ( lwgeom->bbox ) return;
701  FLAGS_SET_BBOX(lwgeom->flags, 1);
702  lwgeom->bbox = gbox_new(lwgeom->flags);
703  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
704 }
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: gbox.c:32
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:174
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the gbox for this geometry, a cartesian box or geodetic box, depending on how it is flagged...
Definition: lwgeom.c:755
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
GBOX * bbox
Definition: liblwgeom.h:458
lwflags_t flags
Definition: liblwgeom.h:461

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

Referenced by do_lwgeom_swap_ordinates(), GEOS2POSTGIS(), gserialized1_from_lwgeom(), gserialized2_from_lwgeom(), lw_dist2d_recursive(), lwcollection_extract(), LWGEOM_addBBOX(), LWGEOM_ChaikinSmoothing(), LWGEOM_expand(), lwgeom_from_encoded_polyline(), lwgeom_from_geojson(), LWGEOM_geometryn_collection(), lwgeom_get_bbox(), LWGEOM_in(), LWGEOM_recv(), lwgeom_refresh_bbox(), LWGEOM_SetEffectiveArea(), LWGEOMFromEWKB(), LWGEOMFromTWKB(), lwline_removepoint(), lwpoly_construct_envelope(), lwt_ChangeEdgeGeom(), test_gbox_same_2d(), test_lwgeom_from_gserialized(), test_lwgeom_from_gserialized2(), test_lwgeom_same(), and test_lwgeom_scale().

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