PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asx3d3_psurface_sb()

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

Definition at line 349 of file lwout_x3d.c.

350 {
351  uint32_t i;
352  uint32_t j;
353  uint32_t k;
354  uint32_t np;
355  LWPOLY *patch;
356 
357  /* Open outmost tag */
358  stringbuffer_aprintf(sb, "<IndexedFaceSet convex='false' %s coordIndex='",defid);
359 
360  j = 0;
361  for (i=0; i<psur->ngeoms; i++)
362  {
363  patch = (LWPOLY *) psur->geoms[i];
364  np = patch->rings[0]->npoints - 1;
365  for (k=0; k < np ; k++)
366  {
367  if (k)
368  {
369  stringbuffer_aprintf(sb, " ");
370  }
371  stringbuffer_aprintf(sb,"%d", (j + k));
372  }
373  if (i < (psur->ngeoms - 1) )
374  {
375  stringbuffer_aprintf(sb, " -1 "); /* separator for each subgeom */
376  }
377  j += k;
378  }
379 
380  if ( X3D_USE_GEOCOORDS(opts) )
381  stringbuffer_aprintf(sb, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='",
382  ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
383  else stringbuffer_aprintf(sb, "'><Coordinate point='");
384 
385  for (i=0; i<psur->ngeoms; i++)
386  {
387  asx3d3_poly_sb(psur->geoms[i], srs, precision, opts, 1, defid, sb);
388  if (i < (psur->ngeoms - 1) )
389  {
390  stringbuffer_aprintf(sb, " "); /* only add a trailing space if its not the last polygon in the set */
391  }
392  }
393 
394  /* Close outmost tag */
395  return stringbuffer_aprintf(sb, "' /></IndexedFaceSet>");
396 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1560
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1562
static int asx3d3_poly_sb(const LWPOLY *poly, __attribute__((__unused__)) char *srs, 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:246
opts
Definition: ovdump.py:44
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
POINTARRAY ** rings
Definition: liblwgeom.h:460
LWPOLY ** geoms
Definition: liblwgeom.h:577
uint32_t ngeoms
Definition: liblwgeom.h:575
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

References asx3d3_poly_sb(), LWPSURFACE::geoms, LW_X3D_FLIP_XY, LWPSURFACE::ngeoms, POINTARRAY::npoints, ovdump::opts, 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: