PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ extract_pointarrays_from_lwgeom()

static LISTNODE * extract_pointarrays_from_lwgeom ( LWGEOM g)
static

Return a pointer to the first of one or more LISTNODEs holding the POINTARRAYs of a geometry.

Will not handle GeometryCollections.

Definition at line 84 of file lwiterator.c.

85{
86 switch(lwgeom_get_type(g))
87 {
88 case POINTTYPE:
89 return prepend_node(lwgeom_as_lwpoint(g)->point, NULL);
90 case LINETYPE:
91 return prepend_node(lwgeom_as_lwline(g)->points, NULL);
92 case TRIANGLETYPE:
93 return prepend_node(lwgeom_as_lwtriangle(g)->points, NULL);
94 case CIRCSTRINGTYPE:
95 return prepend_node(lwgeom_as_lwcircstring(g)->points, NULL);
96 case POLYGONTYPE:
97 {
98 LISTNODE* n = NULL;
99
100 LWPOLY* p = lwgeom_as_lwpoly(g);
101 int i;
102 for (i = p->nrings - 1; i >= 0; i--)
103 n = prepend_node(p->rings[i], n);
104
105 return n;
106 }
107 default:
108 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(g->type));
109 }
110
111 return NULL;
112}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define LINETYPE
Definition liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition lwgeom.c:197
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition lwgeom.c:206
#define POLYGONTYPE
Definition liblwgeom.h:118
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
Definition lwgeom.c:170
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition lwgeom.c:161
#define TRIANGLETYPE
Definition liblwgeom.h:129
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition lwinline.h:135
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition lwinline.h:121
static LISTNODE * prepend_node(void *g, LISTNODE *front)
Definition lwiterator.c:53
uint8_t type
Definition liblwgeom.h:448
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510

References CIRCSTRINGTYPE, LINETYPE, lwerror(), lwgeom_as_lwcircstring(), lwgeom_as_lwline(), lwgeom_as_lwpoint(), lwgeom_as_lwpoly(), lwgeom_as_lwtriangle(), lwgeom_get_type(), lwtype_name(), LWPOLY::nrings, POINTTYPE, POLYGONTYPE, prepend_node(), LWPOLY::rings, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwpointiterator_advance().

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