PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ wkt_parser_point_new()

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:371
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:151
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2039
#define LW_FALSE
Definition: liblwgeom.h:77
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define PARSER_ERROR_LESSPOINTS
Definition: liblwgeom.h:2044
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:303
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
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
Here is the call graph for this function:
Here is the caller graph for this function: