PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_build_buffer()

static void lwcollection_build_buffer ( const LWCOLLECTION col,
HomogenizeBuffer buffer 
)
static

Definition at line 76 of file lwhomogenize.c.

77 {
78  uint32_t i;
79 
80  if ( ! col ) return;
81  if ( lwgeom_is_empty(lwcollection_as_lwgeom(col)) ) return;
82  for ( i = 0; i < col->ngeoms; i++ )
83  {
84  LWGEOM *geom = col->geoms[i];
85  switch(geom->type)
86  {
87  case POINTTYPE:
88  case LINETYPE:
89  case CIRCSTRINGTYPE:
90  case COMPOUNDTYPE:
91  case TRIANGLETYPE:
92  case CURVEPOLYTYPE:
93  case POLYGONTYPE:
94  {
95  /* Init if necessary */
96  if ( ! buffer->buf[geom->type] )
97  {
99  bufcol->type = lwtype_get_collectiontype(geom->type);
100  buffer->buf[geom->type] = bufcol;
101  }
102  /* Add sub-geom to buffer */
103  lwcollection_add_lwgeom(buffer->buf[geom->type], lwgeom_clone(geom));
104  /* Increment count for this singleton type */
105  buffer->cnt[geom->type] = buffer->cnt[geom->type] + 1;
106  }
107  /* FALLTHROUGH */
108  default:
109  {
111  break;
112  }
113  }
114  }
115  return;
116 }
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:300
uint32_t lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
Definition: lwgeom.c:1120
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define LINETYPE
Definition: liblwgeom.h:86
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
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:1393
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:482
#define TRIANGLETYPE
Definition: liblwgeom.h:98
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:224
static void lwcollection_build_buffer(const LWCOLLECTION *col, HomogenizeBuffer *buffer)
Definition: lwhomogenize.c:76
Datum buffer(PG_FUNCTION_ARGS)
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t type
Definition: liblwgeom.h:506
uint8_t flags
Definition: liblwgeom.h:507
LWGEOM ** geoms
Definition: liblwgeom.h:512
int32_t srid
Definition: liblwgeom.h:509
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

References buffer(), CIRCSTRINGTYPE, 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().

Here is the call graph for this function:
Here is the caller graph for this function: