PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ wkt_parser_compound_new()

LWGEOM * wkt_parser_compound_new ( LWGEOM geom)

Definition at line 724 of file lwin_wkt.c.

725{
726 LWCOLLECTION *col;
727 LWGEOM **geoms;
728 static int ngeoms = 1;
729 LWDEBUG(4,"entered");
730
731 /* Toss error on null geometry input */
732 if( ! geom )
733 {
735 return NULL;
736 }
737
738 /* Elements of a compoundcurve cannot be empty, because */
739 /* empty things can't join up and form a ring */
740 if ( lwgeom_is_empty(geom) )
741 {
742 lwgeom_free(geom);
744 return NULL;
745 }
746
747 /* Create our geometry array */
748 geoms = lwalloc(sizeof(LWGEOM*) * ngeoms);
749 geoms[0] = geom;
750
751 /* Make a new collection */
752 col = lwcollection_construct(COLLECTIONTYPE, SRID_UNKNOWN, NULL, ngeoms, geoms);
753
754 /* Return the result. */
755 return lwcollection_as_lwgeom(col);
756}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define COLLECTIONTYPE
Definition liblwgeom.h:108
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define PARSER_ERROR_INCONTINUOUS
Definition liblwgeom.h:2178
#define PARSER_ERROR_OTHER
Definition liblwgeom.h:2181
void * lwalloc(size_t size)
Definition lwutil.c:227
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition lwgeom.c:337
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
#define SET_PARSER_ERROR(errno)
Definition lwin_wkt.c:52
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:199

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.

Here is the call graph for this function: