PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ _lwt_EdgeRingIterator_next()

static int _lwt_EdgeRingIterator_next ( LWT_EDGERING_POINT_ITERATOR it,
POINT2D pt 
)
static

Definition at line 6133 of file lwgeom_topo.c.

6134 {
6135  LWT_EDGERING_ELEM *el = it->curelem;
6136  POINTARRAY *pa;
6137 
6138  if ( ! el ) return 0; /* finished */
6139 
6140  pa = el->edge->geom->points;
6141 
6142  int tonext = 0;
6143  LWDEBUGF(3, "iterator fetching idx %d from pa of %d points", it->curidx, pa->npoints);
6144  getPoint2d_p(pa, it->curidx, pt);
6145  if ( el->left ) {
6146  it->curidx++;
6147  if ( it->curidx >= (int) pa->npoints ) tonext = 1;
6148  } else {
6149  it->curidx--;
6150  if ( it->curidx < 0 ) tonext = 1;
6151  }
6152 
6153  if ( tonext )
6154  {
6155  LWDEBUG(3, "iterator moving to next element");
6156  it->curelemidx++;
6157  if ( it->curelemidx < it->ring->size )
6158  {
6159  el = it->curelem = it->ring->elems[it->curelemidx];
6160  it->curidx = el->left ? 0 : el->edge->geom->points->npoints - 1;
6161  }
6162  else
6163  {
6164  it->curelem = NULL;
6165  }
6166  }
6167 
6168  return 1;
6169 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:349
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY * points
Definition: liblwgeom.h:469
LWT_ISO_EDGE * edge
Definition: lwgeom_topo.c:6038
LWT_EDGERING_ELEM * curelem
Definition: lwgeom_topo.c:6127
LWT_EDGERING_ELEM ** elems
Definition: lwgeom_topo.c:6048
LWLINE * geom
uint32_t npoints
Definition: liblwgeom.h:413

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: