PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ gserialized_is_empty()

int gserialized_is_empty ( const GSERIALIZED g)

Check if a GSERIALIZED is empty without deserializing first.

Only checks if the number of elements of the parent geometry is zero, will not catch collections of empty, eg: GEOMETRYCOLLECTION(POINT EMPTY)

Definition at line 178 of file g_serialized.c.

References GSERIALIZED::flags, FLAGS_GET_BBOX, gbox_serialized_size(), and gserialized_is_empty_recurse().

Referenced by boundary(), buffer(), contains(), containsproperly(), convexhull(), coveredby(), covers(), crosses(), disjoint(), geography_bestsrid(), geography_centroid(), geography_distance(), geography_distance_tree(), geography_dwithin(), geography_segmentize(), geos_intersects(), hausdorffdistance(), hausdorffdistancedensify(), is_gserialized_from_datum_empty(), isring(), issimple(), isvalid(), LWGEOM_angle(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), overlaps(), pgis_union_geometry_array(), postgis_valid_typmod(), ST_DistanceRectTree(), ST_DistanceRectTreeCached(), ST_Equals(), ST_FrechetDistance(), ST_MinimumBoundingCircle(), ST_MinimumBoundingRadius(), test_gserialized_is_empty(), topologypreservesimplify(), and touches().

179 {
180  uint8_t *p = (uint8_t*)g;
181  int isempty = 0;
182  assert(g);
183 
184  p += 8; /* Skip varhdr and srid/flags */
185  if( FLAGS_GET_BBOX(g->flags) )
186  p += gbox_serialized_size(g->flags); /* Skip the box */
187 
188  gserialized_is_empty_recurse(p, &isempty);
189  return isempty;
190 }
static size_t gserialized_is_empty_recurse(const uint8_t *p, int *isempty)
Definition: g_serialized.c:151
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:141
unsigned char uint8_t
Definition: uthash.h:79
size_t gbox_serialized_size(uint8_t flags)
Return the number of bytes necessary to hold a GBOX of this dimension in serialized form...
Definition: g_box.c:446
uint8_t flags
Definition: liblwgeom.h:385
Here is the call graph for this function:
Here is the caller graph for this function: