PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwpointiterator_advance()

static int lwpointiterator_advance ( LWPOINTITERATOR s)
static

Definition at line 154 of file lwiterator.c.

155 {
156  s->i += 1;
157 
158  /* We've reached the end of our current POINTARRAY. Try to see if there
159  * are any more POINTARRAYS on the stack. */
160  if (s->pointarrays && s->i >= ((POINTARRAY*) s->pointarrays->item)->npoints)
161  {
162  s->pointarrays = pop_node(s->pointarrays);
163  s->i = 0;
164  }
165 
166  /* We don't have a current POINTARRAY. Pull a geometry from the stack, and
167  * decompose it into its POINTARRARYs. */
168  if (!s->pointarrays)
169  {
170  LWGEOM* g;
172 
173  if (!s->geoms)
174  {
175  return LW_FAILURE;
176  }
177 
178  s->i = 0;
179  g = s->geoms->item;
180  s->pointarrays = extract_pointarrays_from_lwgeom(g);
181 
182  s->geoms = pop_node(s->geoms);
183  }
184 
185  if (!s->pointarrays)
186  {
187  return LW_FAILURE;
188  }
189  return LW_SUCCESS;
190 }
char * s
Definition: cu_in_wkt.c:23
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
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:145
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: