PostGIS  3.0.6dev-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 || lwcollection_is_empty(col))
81  return;
82 
83  for (i = 0; i < col->ngeoms; i++)
84  {
85  LWGEOM *geom = col->geoms[i];
86  switch (geom->type)
87  {
88  case POINTTYPE:
89  case LINETYPE:
90  case CIRCSTRINGTYPE:
91  case COMPOUNDTYPE:
92  case TRIANGLETYPE:
93  case CURVEPOLYTYPE:
94  case POLYGONTYPE:
95  /* Init if necessary */
96  if (!buffer->buf[geom->type])
97  {
100  bufcol->type = lwtype_get_collectiontype(geom->type);
101  buffer->buf[geom->type] = bufcol;
102  }
103  /* Add sub-geom to buffer */
104  lwcollection_add_lwgeom(buffer->buf[geom->type], lwgeom_clone(geom));
105  /* Increment count for this singleton type */
106  buffer->cnt[geom->type]++;
107  break;
108  default:
110  break;
111  }
112  }
113 }
uint32_t lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
Definition: lwgeom.c:1114
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define COMPOUNDTYPE
Definition: liblwgeom.h:124
#define CURVEPOLYTYPE
Definition: liblwgeom.h:125
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
#define POLYGONTYPE
Definition: liblwgeom.h:118
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:180
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:473
#define TRIANGLETYPE
Definition: liblwgeom.h:129
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:188
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:215
int lwcollection_is_empty(const LWCOLLECTION *col)
static void lwcollection_build_buffer(const LWCOLLECTION *col, HomogenizeBuffer *buffer)
Definition: lwhomogenize.c:76
Datum buffer(PG_FUNCTION_ARGS)
lwflags_t flags
Definition: liblwgeom.h:563
uint32_t ngeoms
Definition: liblwgeom.h:566
uint8_t type
Definition: liblwgeom.h:564
LWGEOM ** geoms
Definition: liblwgeom.h:561
int32_t srid
Definition: liblwgeom.h:562
uint8_t type
Definition: liblwgeom.h:448

References buffer(), CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::flags, FLAGS_GET_M, FLAGS_GET_Z, LWCOLLECTION::geoms, LINETYPE, lwcollection_add_lwgeom(), lwcollection_construct_empty(), lwcollection_is_empty(), lwgeom_as_lwcollection(), lwgeom_clone(), 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: