PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 555 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_flip_coordinates(), lwgeom_from_geojson(), lwgeom_from_gml(), LWGEOM_from_WKB(), LWGEOM_geometryn_collection(), lwgeom_get_bbox(), LWGEOM_in(), LWGEOM_recv(), LWGEOM_simplify2d(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), LWGEOMFromWKB(), 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(), SFCGALGeometry2POSTGIS(), ST_MakeEnvelope(), test_lwgeom_from_gserialized(), test_lwgeom_same(), transform(), and transform_geom().

556 {
557  /* an empty LWGEOM has no bbox */
558  if ( lwgeom_is_empty(lwgeom) ) return;
560  if ( lwgeom->bbox ) return;
561  FLAGS_SET_BBOX(lwgeom->flags, 1);
562  lwgeom->bbox = gbox_new(lwgeom->flags);
563  lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
564 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:26
GBOX * bbox
Definition: liblwgeom.h:354
uint8_t flags
Definition: liblwgeom.h:353
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:1229
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:114
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:608

Here is the call graph for this function:

Here is the caller graph for this function: