PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* wkt_parser_curvepolygon_finalize ( LWGEOM poly,
char *  dimensionality 
)

Definition at line 639 of file lwin_wkt.c.

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

Referenced by yyparse().

640 {
641  uint8_t flags = wkt_dimensionality(dimensionality);
642  int flagdims = FLAGS_NDIMS(flags);
643  LWDEBUG(4,"entered");
644 
645  /* Null input implies empty return */
646  if( ! poly )
648 
649  if ( flagdims > 2 )
650  {
651  /* If the number of dimensions are not consistent, we have a problem. */
652  if( flagdims != FLAGS_NDIMS(poly->flags) )
653  {
654  lwgeom_free(poly);
656  return NULL;
657  }
658 
659  /* Harmonize the flags in the sub-components with the wkt flags */
660  if( LW_FAILURE == wkt_parser_set_dims(poly, flags) )
661  {
662  lwgeom_free(poly);
664  return NULL;
665  }
666  }
667 
668  return poly;
669 }
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:353
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:1732
#define LW_FAILURE
Definition: liblwgeom.h:54
static uint8_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:61
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
LWCURVEPOLY * lwcurvepoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwcurvepoly.c:23
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
LWGEOM * lwcurvepoly_as_lwgeom(const LWCURVEPOLY *obj)
Definition: lwgeom.c:229
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:118
#define PARSER_ERROR_OTHER
Definition: liblwgeom.h:1738

Here is the call graph for this function:

Here is the caller graph for this function: