PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ _lwt_EdgeRingIterator_next()

static int _lwt_EdgeRingIterator_next ( LWT_EDGERING_POINT_ITERATOR it,
POINT2D pt 
)
static

Definition at line 167 of file lwgeom_topo_polygonizer.c.

168 {
169  LWT_EDGERING_ELEM *el = it->curelem;
170  POINTARRAY *pa;
171 
172  if ( ! el ) return 0; /* finished */
173 
174  pa = el->edge->geom->points;
175 
176  int tonext = 0;
177  LWDEBUGF(3, "iterator fetching idx %d from pa of %d points", it->curidx, pa->npoints);
178  getPoint2d_p(pa, it->curidx, pt);
179  if ( el->left ) {
180  it->curidx++;
181  if ( it->curidx >= (int) pa->npoints ) tonext = 1;
182  } else {
183  it->curidx--;
184  if ( it->curidx < 0 ) tonext = 1;
185  }
186 
187  if ( tonext )
188  {
189  LWDEBUG(3, "iterator moving to next element");
190  it->curelemidx++;
191  if ( it->curelemidx < it->ring->size )
192  {
193  el = it->curelem = it->ring->elems[it->curelemidx];
194  it->curidx = el->left ? 0 : el->edge->geom->points->npoints - 1;
195  }
196  else
197  {
198  it->curelem = NULL;
199  }
200  }
201 
202  return 1;
203 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:342
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:101
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
POINTARRAY * points
Definition: liblwgeom.h:483
LWT_EDGERING_ELEM ** elems
LWLINE * geom
uint32_t npoints
Definition: liblwgeom.h:427

References LWT_EDGERING_POINT_ITERATOR_T::curelem, LWT_EDGERING_POINT_ITERATOR_T::curelemidx, LWT_EDGERING_POINT_ITERATOR_T::curidx, LWT_EDGERING_ELEM_T::edge, LWT_EDGERING_T::elems, LWT_ISO_EDGE::geom, getPoint2d_p(), LWT_EDGERING_ELEM_T::left, LWDEBUG, LWDEBUGF, POINTARRAY::npoints, LWLINE::points, LWT_EDGERING_POINT_ITERATOR_T::ring, and LWT_EDGERING_T::size.

Referenced by _lwt_EdgeRingCrossingCount(), and _lwt_EdgeRingSignedArea().

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