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

◆ extract_pointarrays_from_lwgeom()

static LISTNODE * extract_pointarrays_from_lwgeom ( const 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:103
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition lwgeom.c:243
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition lwgeom.c:252
#define POLYGONTYPE
Definition liblwgeom.h:104
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
Definition lwgeom.c:216
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition lwgeom.c:207
#define TRIANGLETYPE
Definition liblwgeom.h:115
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition lwinline.h:141
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition lwinline.h:127
static LISTNODE * prepend_node(const void *g, LISTNODE *front)
Definition lwiterator.c:53
uint8_t type
Definition liblwgeom.h:462
POINTARRAY ** rings
Definition liblwgeom.h:519
uint32_t nrings
Definition liblwgeom.h:524

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: