PostGIS  2.4.9dev-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 648 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_flip_coordinates(), geom_from_kml(), geometry_from_geography(), GEOS2POSTGIS(), gserialized_from_lwgeom(), lw_dist2d_recursive(), LWGEOM_addBBOX(), LWGEOM_affine(), 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_SetEffectiveArea(), LWGEOM_simplify2d(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), lwgeom_swap_ordinates(), LWGEOMFromEWKB(), LWGEOMFromTWKB(), lwline_add_lwpoint(), lwline_clip_to_ordinate_range(), lwline_removepoint(), lwline_setPoint4d(), lwmline_clip_to_ordinate_range(), lwmpoint_clip_to_ordinate_range(), lwpoint_clip_to_ordinate_range(), lwpoly_construct_envelope(), lwt_ChangeEdgeGeom(), SFCGALGeometry2POSTGIS(), ST_RemoveRepeatedPoints(), test_gbox_same_2d(), test_lwgeom_from_gserialized(), test_lwgeom_same(), test_lwgeom_scale(), transform(), and transform_geom().

649 {
650  /* an empty LWGEOM has no bbox */
651  if ( lwgeom_is_empty(lwgeom) ) return;
653  if ( lwgeom->bbox ) return;
654  FLAGS_SET_BBOX(lwgeom->flags, 1);
655  lwgeom->bbox = gbox_new(lwgeom->flags);
656  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
657 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:43
GBOX * bbox
Definition: liblwgeom.h:398
uint8_t flags
Definition: liblwgeom.h:397
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:1346
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:148
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:701
Here is the call graph for this function:
Here is the caller graph for this function: