PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

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

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

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: