PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM* wkt_parser_circularstring_new ( POINTARRAY pa,
char *  dimensionality 

Create a new circularstring.

Null point array implies empty. Null dimensionality implies no specified dimensionality in the WKT. Circular strings are just like linestrings, except with slighty different validity rules (minpoint == 3, numpoints % 2 == 1).

Definition at line 388 of file lwin_wkt.c.

References FLAGS_GET_M, FLAGS_GET_Z, global_parser_result, LW_FALSE, LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD, lwcircstring_as_lwgeom(), lwcircstring_construct(), lwcircstring_construct_empty(), LWDEBUG, POINTARRAY::npoints, struct_lwgeom_parser_result::parser_check_flags, PARSER_ERROR_MIXDIMS, PARSER_ERROR_MOREPOINTS, PARSER_ERROR_ODDPOINTS, ptarray_free(), SET_PARSER_ERROR, SRID_UNKNOWN, wkt_dimensionality(), and wkt_pointarray_dimensionality().

Referenced by yyparse().

389 {
390  uint8_t flags = wkt_dimensionality(dimensionality);
391  LWDEBUG(4,"entered");
393  /* No pointarray means it is empty */
394  if( ! pa )
397  /* If the number of dimensions is not consistent, we have a problem. */
398  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
399  {
400  ptarray_free(pa);
402  return NULL;
403  }
405  /* Apply check for not enough points, if requested. */
407  {
408  ptarray_free(pa);
410  return NULL;
411  }
413  /* Apply check for odd number of points, if requested. */
415  {
416  ptarray_free(pa);
418  return NULL;
419  }
422 }
Parser check flags.
Definition: liblwgeom.h:1993
LWGEOM * lwcircstring_as_lwgeom(const LWCIRCSTRING *obj)
Definition: lwgeom.c:304
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM_PARSER_RESULT global_parser_result
Definition: liblwgeom.h:2024
Definition: liblwgeom.h:1994
LWCIRCSTRING * lwcircstring_construct_empty(int srid, char hasz, char hasm)
Definition: lwcircstring.c:79
#define LW_FALSE
Definition: liblwgeom.h:76
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75
Unknown SRID value.
Definition: liblwgeom.h:187
Definition: liblwgeom.h:2021
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
LWCIRCSTRING * lwcircstring_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwcircstring.c:50
Definition: liblwgeom.h:2022
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
unsigned char uint8_t
Definition: uthash.h:79
static int wkt_pointarray_dimensionality(POINTARRAY *pa, uint8_t flags)
Read the dimensionality from a flag, if provided.
Definition: lwin_wkt.c:183
uint32_t npoints
Definition: liblwgeom.h:370

Here is the call graph for this function:

Here is the caller graph for this function: