PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ wkt_parser_polygon_finalize()

LWGEOM* wkt_parser_polygon_finalize ( LWGEOM poly,
char *  dimensionality 
)

Definition at line 535 of file lwin_wkt.c.

536 {
537  uint8_t flags = wkt_dimensionality(dimensionality);
538  int flagdims = FLAGS_NDIMS(flags);
539  LWDEBUG(4,"entered");
540 
541  /* Null input implies empty return */
542  if( ! poly )
544 
545  /* If the number of dimensions are not consistent, we have a problem. */
546  if( flagdims > 2 )
547  {
548  if ( flagdims != FLAGS_NDIMS(poly->flags) )
549  {
550  lwgeom_free(poly);
552  return NULL;
553  }
554 
555  /* Harmonize the flags in the sub-components with the wkt flags */
556  if( LW_FAILURE == wkt_parser_set_dims(poly, flags) )
557  {
558  lwgeom_free(poly);
560  return NULL;
561  }
562  }
563 
564  return poly;
565 }
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2031
#define LW_FAILURE
Definition: liblwgeom.h:79
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:320
#define PARSER_ERROR_OTHER
Definition: liblwgeom.h:2037
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:161
#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_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:101
uint8_t flags
Definition: liblwgeom.h:400
unsigned char uint8_t
Definition: uthash.h:79

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

Here is the call graph for this function: