PostGIS  2.2.8dev-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 430 of file lwin_wkb.c.

References wkb_parse_state::check, wkb_parse_state::has_m, wkb_parse_state::has_z, LW_PARSER_CHECK_MINPOINTS, lwerror(), lwline_construct(), lwline_construct_empty(), wkb_parse_state::lwtype, lwtype_name(), POINTARRAY::npoints, ptarray_from_wkb_state(), and wkb_parse_state::srid.

Referenced by lwgeom_from_wkb_state().

431 {
433 
434  if( pa == NULL || pa->npoints == 0 )
435  return lwline_construct_empty(s->srid, s->has_z, s->has_m);
436 
437  if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
438  {
439  lwerror("%s must have at least two points", lwtype_name(s->lwtype));
440  return NULL;
441  }
442 
443  return lwline_construct(s->srid, NULL, pa);
444 }
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:315
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
Definition: lwline.c:51
int npoints
Definition: liblwgeom.h:355
#define LW_PARSER_CHECK_MINPOINTS
Parser check flags.
Definition: liblwgeom.h:1864
uint32_t lwtype
Definition: lwin_wkb.c:27
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:29
uint32_t srid
Definition: lwin_wkb.c:28
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: