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

◆ asx3d3_psurface_sb()

static int asx3d3_psurface_sb ( const LWPSURFACE psur,
int  precision,
int  opts,
const char *  defid,
stringbuffer_t sb 
)
static

Definition at line 361 of file lwout_x3d.c.

362{
363 uint32_t i;
364 uint32_t j;
365 uint32_t k;
366 uint32_t np;
367 LWPOLY *patch;
368
369 /* Open outmost tag */
370 stringbuffer_aprintf(sb, "<IndexedFaceSet convex='false' %s coordIndex='",defid);
371
372 j = 0;
373 for (i=0; i<psur->ngeoms; i++)
374 {
375 patch = (LWPOLY *) psur->geoms[i];
376 np = patch->rings[0]->npoints - 1;
377 for (k=0; k < np ; k++)
378 {
379 if (k)
380 {
381 stringbuffer_aprintf(sb, " ");
382 }
383 stringbuffer_aprintf(sb,"%d", (j + k));
384 }
385 if (i < (psur->ngeoms - 1) )
386 {
387 stringbuffer_aprintf(sb, " -1 "); /* separator for each subgeom */
388 }
389 j += k;
390 }
391
392 if ( X3D_USE_GEOCOORDS(opts) )
393 stringbuffer_aprintf(sb, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='",
394 ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
395 else stringbuffer_aprintf(sb, "'><Coordinate point='");
396
397 for (i=0; i<psur->ngeoms; i++)
398 {
399 asx3d3_poly_sb(psur->geoms[i], precision, opts, 1, defid, sb);
400 if (i < (psur->ngeoms - 1) )
401 {
402 stringbuffer_aprintf(sb, " "); /* only add a trailing space if its not the last polygon in the set */
403 }
404 }
405
406 /* Close outmost tag */
407 return stringbuffer_aprintf(sb, "' /></IndexedFaceSet>");
408}
static uint8_t precision
Definition cu_in_twkb.c:25
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition liblwgeom.h:1730
#define X3D_USE_GEOCOORDS(x)
Definition liblwgeom.h:1732
static int asx3d3_poly_sb(const LWPOLY *poly, int precision, int opts, __attribute__((__unused__)) int is_patch, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Compute the X3D coordinates of the polygon and add to string buffer.
Definition lwout_x3d.c:251
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.
POINTARRAY ** rings
Definition liblwgeom.h:519
LWPOLY ** geoms
Definition liblwgeom.h:645
uint32_t ngeoms
Definition liblwgeom.h:650
uint32_t npoints
Definition liblwgeom.h:427

References asx3d3_poly_sb(), LWPSURFACE::geoms, LW_X3D_FLIP_XY, LWPSURFACE::ngeoms, POINTARRAY::npoints, precision, LWPOLY::rings, stringbuffer_aprintf(), and X3D_USE_GEOCOORDS.

Referenced by asx3d3_collection_sb(), and lwgeom_to_x3d3_sb().

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