PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ lwcollection_allows_subtype()

int lwcollection_allows_subtype ( int  collectiontype,
int  subtype 
)

Check if subtype is allowed in collectiontype.

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

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