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

◆ gserialized1_peek_first_point()

int gserialized1_peek_first_point ( const GSERIALIZED g,
POINT4D out_point 
)

Definition at line 491 of file gserialized1.c.

492{
493 uint8_t *geometry_start = ((uint8_t *)g->data);
495 {
496 geometry_start += gserialized1_box_size(g);
497 }
498
499 uint32_t isEmpty = (((uint32_t *)geometry_start)[1]) == 0;
500 if (isEmpty)
501 {
502 return LW_FAILURE;
503 }
504
505 uint32_t type = (((uint32_t *)geometry_start)[0]);
506 /* Setup double_array_start depending on the geometry type */
507 double *double_array_start = NULL;
508 switch (type)
509 {
510 case (POINTTYPE):
511 /* For points we only need to jump over the type and npoints 32b ints */
512 double_array_start = (double *)(geometry_start + 2 * sizeof(uint32_t));
513 break;
514
515 default:
516 lwerror("%s is currently not implemented for type %d", __func__, type);
517 return LW_FAILURE;
518 }
519
520 gserialized1_copy_point(double_array_start, g->gflags, out_point);
521 return LW_SUCCESS;
522}
static void gserialized1_copy_point(double *dptr, lwflags_t flags, POINT4D *out_point)
int gserialized1_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
static size_t gserialized1_box_size(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 data[1]
Definition liblwgeom.h:433
uint8_t gflags
Definition liblwgeom.h:432

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

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: