PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_needs_bbox()

int lwgeom_needs_bbox ( const LWGEOM geom)

Check whether or not a lwgeom is big enough to warrant a bounding box.

Check whether or not a lwgeom is big enough to warrant a bounding box when stored in the serialized form on disk. Currently only points are considered small enough to not require a bounding box, because the index operations can generate a large number of box-retrieval operations when scanning keys.

Definition at line 1191 of file lwgeom.c.

1192{
1193 assert(geom);
1194 if ( geom->type == POINTTYPE )
1195 {
1196 return LW_FALSE;
1197 }
1198 else if ( geom->type == LINETYPE )
1199 {
1200 if ( lwgeom_count_vertices(geom) <= 2 )
1201 return LW_FALSE;
1202 else
1203 return LW_TRUE;
1204 }
1205 else if ( geom->type == MULTIPOINTTYPE )
1206 {
1207 if ( ((LWCOLLECTION*)geom)->ngeoms == 1 )
1208 return LW_FALSE;
1209 else
1210 return LW_TRUE;
1211 }
1212 else if ( geom->type == MULTILINETYPE )
1213 {
1214 if ( ((LWCOLLECTION*)geom)->ngeoms == 1 && lwgeom_count_vertices(geom) <= 2 )
1215 return LW_FALSE;
1216 else
1217 return LW_TRUE;
1218 }
1219 else
1220 {
1221 return LW_TRUE;
1222 }
1223}
#define LW_FALSE
Definition liblwgeom.h:108
#define MULTILINETYPE
Definition liblwgeom.h:120
#define LINETYPE
Definition liblwgeom.h:117
#define MULTIPOINTTYPE
Definition liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:107
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count points in an LWGEOM.
Definition lwgeom.c:1229
uint8_t type
Definition liblwgeom.h:448

References LINETYPE, LW_FALSE, LW_TRUE, lwgeom_count_vertices(), MULTILINETYPE, MULTIPOINTTYPE, POINTTYPE, and LWGEOM::type.

Referenced by GEOS2POSTGIS(), gserialized1_from_lwgeom(), gserialized2_from_lwgeom(), lwgeom_from_gserialized1(), lwgeom_from_gserialized2(), LWGEOM_in(), LWGEOM_recv(), LWGEOMFromEWKB(), LWGEOMFromTWKB(), and SFCGALGeometry2POSTGIS().

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