PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ wkt_parser_linestring_new()

LWGEOM* wkt_parser_linestring_new ( POINTARRAY pa,
char *  dimensionality 

Create a new linestring.

Null point array implies empty. Null dimensionality implies no specified dimensionality in the WKT. Check for numpoints >= 2 if requested.

Definition at line 340 of file lwin_wkt.c.

References FLAGS_GET_M, FLAGS_GET_Z, global_parser_result, LW_FALSE, LW_PARSER_CHECK_MINPOINTS, LWDEBUG, lwline_as_lwgeom(), lwline_construct(), lwline_construct_empty(), POINTARRAY::npoints, struct_lwgeom_parser_result::parser_check_flags, PARSER_ERROR_MIXDIMS, PARSER_ERROR_MOREPOINTS, ptarray_free(), SET_PARSER_ERROR, SRID_UNKNOWN, wkt_dimensionality(), and wkt_pointarray_dimensionality().

Referenced by yyparse().

341 {
342  uint8_t flags = wkt_dimensionality(dimensionality);
343  LWDEBUG(4,"entered");
345  /* No pointarray means it is empty */
346  if( ! pa )
349  /* If the number of dimensions is not consistent, we have a problem. */
350  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
351  {
352  ptarray_free(pa);
354  return NULL;
355  }
357  /* Apply check for not enough points, if requested. */
359  {
360  ptarray_free(pa);
362  return NULL;
363  }
366 }
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
Definition: lwline.c:51
int npoints
Definition: liblwgeom.h:355
Parser check flags.
Definition: liblwgeom.h:1864
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:330
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWGEOM_PARSER_RESULT global_parser_result
Definition: liblwgeom.h:1895
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:249
#define LW_FALSE
Definition: liblwgeom.h:62
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:29
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:61
Unknown SRID value.
Definition: liblwgeom.h:172
Definition: liblwgeom.h:1892
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
static int wkt_pointarray_dimensionality(POINTARRAY *pa, uint8_t flags)
Read the dimensionality from a flag, if provided.
Definition: lwin_wkt.c:169
Here is the call graph for this function:
Here is the caller graph for this function: