PostGIS  2.5.1dev-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.

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

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 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: