PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ 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  {
104  n = prepend_node(p->rings[i], n);
105  }
106 
107  return n;
108  }
109  default:
110  lwerror("Unsupported geometry type for lwpointiterator");
111  }
112 
113  return NULL;
114 }
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:170
#define LINETYPE
Definition: liblwgeom.h:86
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:923
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:161
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition: lwgeom.c:215
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define TRIANGLETYPE
Definition: liblwgeom.h:98
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
Definition: lwgeom.c:179
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:206
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static LISTNODE * prepend_node(void *g, LISTNODE *front)
Definition: lwiterator.c:53
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458

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

Referenced by lwpointiterator_advance().

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