PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* wkt_parser_point_new ( POINTARRAY pa,
char *  dimensionality 

Create a new point.

Null point array implies empty. Null dimensionality implies no specified dimensionality in the WKT.

Definition at line 293 of file lwin_wkt.c.

References FLAGS_GET_M, FLAGS_GET_Z, LW_FALSE, LWDEBUG, lwpoint_as_lwgeom(), lwpoint_construct(), lwpoint_construct_empty(), POINTARRAY::npoints, PARSER_ERROR_LESSPOINTS, PARSER_ERROR_MIXDIMS, ptarray_free(), SET_PARSER_ERROR, SRID_UNKNOWN, wkt_dimensionality(), and wkt_pointarray_dimensionality().

Referenced by yyparse().

294 {
295  uint8_t flags = wkt_dimensionality(dimensionality);
296  LWDEBUG(4,"entered");
298  /* No pointarray means it is empty */
299  if( ! pa )
302  /* If the number of dimensions is not consistent, we have a problem. */
303  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
304  {
305  ptarray_free(pa);
307  return NULL;
308  }
310  /* Only one point allowed in our point array! */
311  if( pa->npoints != 1 )
312  {
313  ptarray_free(pa);
315  return NULL;
316  }
319 }
int npoints
Definition: liblwgeom.h:327
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:315
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:118
Definition: liblwgeom.h:1732
#define LW_FALSE
Definition: liblwgeom.h:52
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:61
Unknown SRID value.
Definition: liblwgeom.h:154
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
Definition: liblwgeom.h:1737
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:254
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:96
static int wkt_pointarray_dimensionality(POINTARRAY *pa, uint8_t flags)
Read the dimensionality from a flag, if provided.
Definition: lwin_wkt.c:156

Here is the call graph for this function:

Here is the caller graph for this function: