PostGIS  2.3.6-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 320 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().

321 {
322  uint8_t flags = wkt_dimensionality(dimensionality);
323  LWDEBUG(4,"entered");
324 
325  /* No pointarray means it is empty */
326  if( ! pa )
328 
329  /* If the number of dimensions is not consistent, we have a problem. */
330  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
331  {
332  ptarray_free(pa);
334  return NULL;
335  }
336 
337  /* Only one point allowed in our point array! */
338  if( pa->npoints != 1 )
339  {
340  ptarray_free(pa);
342  return NULL;
343  }
344 
346 }
int npoints
Definition: liblwgeom.h:370
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:330
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:133
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2011
#define LW_FALSE
Definition: liblwgeom.h:76
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
#define PARSER_ERROR_LESSPOINTS
Definition: liblwgeom.h:2016
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:267
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:111
static int wkt_pointarray_dimensionality(POINTARRAY *pa, uint8_t flags)
Read the dimensionality from a flag, if provided.
Definition: lwin_wkt.c:183

Here is the call graph for this function:

Here is the caller graph for this function: