PostGIS  2.1.10dev-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 191 of file lwout_x3d.c.

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

Referenced by asx3d3_multi_buf().

192 {
193  char *ptr=output;
194  LWLINE *geom;
195  int i, j, k, si;
196  POINTARRAY *pa;
197  int np;
198 
199  j = 0;
200  for (i=0; i < mgeom->ngeoms; i++)
201  {
202  geom = (LWLINE *) mgeom->geoms[i];
203  pa = geom->points;
204  np = pa->npoints;
205  si = j; /* start index of first point of linestring */
206  for (k=0; k < np ; k++)
207  {
208  if (k)
209  {
210  ptr += sprintf(ptr, " ");
211  }
215  if (!lwline_is_closed(geom) || k < (np -1) )
216  {
217  ptr += sprintf(ptr, "%d", j);
218  j += 1;
219  }
220  else
221  {
222  ptr += sprintf(ptr,"%d", si);
223  }
224  }
225  if (i < (mgeom->ngeoms - 1) )
226  {
227  ptr += sprintf(ptr, " -1 "); /* separator for each linestring */
228  }
229  }
230  return (ptr-output);
231 }
int npoints
Definition: liblwgeom.h:327
int ngeoms
Definition: liblwgeom.h:437
LWLINE ** geoms
Definition: liblwgeom.h:439
int lwline_is_closed(const LWLINE *line)
Definition: lwline.c:435
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: