PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ wkt_parser_compound_finalize()

LWGEOM* wkt_parser_compound_finalize ( LWGEOM col,
char *  dimensionality 
)

Definition at line 791 of file lwin_wkt.c.

792 {
793  lwflags_t flags = wkt_dimensionality(dimensionality);
794  int flagdims = FLAGS_NDIMS(flags);
795 
796  /* No geometry means it is empty */
797  if ( ! compound )
798  {
800  }
801 
802  if ( flagdims > 2 )
803  {
804  /* If the number of dimensions are not consistent, we have a problem. */
805  if( flagdims != FLAGS_NDIMS(compound->flags) )
806  {
807  lwgeom_free(compound);
809  return NULL;
810  }
811 
812  /* Harmonize the flags in the sub-components with the wkt flags */
813  if( LW_FAILURE == wkt_parser_set_dims(compound, flags) )
814  {
815  lwgeom_free(compound);
817  return NULL;
818  }
819  }
820  compound->type = COMPOUNDTYPE;
821  return compound;
822 }
#define PARSER_ERROR_MIXDIMS
Definition: liblwgeom.h:2172
LWGEOM * lwcompound_as_lwgeom(const LWCOMPOUND *obj)
Definition: lwgeom.c:324
#define COMPOUNDTYPE
Definition: liblwgeom.h:110
#define LW_FAILURE
Definition: liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1218
uint16_t lwflags_t
Definition: liblwgeom.h:299
#define PARSER_ERROR_OTHER
Definition: liblwgeom.h:2178
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:166
LWCOMPOUND * lwcompound_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwcompound.c:166
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:215
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:52
static int wkt_parser_set_dims(LWGEOM *geom, lwflags_t flags)
Force the dimensionality of a geometry to match the dimensionality of a set of flags (usually derived...
Definition: lwin_wkt.c:101
static lwflags_t wkt_dimensionality(char *dimensionality)
Definition: lwin_wkt.c:75

References COMPOUNDTYPE, LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, LW_FAILURE, lwcompound_as_lwgeom(), lwcompound_construct_empty(), lwgeom_free(), PARSER_ERROR_MIXDIMS, PARSER_ERROR_OTHER, SET_PARSER_ERROR, SRID_UNKNOWN, LWGEOM::type, wkt_dimensionality(), and wkt_parser_set_dims().

Here is the call graph for this function: