PostGIS  2.2.8dev-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 599 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(), geography_from_geometry(), geography_segmentize(), 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(), lwt_ChangeEdgeGeom(), SFCGALGeometry2POSTGIS(), ST_MakeEnvelope(), test_gbox_same_2d(), test_lwgeom_from_gserialized(), test_lwgeom_same(), test_lwgeom_scale(), transform(), and transform_geom().

600 {
601  /* an empty LWGEOM has no bbox */
602  if ( lwgeom_is_empty(lwgeom) ) return;
604  if ( lwgeom->bbox ) return;
605  FLAGS_SET_BBOX(lwgeom->flags, 1);
606  lwgeom->bbox = gbox_new(lwgeom->flags);
607  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
608 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:28
GBOX * bbox
Definition: liblwgeom.h:382
uint8_t flags
Definition: liblwgeom.h:381
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:1297
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:132
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:652
Here is the call graph for this function:
Here is the caller graph for this function: