PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwcollection_allows_subtype()

int lwcollection_allows_subtype ( int  collectiontype,
int  subtype 
)

Check if subtype is allowed in collectiontype.

Definition at line 536 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().

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