PostGIS  2.3.7dev-r@@SVN_REVISION@@
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.

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().

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 }
#define LINETYPE
Definition: liblwgeom.h:85
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:842
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define TRIANGLETYPE
Definition: liblwgeom.h:97
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:138
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:93
POINTARRAY ** rings
Definition: liblwgeom.h:456
static LISTNODE * prepend_node(void *g, LISTNODE *front)
Definition: lwiterator.c:53
int nrings
Definition: liblwgeom.h:454
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:102
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
Definition: lwgeom.c:111
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition: lwgeom.c:147
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102

Here is the call graph for this function:

Here is the caller graph for this function: