PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ gserialized2_peek_first_point()

int gserialized2_peek_first_point ( const GSERIALIZED g,
POINT4D out_point 
)

Definition at line 550 of file gserialized2.c.

551 {
552  uint8_t *geometry_start = gserialized2_get_geometry_p(g);
553 
554  uint32_t isEmpty = (((uint32_t *)geometry_start)[1]) == 0;
555  if (isEmpty)
556  {
557  return LW_FAILURE;
558  }
559 
560  uint32_t type = (((uint32_t *)geometry_start)[0]);
561  /* Setup double_array_start depending on the geometry type */
562  double *double_array_start = NULL;
563  switch (type)
564  {
565  case (POINTTYPE):
566  /* For points we only need to jump over the type and npoints 32b ints */
567  double_array_start = (double *)(geometry_start + 2 * sizeof(uint32_t));
568  break;
569 
570  default:
571  lwerror("%s is currently not implemented for type %d", __func__, type);
572  return LW_FAILURE;
573  }
574 
575  gserialized2_copy_point(double_array_start, g->gflags, out_point);
576  return LW_SUCCESS;
577 }
static uint8_t * gserialized2_get_geometry_p(const GSERIALIZED *g)
Definition: gserialized2.c:106
static void gserialized2_copy_point(double *dptr, lwflags_t flags, POINT4D *out_point)
Definition: gserialized2.c:533
#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 void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
type
Definition: ovdump.py:42
uint8_t gflags
Definition: liblwgeom.h:446

References GSERIALIZED::gflags, gserialized2_copy_point(), gserialized2_get_geometry_p(), LW_FAILURE, LW_SUCCESS, lwerror(), POINTTYPE, and ovdump::type.

Referenced by gserialized_peek_first_point(), and peek2_point_helper().

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