PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwline_from_twkb_state()

static LWLINE* lwline_from_twkb_state ( twkb_parse_state s)
static

LINESTRING.

Definition at line 224 of file lwin_twkb.c.

References twkb_parse_state::check, twkb_parse_state::has_m, twkb_parse_state::has_z, twkb_parse_state::is_empty, LW_PARSER_CHECK_MINPOINTS, LWDEBUG, lwerror(), lwline_construct(), lwline_construct_empty(), twkb_parse_state::lwtype, lwtype_name(), POINTARRAY::npoints, ptarray_from_twkb_state(), SRID_UNKNOWN, and twkb_parse_state_uvarint().

Referenced by lwgeom_from_twkb_state(), and lwmultiline_from_twkb_state().

225 {
226  uint32_t npoints;
227  POINTARRAY *pa;
228 
229  LWDEBUG(2,"Entering lwline_from_twkb_state");
230 
231  if ( s->is_empty )
233 
234  /* Read number of points */
235  npoints = twkb_parse_state_uvarint(s);
236 
237  if ( npoints == 0 )
239 
240  /* Read coordinates */
241  pa = ptarray_from_twkb_state(s, npoints);
242 
243  if( pa == NULL )
245 
246  if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
247  {
248  lwerror("%s must have at least two points", lwtype_name(s->lwtype));
249  return NULL;
250  }
251 
252  return lwline_construct(SRID_UNKNOWN, NULL, pa);
253 }
uint8_t has_z
Definition: lwin_twkb.c:35
uint8_t is_empty
Definition: lwin_twkb.c:37
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
uint8_t has_m
Definition: lwin_twkb.c:36
uint32_t check
Definition: lwin_twkb.c:29
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
static POINTARRAY * ptarray_from_twkb_state(twkb_parse_state *s, uint32_t npoints)
POINTARRAY Read a dynamically sized point array and advance the parse state forward.
Definition: lwin_twkb.c:158
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
uint32_t lwtype
Definition: lwin_twkb.c:30
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:29
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
static uint64_t twkb_parse_state_uvarint(twkb_parse_state *s)
Definition: lwin_twkb.c:87
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: