PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ wkt_parser_polygon_finalize()

LWGEOM* wkt_parser_polygon_finalize ( LWGEOM poly,
char *  dimensionality 
)

Definition at line 521 of file lwin_wkt.c.

References LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, LW_FAILURE, LWDEBUG, lwgeom_free(), lwpoly_as_lwgeom(), lwpoly_construct_empty(), PARSER_ERROR_MIXDIMS, PARSER_ERROR_OTHER, SET_PARSER_ERROR, SRID_UNKNOWN, wkt_dimensionality(), and wkt_parser_set_dims().

Referenced by yyparse().

522 {
523  uint8_t flags = wkt_dimensionality(dimensionality);
524  int flagdims = FLAGS_NDIMS(flags);
525  LWDEBUG(4,"entered");
526 
527  /* Null input implies empty return */
528  if( ! poly )
530 
531  /* If the number of dimensions are not consistent, we have a problem. */
532  if( flagdims > 2 )
533  {
534  if ( flagdims != FLAGS_NDIMS(poly->flags) )
535  {
536  lwgeom_free(poly);
538  return NULL;
539  }
540 
541  /* Harmonize the flags in the sub-components with the wkt flags */
542  if( LW_FAILURE == wkt_parser_set_dims(poly, flags) )
543  {
544  lwgeom_free(poly);
546  return NULL;
547  }
548  }
549 
550  return poly;
551 }
static int wkt_parser_set_dims(LWGEOM *geom, uint8_t flags)
Force the dimensionality of a geometry to match the dimensionality of a set of flags (usually derived...
Definition: lwin_wkt.c:87
uint8_t flags
Definition: liblwgeom.h:381
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:1895
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:239
#define LW_FAILURE
Definition: liblwgeom.h:64
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 SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:66
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
#define PARSER_ERROR_OTHER
Definition: liblwgeom.h:1901
Here is the call graph for this function:
Here is the caller graph for this function: