PostGIS  2.2.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 523 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().

524 {
525  if ( collectiontype == COLLECTIONTYPE )
526  return LW_TRUE;
527  if ( collectiontype == MULTIPOINTTYPE &&
528  subtype == POINTTYPE )
529  return LW_TRUE;
530  if ( collectiontype == MULTILINETYPE &&
531  subtype == LINETYPE )
532  return LW_TRUE;
533  if ( collectiontype == MULTIPOLYGONTYPE &&
534  subtype == POLYGONTYPE )
535  return LW_TRUE;
536  if ( collectiontype == COMPOUNDTYPE &&
537  (subtype == LINETYPE || subtype == CIRCSTRINGTYPE) )
538  return LW_TRUE;
539  if ( collectiontype == CURVEPOLYTYPE &&
540  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
541  return LW_TRUE;
542  if ( collectiontype == MULTICURVETYPE &&
543  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
544  return LW_TRUE;
545  if ( collectiontype == MULTISURFACETYPE &&
546  (subtype == POLYGONTYPE || subtype == CURVEPOLYTYPE) )
547  return LW_TRUE;
548  if ( collectiontype == POLYHEDRALSURFACETYPE &&
549  subtype == POLYGONTYPE )
550  return LW_TRUE;
551  if ( collectiontype == TINTYPE &&
552  subtype == TRIANGLETYPE )
553  return LW_TRUE;
554 
555  /* Must be a bad combination! */
556  return LW_FALSE;
557 }
#define LINETYPE
Definition: liblwgeom.h:71
#define MULTICURVETYPE
Definition: liblwgeom.h:80
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
#define TINTYPE
Definition: liblwgeom.h:84
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the caller graph for this function: