PostGIS  2.2.7dev-r@@SVN_REVISION@@
LWGEOM* wkt_parser_compound_new ( LWGEOM geom)

Definition at line 710 of file lwin_wkt.c.

References COLLECTIONTYPE, lwalloc(), lwcollection_as_lwgeom(), lwcollection_construct(), LWDEBUG, lwgeom_free(), lwgeom_is_empty(), PARSER_ERROR_INCONTINUOUS, PARSER_ERROR_OTHER, SET_PARSER_ERROR, and SRID_UNKNOWN.

Referenced by yyparse().

711 {
712  LWCOLLECTION *col;
713  LWGEOM **geoms;
714  static int ngeoms = 1;
715  LWDEBUG(4,"entered");
716 
717  /* Toss error on null geometry input */
718  if( ! geom )
719  {
721  return NULL;
722  }
723 
724  /* Elements of a compoundcurve cannot be empty, because */
725  /* empty things can't join up and form a ring */
726  if ( lwgeom_is_empty(geom) )
727  {
728  lwgeom_free(geom);
730  return NULL;
731  }
732 
733  /* Create our geometry array */
734  geoms = lwalloc(sizeof(LWGEOM*) * ngeoms);
735  geoms[0] = geom;
736 
737  /* Make a new collection */
738  col = lwcollection_construct(COLLECTIONTYPE, SRID_UNKNOWN, NULL, ngeoms, geoms);
739 
740  /* Return the result. */
741  return lwcollection_as_lwgeom(col);
742 }
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
#define PARSER_ERROR_INCONTINUOUS
Definition: liblwgeom.h:1898
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
#define SET_PARSER_ERROR(errno)
Definition: lwin_wkt.c:38
void * lwalloc(size_t size)
Definition: lwutil.c:199
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1297
#define PARSER_ERROR_OTHER
Definition: liblwgeom.h:1901
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:219

Here is the call graph for this function:

Here is the caller graph for this function: