PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void lwcollection_build_buffer ( const LWCOLLECTION col,
HomogenizeBuffer buffer 
)
static

Definition at line 63 of file lwhomogenize.c.

References HomogenizeBuffer::buf, CIRCSTRINGTYPE, HomogenizeBuffer::cnt, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::flags, FLAGS_GET_M, FLAGS_GET_Z, LWCOLLECTION::geoms, LINETYPE, lwcollection_add_lwgeom(), lwcollection_as_lwgeom(), lwcollection_construct_empty(), lwgeom_as_lwcollection(), lwgeom_clone(), lwgeom_is_empty(), lwtype_get_collectiontype(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, LWCOLLECTION::srid, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by lwcollection_homogenize().

64 {
65  int i;
66 
67  if ( ! col ) return;
68  if ( lwgeom_is_empty(lwcollection_as_lwgeom(col)) ) return;
69  for ( i = 0; i < col->ngeoms; i++ )
70  {
71  LWGEOM *geom = col->geoms[i];
72  switch(geom->type)
73  {
74  case POINTTYPE:
75  case LINETYPE:
76  case CIRCSTRINGTYPE:
77  case COMPOUNDTYPE:
78  case TRIANGLETYPE:
79  case CURVEPOLYTYPE:
80  case POLYGONTYPE:
81  {
82  /* Init if necessary */
83  if ( ! buffer->buf[geom->type] )
84  {
86  bufcol->type = lwtype_get_collectiontype(geom->type);
87  buffer->buf[geom->type] = bufcol;
88  }
89  /* Add sub-geom to buffer */
90  lwcollection_add_lwgeom(buffer->buf[geom->type], lwgeom_clone(geom));
91  /* Increment count for this singleton type */
92  buffer->cnt[geom->type] = buffer->cnt[geom->type] + 1;
93  }
94  default:
95  {
97  }
98  }
99  }
100  return;
101 }
#define LINETYPE
Definition: liblwgeom.h:61
int lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
Definition: lwgeom.c:982
uint8_t type
Definition: liblwgeom.h:459
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define TRIANGLETYPE
Definition: liblwgeom.h:73
int cnt[NUMTYPES]
Definition: lwhomogenize.c:19
uint8_t flags
Definition: liblwgeom.h:460
LWGEOM * geom
LWGEOM ** geoms
Definition: liblwgeom.h:465
LWCOLLECTION * buf[NUMTYPES]
Definition: lwhomogenize.c:20
int32_t srid
Definition: liblwgeom.h:462
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:351
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:143
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1229
static void lwcollection_build_buffer(const LWCOLLECTION *col, HomogenizeBuffer *buffer)
Definition: lwhomogenize.c:63
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:174
#define COLLECTIONTYPE
Definition: liblwgeom.h:66
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:219

Here is the call graph for this function:

Here is the caller graph for this function: