PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ asx3d3_mpoly_coordindex()

static size_t asx3d3_mpoly_coordindex ( const LWMPOLY psur,
char *  output 
)
static
Todo:
TODO: Decide the best way to render holes Evidentally according to my X3D expert the X3D consortium doesn't really support holes and it's an issue of argument among many that feel it should. He thinks CAD x3d extensions to spec might. What he has done and others developing X3D exports to simulate a hole is to cut around it. So if you have a donut, you would cut it into half and have 2 solid polygons. Not really sure the best way to handle this. For now will leave it as polygons stacked on top of each other – which is what we are doing here and perhaps an option to color differently. It's not ideal but the alternative sounds complicated.

Definition at line 265 of file lwout_x3d.c.

References LWMPOLY::geoms, LWMPOLY::ngeoms, POINTARRAY::npoints, LWPOLY::nrings, and LWPOLY::rings.

Referenced by asx3d3_multi_buf().

266 {
267  char *ptr=output;
268  LWPOLY *patch;
269  int i, j, k, l;
270  int np;
271  j = 0;
272  for (i=0; i<psur->ngeoms; i++)
273  {
274  patch = (LWPOLY *) psur->geoms[i];
275  for (l=0; l < patch->nrings; l++)
276  {
277  np = patch->rings[l]->npoints - 1;
278  for (k=0; k < np ; k++)
279  {
280  if (k)
281  {
282  ptr += sprintf(ptr, " ");
283  }
284  ptr += sprintf(ptr, "%d", (j + k));
285  }
286  j += k;
287  if (l < (patch->nrings - 1) )
288  {
297  ptr += sprintf(ptr, " -1 "); /* separator for each inner ring. Ideally we should probably triangulate and cut around as others do */
298  }
299  }
300  if (i < (psur->ngeoms - 1) )
301  {
302  ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
303  }
304  }
305  return (ptr-output);
306 }
int npoints
Definition: liblwgeom.h:371
LWPOLY ** geoms
Definition: liblwgeom.h:496
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
int ngeoms
Definition: liblwgeom.h:494
Here is the caller graph for this function: