PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwline_from_wkb_state()

static LWLINE* lwline_from_wkb_state ( wkb_parse_state s)
static

LINESTRING Read a WKB linestring, starting just after the endian byte, type number and optional srid number.

Advance the parse state forward appropriately. There is only one pointarray in a linestring. Optionally check for minimal following of rules (two point minimum).

Definition at line 471 of file lwin_wkb.c.

472 {
474  if (s->error)
475  return NULL;
476 
477  if( pa == NULL || pa->npoints == 0 )
478  {
479  if (pa)
480  ptarray_free(pa);
481  return lwline_construct_empty(s->srid, s->has_z, s->has_m);
482  }
483 
484  if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
485  {
486  lwerror("%s must have at least two points", lwtype_name(s->lwtype));
487  return NULL;
488  }
489 
490  return lwline_construct(s->srid, NULL, pa);
491 }
char * s
Definition: cu_in_wkt.c:23
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define LW_PARSER_CHECK_MINPOINTS
Parser check flags.
Definition: liblwgeom.h:2109
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:319
LWLINE * lwline_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwline.c:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static POINTARRAY * ptarray_from_wkb_state(wkb_parse_state *s)
POINTARRAY Read a dynamically sized point array and advance the parse state forward.
Definition: lwin_wkb.c:347
uint32_t npoints
Definition: liblwgeom.h:427

References LW_PARSER_CHECK_MINPOINTS, lwerror(), lwline_construct(), lwline_construct_empty(), lwtype_name(), POINTARRAY::npoints, ptarray_free(), ptarray_from_wkb_state(), and s.

Referenced by lwgeom_from_wkb_state().

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