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

◆ gserialized2_peek_first_point()

int gserialized2_peek_first_point ( const GSERIALIZED g,
POINT4D out_point 
)

Definition at line 581 of file gserialized2.c.

582{
583 uint8_t *geometry_start = gserialized2_get_geometry_p(g);
584
585 uint32_t isEmpty = (((uint32_t *)geometry_start)[1]) == 0;
586 if (isEmpty)
587 {
588 return LW_FAILURE;
589 }
590
591 uint32_t type = (((uint32_t *)geometry_start)[0]);
592 /* Setup double_array_start depending on the geometry type */
593 double *double_array_start = NULL;
594 switch (type)
595 {
596 case (POINTTYPE):
597 /* For points we only need to jump over the type and npoints 32b ints */
598 double_array_start = (double *)(geometry_start + 2 * sizeof(uint32_t));
599 break;
600
601 default:
602 lwerror("%s is currently not implemented for type %d", __func__, type);
603 return LW_FAILURE;
604 }
605
606 gserialized2_copy_point(double_array_start, g->gflags, out_point);
607 return LW_SUCCESS;
608}
static void gserialized2_copy_point(double *dptr, lwflags_t flags, POINT4D *out_point)
static uint8_t * gserialized2_get_geometry_p(const GSERIALIZED *g)
#define LW_FAILURE
Definition liblwgeom.h:110
#define LW_SUCCESS
Definition liblwgeom.h:111
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
uint8_t gflags
Definition liblwgeom.h:432

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

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: