PostGIS  2.5.0dev-r@@SVN_REVISION@@
static int _lwt_EdgeRingIterator_next ( LWT_EDGERING_POINT_ITERATOR it,
POINT2D pt 
)
static

Definition at line 6276 of file lwgeom_topo.c.

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

6277 {
6278  LWT_EDGERING_ELEM *el = it->curelem;
6279  POINTARRAY *pa;
6280 
6281  if ( ! el ) return 0; /* finished */
6282 
6283  pa = el->edge->geom->points;
6284 
6285  int tonext = 0;
6286  LWDEBUGF(3, "iterator fetching idx %d from pa of %d points", it->curidx, pa->npoints);
6287  getPoint2d_p(pa, it->curidx, pt);
6288  if ( el->left ) {
6289  it->curidx++;
6290  if ( it->curidx >= (int) pa->npoints ) tonext = 1;
6291  } else {
6292  it->curidx--;
6293  if ( it->curidx < 0 ) tonext = 1;
6294  }
6295 
6296  if ( tonext )
6297  {
6298  LWDEBUG(3, "iterator moving to next element");
6299  it->curelemidx++;
6300  if ( it->curelemidx < it->ring->size )
6301  {
6302  el = it->curelem = it->ring->elems[it->curelemidx];
6303  it->curidx = el->left ? 0 : el->edge->geom->points->npoints - 1;
6304  }
6305  else
6306  {
6307  it->curelem = NULL;
6308  }
6309  }
6310 
6311  return 1;
6312 }
LWLINE * geom
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWT_ISO_EDGE * edge
Definition: lwgeom_topo.c:6181
LWT_EDGERING_ELEM ** elems
Definition: lwgeom_topo.c:6191
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:338
LWT_EDGERING_ELEM * curelem
Definition: lwgeom_topo.c:6270
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY * points
Definition: liblwgeom.h:421
uint32_t npoints
Definition: liblwgeom.h:370

Here is the call graph for this function:

Here is the caller graph for this function: