PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_allows_subtype()

int lwcollection_allows_subtype ( int  collectiontype,
int  subtype 
)

Check if subtype is allowed in collectiontype.

Definition at line 534 of file lwcollection.c.

535 {
536  if ( collectiontype == COLLECTIONTYPE )
537  return LW_TRUE;
538  if ( collectiontype == MULTIPOINTTYPE &&
539  subtype == POINTTYPE )
540  return LW_TRUE;
541  if ( collectiontype == MULTILINETYPE &&
542  subtype == LINETYPE )
543  return LW_TRUE;
544  if ( collectiontype == MULTIPOLYGONTYPE &&
545  subtype == POLYGONTYPE )
546  return LW_TRUE;
547  if ( collectiontype == COMPOUNDTYPE &&
548  (subtype == LINETYPE || subtype == CIRCSTRINGTYPE) )
549  return LW_TRUE;
550  if ( collectiontype == CURVEPOLYTYPE &&
551  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
552  return LW_TRUE;
553  if ( collectiontype == MULTICURVETYPE &&
554  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
555  return LW_TRUE;
556  if ( collectiontype == MULTISURFACETYPE &&
557  (subtype == POLYGONTYPE || subtype == CURVEPOLYTYPE) )
558  return LW_TRUE;
559  if ( collectiontype == POLYHEDRALSURFACETYPE &&
560  subtype == POLYGONTYPE )
561  return LW_TRUE;
562  if ( collectiontype == TINTYPE &&
563  subtype == TRIANGLETYPE )
564  return LW_TRUE;
565 
566  /* Must be a bad combination! */
567  return LW_FALSE;
568 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, LW_FALSE, LW_TRUE, MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, and TRIANGLETYPE.

Referenced by lwcollection_add_lwgeom(), and lwcollection_from_gserialized_buffer().

Here is the caller graph for this function: