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

Check if subtype is allowed in collectiontype.

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

514 {
515  if ( collectiontype == COLLECTIONTYPE )
516  return LW_TRUE;
517  if ( collectiontype == MULTIPOINTTYPE &&
518  subtype == POINTTYPE )
519  return LW_TRUE;
520  if ( collectiontype == MULTILINETYPE &&
521  subtype == LINETYPE )
522  return LW_TRUE;
523  if ( collectiontype == MULTIPOLYGONTYPE &&
524  subtype == POLYGONTYPE )
525  return LW_TRUE;
526  if ( collectiontype == COMPOUNDTYPE &&
527  (subtype == LINETYPE || subtype == CIRCSTRINGTYPE) )
528  return LW_TRUE;
529  if ( collectiontype == CURVEPOLYTYPE &&
530  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
531  return LW_TRUE;
532  if ( collectiontype == MULTICURVETYPE &&
533  (subtype == CIRCSTRINGTYPE || subtype == LINETYPE || subtype == COMPOUNDTYPE) )
534  return LW_TRUE;
535  if ( collectiontype == MULTISURFACETYPE &&
536  (subtype == POLYGONTYPE || subtype == CURVEPOLYTYPE) )
537  return LW_TRUE;
538  if ( collectiontype == POLYHEDRALSURFACETYPE &&
539  subtype == POLYGONTYPE )
540  return LW_TRUE;
541  if ( collectiontype == TINTYPE &&
542  subtype == TRIANGLETYPE )
543  return LW_TRUE;
544 
545  /* Must be a bad combination! */
546  return LW_FALSE;
547 }
#define LINETYPE
Definition: liblwgeom.h:61
#define MULTICURVETYPE
Definition: liblwgeom.h:70
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
#define TINTYPE
Definition: liblwgeom.h:74
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the caller graph for this function: