PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asx3d3_mpoly_coordindex_sb()

static int asx3d3_mpoly_coordindex_sb ( const LWMPOLY psur,
stringbuffer_t sb 
)
static
Todo:
TODO: Decide the best way to render holes Evidently 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 175 of file lwout_x3d.c.

176 {
177  LWPOLY *patch;
178  uint32_t i, j, k, l;
179  uint32_t np;
180  j = 0;
181  for (i=0; i<psur->ngeoms; i++)
182  {
183  patch = (LWPOLY *) psur->geoms[i];
184  for (l=0; l < patch->nrings; l++)
185  {
186  np = patch->rings[l]->npoints - 1;
187  for (k=0; k < np ; k++)
188  {
189  if (k)
190  {
191  stringbuffer_aprintf(sb, " ");
192  }
193  stringbuffer_aprintf(sb, "%d", (j + k));
194  }
195  j += k;
196  if (l < (patch->nrings - 1) )
197  {
206  stringbuffer_aprintf(sb, " -1 "); /* separator for each inner ring. Ideally we should probably triangulate and cut around as others do */
207  }
208  }
209  if (i < (psur->ngeoms - 1) )
210  {
211  stringbuffer_aprintf(sb, " -1 "); /* separator for each subgeom */
212  }
213  }
214  return LW_SUCCESS;
215 }
#define LW_SUCCESS
Definition: liblwgeom.h:80
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
uint32_t ngeoms
Definition: liblwgeom.h:497
LWPOLY ** geoms
Definition: liblwgeom.h:499
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

References LWMPOLY::geoms, LW_SUCCESS, LWMPOLY::ngeoms, POINTARRAY::npoints, LWPOLY::nrings, LWPOLY::rings, and stringbuffer_aprintf().

Referenced by asx3d3_multi_sb().

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