PostGIS  2.2.7dev-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 306 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().

307 {
308  uint8_t flags = wkt_dimensionality(dimensionality);
309  LWDEBUG(4,"entered");
310 
311  /* No pointarray means it is empty */
312  if( ! pa )
314 
315  /* If the number of dimensions is not consistent, we have a problem. */
316  if( wkt_pointarray_dimensionality(pa, flags) == LW_FALSE )
317  {
318  ptarray_free(pa);
320  return NULL;
321  }
322 
323  /* Only one point allowed in our point array! */
324  if( pa->npoints != 1 )
325  {
326  ptarray_free(pa);
328  return NULL;
329  }
330 
332 }
int npoints
Definition: liblwgeom.h:355
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:330
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:120
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:1895
#define LW_FALSE
Definition: liblwgeom.h:62
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:61
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
#define PARSER_ERROR_LESSPOINTS
Definition: liblwgeom.h:1900
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:254
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:98
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: