PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwpointiterator_advance()

static int lwpointiterator_advance ( LWPOINTITERATOR s)
static

Definition at line 152 of file lwiterator.c.

153 {
154  s->i += 1;
155 
156  /* We've reached the end of our current POINTARRAY. Try to see if there
157  * are any more POINTARRAYS on the stack. */
158  if (s->pointarrays && s->i >= ((POINTARRAY*) s->pointarrays->item)->npoints)
159  {
160  s->pointarrays = pop_node(s->pointarrays);
161  s->i = 0;
162  }
163 
164  /* We don't have a current POINTARRAY. Pull a geometry from the stack, and
165  * decompose it into its POINTARRARYs. */
166  if (!s->pointarrays)
167  {
168  LWGEOM* g;
170 
171  if (!s->geoms)
172  {
173  return LW_FAILURE;
174  }
175 
176  s->i = 0;
177  g = s->geoms->item;
178  s->pointarrays = extract_pointarrays_from_lwgeom(g);
179 
180  s->geoms = pop_node(s->geoms);
181  }
182 
183  if (!s->pointarrays)
184  {
185  return LW_FAILURE;
186  }
187  return LW_SUCCESS;
188 }
char * s
Definition: cu_in_wkt.c:23
#define LW_FAILURE
Definition: liblwgeom.h:110
#define LW_SUCCESS
Definition: liblwgeom.h:111
static LISTNODE * extract_pointarrays_from_lwgeom(LWGEOM *g)
Return a pointer to the first of one or more LISTNODEs holding the POINTARRAYs of a geometry.
Definition: lwiterator.c:84
static void unroll_collections(LWPOINTITERATOR *s)
Unroll LWCOLLECTIONs from the top of the stack, as necessary, until the element at the top of the sta...
Definition: lwiterator.c:143
static LISTNODE * pop_node(LISTNODE *i)
Definition: lwiterator.c:63

References extract_pointarrays_from_lwgeom(), LW_FAILURE, LW_SUCCESS, pop_node(), s, and unroll_collections().

Referenced by lwpointiterator_create_rw(), lwpointiterator_modify_next(), and lwpointiterator_next().

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