PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ _lwt_EdgeRingIterator_next()

static int _lwt_EdgeRingIterator_next ( LWT_EDGERING_POINT_ITERATOR it,
POINT2D pt 
)
static

Definition at line 6074 of file lwgeom_topo.c.

6075 {
6076  LWT_EDGERING_ELEM *el = it->curelem;
6077  POINTARRAY *pa;
6078 
6079  if ( ! el ) return 0; /* finished */
6080 
6081  pa = el->edge->geom->points;
6082 
6083  int tonext = 0;
6084  LWDEBUGF(3, "iterator fetching idx %d from pa of %d points", it->curidx, pa->npoints);
6085  getPoint2d_p(pa, it->curidx, pt);
6086  if ( el->left ) {
6087  it->curidx++;
6088  if ( it->curidx >= (int) pa->npoints ) tonext = 1;
6089  } else {
6090  it->curidx--;
6091  if ( it->curidx < 0 ) tonext = 1;
6092  }
6093 
6094  if ( tonext )
6095  {
6096  LWDEBUG(3, "iterator moving to next element");
6097  it->curelemidx++;
6098  if ( it->curelemidx < it->ring->size )
6099  {
6100  el = it->curelem = it->ring->elems[it->curelemidx];
6101  it->curidx = el->left ? 0 : el->edge->geom->points->npoints - 1;
6102  }
6103  else
6104  {
6105  it->curelem = NULL;
6106  }
6107  }
6108 
6109  return 1;
6110 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:348
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY * points
Definition: liblwgeom.h:425
LWT_ISO_EDGE * edge
Definition: lwgeom_topo.c:5979
LWT_EDGERING_ELEM * curelem
Definition: lwgeom_topo.c:6068
LWT_EDGERING_ELEM ** elems
Definition: lwgeom_topo.c:5989
LWLINE * geom
uint32_t npoints
Definition: liblwgeom.h:374

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: