PostGIS  2.5.7dev-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 354 of file lwin_wkt.c.

355 {
356  uint8_t flags = wkt_dimensionality(dimensionality);
357  LWDEBUG(4,"entered");
358 
359  /* No pointarray means it is empty */
360  if( ! pa )
362 
363  /* If the number of dimensions is not consistent, we have a problem. */
364  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
365  {
366  ptarray_free(pa);
368  return NULL;
369  }
370 
371  /* Apply check for not enough points, if requested. */
373  {
374  ptarray_free(pa);
376  return NULL;
377  }
378 
380 }
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2031
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:330
#define LW_FALSE
Definition: liblwgeom.h:77
#define PARSER_ERROR_MOREPOINTS
Definition: liblwgeom.h:2028
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
Definition: lwline.c:64
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
#define LW_PARSER_CHECK_MINPOINTS
Parser check flags.
Definition: liblwgeom.h:2000
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
static int wkt_pointarray_dimensionality(POINTARRAY *pa, uint8_t flags)
Read the dimensionality from a flag, if provided.
Definition: lwin_wkt.c:183
LWGEOM_PARSER_RESULT global_parser_result
uint32_t npoints
Definition: liblwgeom.h:374
unsigned char uint8_t
Definition: uthash.h:79

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().

Here is the call graph for this function: