PostGIS  2.4.9dev-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 179 of file g_serialized.c.

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

Referenced by boundary(), buffer(), centroid(), 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_line_interpolate_point(), LWGEOM_snaptogrid(), LWGEOM_snaptogrid_pointoff(), overlaps(), pgis_union_geometry_array(), pointonsurface(), postgis_valid_typmod(), ST_Equals(), ST_FrechetDistance(), ST_MinimumBoundingCircle(), ST_MinimumBoundingRadius(), test_gserialized_is_empty(), topologypreservesimplify(), and touches().

180 {
181  uint8_t *p = (uint8_t*)g;
182  int isempty = 0;
183  assert(g);
184 
185  p += 8; /* Skip varhdr and srid/flags */
186  if( FLAGS_GET_BBOX(g->flags) )
187  p += gbox_serialized_size(g->flags); /* Skip the box */
188 
189  gserialized_is_empty_recurse(p, &isempty);
190  return isempty;
191 }
static size_t gserialized_is_empty_recurse(const uint8_t *p, int *isempty)
Definition: g_serialized.c:152
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:142
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:451
uint8_t flags
Definition: liblwgeom.h:383
Here is the call graph for this function:
Here is the caller graph for this function: