PostGIS  2.5.0dev-r@@SVN_REVISION@@
int lwcollection_allows_subtype ( int  collectiontype,
int  subtype 
)

Check if subtype is allowed in collectiontype.

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

521 {
522  if ( collectiontype == COLLECTIONTYPE )
523  return LW_TRUE;
524  if ( collectiontype == MULTIPOINTTYPE &&
525  subtype == POINTTYPE )
526  return LW_TRUE;
527  if ( collectiontype == MULTILINETYPE &&
528  subtype == LINETYPE )
529  return LW_TRUE;
530  if ( collectiontype == MULTIPOLYGONTYPE &&
531  subtype == POLYGONTYPE )
532  return LW_TRUE;
533  if ( collectiontype == COMPOUNDTYPE &&
534  (subtype == LINETYPE || subtype == CIRCSTRINGTYPE) )
535  return LW_TRUE;
536  if ( collectiontype == CURVEPOLYTYPE &&
537  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
538  return LW_TRUE;
539  if ( collectiontype == MULTICURVETYPE &&
540  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
541  return LW_TRUE;
542  if ( collectiontype == MULTISURFACETYPE &&
543  (subtype == POLYGONTYPE || subtype == CURVEPOLYTYPE) )
544  return LW_TRUE;
545  if ( collectiontype == POLYHEDRALSURFACETYPE &&
546  subtype == POLYGONTYPE )
547  return LW_TRUE;
548  if ( collectiontype == TINTYPE &&
549  subtype == TRIANGLETYPE )
550  return LW_TRUE;
551 
552  /* Must be a bad combination! */
553  return LW_FALSE;
554 }
#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: