PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ lwpoint_to_wkb_buf()

static uint8_t* lwpoint_to_wkb_buf ( const LWPOINT pt,
uint8_t buf,
uint8_t  variant 
)
static

Definition at line 433 of file lwout_wkb.c.

References empty_to_wkb_buf(), endian_to_wkb_buf(), integer_to_wkb_buf(), LWDEBUGF, lwgeom_is_empty(), lwgeom_wkb_needs_srid(), lwgeom_wkb_type(), ptarray_to_wkb_buf(), LWGEOM::srid, WKB_EXTENDED, and WKB_NO_NPOINTS.

Referenced by lwgeom_to_wkb_buf().

434 {
435  /* Only process empty at this level in the EXTENDED case */
436  if ( (variant & WKB_EXTENDED) && lwgeom_is_empty((LWGEOM*)pt) )
437  return empty_to_wkb_buf((LWGEOM*)pt, buf, variant);
438 
439  /* Set the endian flag */
440  LWDEBUGF(4, "Entering function, buf = %p", buf);
441  buf = endian_to_wkb_buf(buf, variant);
442  LWDEBUGF(4, "Endian set, buf = %p", buf);
443  /* Set the geometry type */
445  LWDEBUGF(4, "Type set, buf = %p", buf);
446  /* Set the optional SRID for extended variant */
447  if ( lwgeom_wkb_needs_srid((LWGEOM*)pt, variant) )
448  {
449  buf = integer_to_wkb_buf(pt->srid, buf, variant);
450  LWDEBUGF(4, "SRID set, buf = %p", buf);
451  }
452  /* Set the coordinates */
453  buf = ptarray_to_wkb_buf(pt->point, buf, variant | WKB_NO_NPOINTS);
454  LWDEBUGF(4, "Pointarray set, buf = %p", buf);
455  return buf;
456 }
static uint8_t * empty_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:315
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:63
uint8_t variant
Definition: cu_in_twkb.c:26
static uint32_t lwgeom_wkb_type(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:82
int32_t srid
Definition: liblwgeom.h:401
static uint8_t * integer_to_wkb_buf(const int ival, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:196
#define WKB_EXTENDED
Definition: liblwgeom.h:2067
static uint8_t * ptarray_to_wkb_buf(const POINTARRAY *pa, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:371
#define WKB_NO_NPOINTS
Definition: liblwgeom.h:2071
static uint8_t * endian_to_wkb_buf(uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:164
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1393
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function:
Here is the caller graph for this function: