PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asx3d3_mline_coordindex()

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 198 of file lwout_x3d.c.

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

Referenced by asx3d3_multi_buf().

199 {
200  char *ptr=output;
201  LWLINE *geom;
202  int i, j, k, si;
203  POINTARRAY *pa;
204  int np;
205 
206  j = 0;
207  for (i=0; i < mgeom->ngeoms; i++)
208  {
209  geom = (LWLINE *) mgeom->geoms[i];
210  pa = geom->points;
211  np = pa->npoints;
212  si = j; /* start index of first point of linestring */
213  for (k=0; k < np ; k++)
214  {
215  if (k)
216  {
217  ptr += sprintf(ptr, " ");
218  }
222  if (!lwline_is_closed(geom) || k < (np -1) )
223  {
224  ptr += sprintf(ptr, "%d", j);
225  j += 1;
226  }
227  else
228  {
229  ptr += sprintf(ptr,"%d", si);
230  }
231  }
232  if (i < (mgeom->ngeoms - 1) )
233  {
234  ptr += sprintf(ptr, " -1 "); /* separator for each linestring */
235  }
236  }
237  return (ptr-output);
238 }
int npoints
Definition: liblwgeom.h:355
int ngeoms
Definition: liblwgeom.h:465
LWLINE ** geoms
Definition: liblwgeom.h:467
int lwline_is_closed(const LWLINE *line)
Definition: lwline.c:439
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: