PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpointiterator_advance()

static int lwpointiterator_advance ( LWPOINTITERATOR s)
static

Definition at line 154 of file lwiterator.c.

References extract_pointarrays_from_lwgeom(), LWPOINTITERATOR::geoms, LWPOINTITERATOR::i, LISTNODE::item, LW_FAILURE, LW_SUCCESS, LWPOINTITERATOR::pointarrays, pop_node(), and unroll_collections().

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

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  {
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;
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 }
LISTNODE * pointarrays
Definition: lwiterator.c:47
#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
#define LW_FAILURE
Definition: liblwgeom.h:79
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
LISTNODE * geoms
Definition: lwiterator.c:46
static LISTNODE * pop_node(LISTNODE *i)
Definition: lwiterator.c:63
uint32_t i
Definition: lwiterator.c:48
void * item
Definition: lwiterator.c:32
Here is the call graph for this function:
Here is the caller graph for this function: