PostGIS  2.3.7dev-r@@SVN_REVISION@@
static size_t asx3d3_mline_coordindex ( const LWMLINE mgeom,
char *  output 
)
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 219 of file lwout_x3d.c.

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

Referenced by asx3d3_multi_buf().

220 {
221  char *ptr=output;
222  LWLINE *geom;
223  int i, j, k, si;
224  POINTARRAY *pa;
225  int np;
226 
227  j = 0;
228  for (i=0; i < mgeom->ngeoms; i++)
229  {
230  geom = (LWLINE *) mgeom->geoms[i];
231  pa = geom->points;
232  np = pa->npoints;
233  si = j; /* start index of first point of linestring */
234  for (k=0; k < np ; k++)
235  {
236  if (k)
237  {
238  ptr += sprintf(ptr, " ");
239  }
243  if (!lwline_is_closed(geom) || k < (np -1) )
244  {
245  ptr += sprintf(ptr, "%d", j);
246  j += 1;
247  }
248  else
249  {
250  ptr += sprintf(ptr,"%d", si);
251  }
252  }
253  if (i < (mgeom->ngeoms - 1) )
254  {
255  ptr += sprintf(ptr, " -1 "); /* separator for each linestring */
256  }
257  }
258  return (ptr-output);
259 }
int npoints
Definition: liblwgeom.h:370
int ngeoms
Definition: liblwgeom.h:480
LWLINE ** geoms
Definition: liblwgeom.h:482
int lwline_is_closed(const LWLINE *line)
Definition: lwline.c:468
POINTARRAY * points
Definition: liblwgeom.h:421

Here is the call graph for this function:

Here is the caller graph for this function: