PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwtriangle_to_wkb_buf()

static uint8_t* lwtriangle_to_wkb_buf ( const LWTRIANGLE tri,
uint8_t *  buf,
uint8_t  variant 
)
static

Definition at line 546 of file lwout_wkb.c.

547 {
548  /* Only process empty at this level in the EXTENDED case */
549  if ( (variant & WKB_EXTENDED) && lwgeom_is_empty((LWGEOM*)tri) )
550  return empty_to_wkb_buf((LWGEOM*)tri, buf, variant);
551 
552  /* Set the endian flag */
553  buf = endian_to_wkb_buf(buf, variant);
554 
555  /* Set the geometry type */
557 
558  /* Set the optional SRID for extended variant */
559  if ( lwgeom_wkb_needs_srid((LWGEOM*)tri, variant) )
560  buf = integer_to_wkb_buf(tri->srid, buf, variant);
561 
562  /* Set the number of rings (only one, it's a triangle, buddy) */
563  buf = integer_to_wkb_buf(1, buf, variant);
564 
565  /* Write that ring */
566  buf = ptarray_to_wkb_buf(tri->points, buf, variant);
567 
568  return buf;
569 }
static uint8_t variant
Definition: cu_in_twkb.c:26
#define WKB_EXTENDED
Definition: liblwgeom.h:2177
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
static uint8_t * ptarray_to_wkb_buf(const POINTARRAY *pa, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:398
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:64
static uint8_t * endian_to_wkb_buf(uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:164
static uint32_t lwgeom_wkb_type(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:83
static uint8_t * empty_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:344
static uint8_t * integer_to_wkb_buf(const uint32_t ival, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:197
int32_t srid
Definition: liblwgeom.h:460

References empty_to_wkb_buf(), endian_to_wkb_buf(), integer_to_wkb_buf(), lwgeom_is_empty(), lwgeom_wkb_needs_srid(), lwgeom_wkb_type(), LWTRIANGLE::points, ptarray_to_wkb_buf(), LWTRIANGLE::srid, variant, and WKB_EXTENDED.

Referenced by lwgeom_to_wkb_buf().

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