PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_add_bbox()

void lwgeom_add_bbox ( LWGEOM lwgeom)

Compute a bbox if not already computed.

After calling this function lwgeom->bbox is only NULL if the geometry is empty.

Compute a bbox if not already computed.

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

Definition at line 686 of file lwgeom.c.

687 {
688  /* an empty LWGEOM has no bbox */
689  if ( lwgeom_is_empty(lwgeom) ) return;
691  if ( lwgeom->bbox ) return;
692  FLAGS_SET_BBOX(lwgeom->flags, 1);
693  lwgeom->bbox = gbox_new(lwgeom->flags);
694  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
695 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:39
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:148
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:1393
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:746
GBOX * bbox
Definition: liblwgeom.h:401
uint8_t flags
Definition: liblwgeom.h:400

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_ChaikinSmoothing(), LWGEOM_expand(), lwgeom_from_encoded_polyline(), lwgeom_from_geojson(), LWGEOM_from_WKB(), LWGEOM_geometryn_collection(), lwgeom_get_bbox(), LWGEOM_in(), LWGEOM_recv(), lwgeom_refresh_bbox(), LWGEOM_SetEffectiveArea(), 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().

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