PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized1_peek_first_point()

int gserialized1_peek_first_point ( const GSERIALIZED g,
POINT4D out_point 
)

Definition at line 492 of file gserialized1.c.

493 {
494  uint8_t *geometry_start = ((uint8_t *)g->data);
495  if (gserialized1_has_bbox(g))
496  {
497  geometry_start += gserialized1_box_size(g);
498  }
499 
500  uint32_t isEmpty = (((uint32_t *)geometry_start)[1]) == 0;
501  if (isEmpty)
502  {
503  return LW_FAILURE;
504  }
505 
506  uint32_t type = (((uint32_t *)geometry_start)[0]);
507  /* Setup double_array_start depending on the geometry type */
508  double *double_array_start = NULL;
509  switch (type)
510  {
511  case (POINTTYPE):
512  /* For points we only need to jump over the type and npoints 32b ints */
513  double_array_start = (double *)(geometry_start + 2 * sizeof(uint32_t));
514  break;
515 
516  default:
517  lwerror("%s is currently not implemented for type %d", __func__, type);
518  return LW_FAILURE;
519  }
520 
521  gserialized1_copy_point(double_array_start, g->gflags, out_point);
522  return LW_SUCCESS;
523 }
static void gserialized1_copy_point(double *dptr, lwflags_t flags, POINT4D *out_point)
Definition: gserialized1.c:475
int gserialized1_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
Definition: gserialized1.c:91
static size_t gserialized1_box_size(const GSERIALIZED *g)
Definition: gserialized1.c:65
#define LW_FAILURE
Definition: liblwgeom.h:96
#define LW_SUCCESS
Definition: liblwgeom.h:97
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
type
Definition: ovdump.py:42
uint8_t data[1]
Definition: liblwgeom.h:447
uint8_t gflags
Definition: liblwgeom.h:446

References GSERIALIZED::data, GSERIALIZED::gflags, gserialized1_box_size(), gserialized1_copy_point(), gserialized1_has_bbox(), LW_FAILURE, LW_SUCCESS, lwerror(), POINTTYPE, and ovdump::type.

Referenced by gserialized_peek_first_point(), and peek1_point_helper().

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