PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ _lwt_EdgeRingIterator_next()

static int _lwt_EdgeRingIterator_next ( LWT_EDGERING_POINT_ITERATOR it,
POINT2D pt 
)
static

Definition at line 6204 of file lwgeom_topo.c.

6205 {
6206  LWT_EDGERING_ELEM *el = it->curelem;
6207  POINTARRAY *pa;
6208 
6209  if ( ! el ) return 0; /* finished */
6210 
6211  pa = el->edge->geom->points;
6212 
6213  int tonext = 0;
6214  LWDEBUGF(3, "iterator fetching idx %d from pa of %d points", it->curidx, pa->npoints);
6215  getPoint2d_p(pa, it->curidx, pt);
6216  if ( el->left ) {
6217  it->curidx++;
6218  if ( it->curidx >= (int) pa->npoints ) tonext = 1;
6219  } else {
6220  it->curidx--;
6221  if ( it->curidx < 0 ) tonext = 1;
6222  }
6223 
6224  if ( tonext )
6225  {
6226  LWDEBUG(3, "iterator moving to next element");
6227  it->curelemidx++;
6228  if ( it->curelemidx < it->ring->size )
6229  {
6230  el = it->curelem = it->ring->elems[it->curelemidx];
6231  it->curidx = el->left ? 0 : el->edge->geom->points->npoints - 1;
6232  }
6233  else
6234  {
6235  it->curelem = NULL;
6236  }
6237  }
6238 
6239  return 1;
6240 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:343
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY * points
Definition: liblwgeom.h:497
LWT_ISO_EDGE * edge
Definition: lwgeom_topo.c:6109
LWT_EDGERING_ELEM * curelem
Definition: lwgeom_topo.c:6198
LWT_EDGERING_ELEM ** elems
Definition: lwgeom_topo.c:6119
LWLINE * geom
uint32_t npoints
Definition: liblwgeom.h:441

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: