PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_allows_subtype()

int lwcollection_allows_subtype ( int  collectiontype,
int  subtype 
)

Check if subtype is allowed in collectiontype.

Definition at line 543 of file lwcollection.c.

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().

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