PostGIS  2.5.7dev-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.

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 }
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2031
#define LW_FALSE
Definition: liblwgeom.h:77
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:335
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
#define PARSER_ERROR_LESSPOINTS
Definition: liblwgeom.h:2036
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:151
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
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:374
unsigned char uint8_t
Definition: uthash.h:79

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().

Here is the call graph for this function: