PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ _lwt_BuildEdgeRing()

static LWT_EDGERING* _lwt_BuildEdgeRing ( __attribute__((__unused__)) LWT_TOPOLOGY topo,
LWT_ISO_EDGE_TABLE edges,
LWT_ISO_EDGE edge,
int  side 
)
static

Definition at line 6259 of file lwgeom_topo.c.

6261 {
6262  LWT_EDGERING *ring;
6263  LWT_EDGERING_ELEM *elem;
6264  LWT_ISO_EDGE *cur;
6265  int curside;
6266 
6267  ring = lwalloc(sizeof(LWT_EDGERING));
6268  LWT_EDGERING_INIT(ring);
6269 
6270  cur = edge;
6271  curside = side;
6272 
6273  LWDEBUGF(2, "Building rings for edge %d (side %d)", cur->edge_id, side);
6274 
6275  do {
6276  LWT_ELEMID next;
6277 
6278  elem = lwalloc(sizeof(LWT_EDGERING_ELEM));
6279  elem->edge = cur;
6280  elem->left = ( curside == 1 );
6281 
6282  /* Mark edge as "visited" */
6283  if ( elem->left ) cur->face_left = LWT_HOLES_FACE_PLACEHOLDER;
6284  else cur->face_right = LWT_HOLES_FACE_PLACEHOLDER;
6285 
6286  LWT_EDGERING_PUSH(ring, elem);
6287  next = elem->left ? cur->next_left : cur->next_right;
6288 
6289  LWDEBUGF(3, " next edge is %d", next);
6290 
6291  if ( next > 0 ) curside = 1;
6292  else { curside = -1; next = -next; }
6293  cur = _lwt_getIsoEdgeById(edges, next);
6294  if ( ! cur )
6295  {
6296  lwerror("Could not find edge with id %d", next);
6297  break;
6298  }
6299  } while (cur != edge || curside != side);
6300 
6301  LWDEBUGF(1, "Ring for edge %d has %d elems", edge->edge_id*side, ring->size);
6302 
6303  return ring;
6304 }
void * lwalloc(size_t size)
Definition: lwutil.c:229
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define LWT_EDGERING_INIT(a)
Definition: lwgeom_topo.c:5999
#define LWT_HOLES_FACE_PLACEHOLDER
Definition: lwgeom_topo.c:6127
static LWT_ISO_EDGE * _lwt_getIsoEdgeById(LWT_ISO_EDGE_TABLE *tab, LWT_ELEMID id)
Definition: lwgeom_topo.c:5966
#define LWT_EDGERING_PUSH(a, r)
Definition: lwgeom_topo.c:6007
LWT_ISO_EDGE * edge
Definition: lwgeom_topo.c:5979
LWT_ELEMID edge_id

References _lwt_getIsoEdgeById(), rtgdalraster::cur, LWT_EDGERING_ELEM_T::edge, LWT_ISO_EDGE::edge_id, LWT_EDGERING_ELEM_T::left, lwalloc(), LWDEBUGF, lwerror(), LWT_EDGERING_INIT, LWT_EDGERING_PUSH, LWT_HOLES_FACE_PLACEHOLDER, and LWT_EDGERING_T::size.

Referenced by _lwt_RegisterFaceOnEdgeSide().

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