PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asx3d3_mline_coordindex_sb()

static int asx3d3_mline_coordindex_sb ( const LWMLINE mgeom,
stringbuffer_t sb 
)
static

if the linestring is closed, we put the start point index for the last vertex to denote use first point and don't increment the index

Definition at line 130 of file lwout_x3d.c.

131 {
132  LWLINE *geom;
133  uint32_t i, j, k, si;
134  POINTARRAY *pa;
135  uint32_t np;
136 
137  j = 0;
138  for (i=0; i < mgeom->ngeoms; i++)
139  {
140  geom = (LWLINE *) mgeom->geoms[i];
141  pa = geom->points;
142  np = pa->npoints;
143  si = j; /* start index of first point of linestring */
144  for (k=0; k < np ; k++)
145  {
146  if (k)
147  {
148  stringbuffer_aprintf(sb, " ");
149  }
153  if (!lwline_is_closed(geom) || k < (np -1) )
154  {
155  stringbuffer_aprintf(sb, "%u", j);
156  j += 1;
157  }
158  else
159  {
160  stringbuffer_aprintf(sb,"%u", si);
161  }
162  }
163  if (i < (mgeom->ngeoms - 1) )
164  {
165  stringbuffer_aprintf(sb, " -1 "); /* separator for each linestring */
166  }
167  }
168  return LW_SUCCESS;
169 }
#define LW_SUCCESS
Definition: liblwgeom.h:80
int lwline_is_closed(const LWLINE *line)
Definition: lwline.c:454
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
Definition: stringbuffer.c:253
POINTARRAY * points
Definition: liblwgeom.h:425
LWLINE ** geoms
Definition: liblwgeom.h:486
uint32_t ngeoms
Definition: liblwgeom.h:484
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

References LWMLINE::geoms, LW_SUCCESS, lwline_is_closed(), LWMLINE::ngeoms, POINTARRAY::npoints, LWLINE::points, and stringbuffer_aprintf().

Referenced by asx3d3_multi_sb().

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