PostGIS  2.3.6-r@@SVN_REVISION@@
static size_t asx3d3_psurface_buf ( const LWPSURFACE psur,
char *  srs,
char *  output,
int  precision,
int  opts,
const char *  defid 
)
static

Definition at line 552 of file lwout_x3d.c.

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

Referenced by asx3d3_collection_buf(), and asx3d3_psurface().

553 {
554  char *ptr;
555  int i;
556  int j;
557  int k;
558  int np;
559  LWPOLY *patch;
560 
561  ptr = output;
562 
563  /* Open outmost tag */
564  ptr += sprintf(ptr, "<IndexedFaceSet convex='false' %s coordIndex='",defid);
565 
566  j = 0;
567  for (i=0; i<psur->ngeoms; i++)
568  {
569  patch = (LWPOLY *) psur->geoms[i];
570  np = patch->rings[0]->npoints - 1;
571  for (k=0; k < np ; k++)
572  {
573  if (k)
574  {
575  ptr += sprintf(ptr, " ");
576  }
577  ptr += sprintf(ptr, "%d", (j + k));
578  }
579  if (i < (psur->ngeoms - 1) )
580  {
581  ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
582  }
583  j += k;
584  }
585 
586  if ( X3D_USE_GEOCOORDS(opts) )
587  ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
588  else ptr += sprintf(ptr, "'><Coordinate point='");
589 
590  for (i=0; i<psur->ngeoms; i++)
591  {
592  ptr += asx3d3_poly_buf(psur->geoms[i], 0, ptr, precision, opts, 1, defid);
593  if (i < (psur->ngeoms - 1) )
594  {
595  ptr += sprintf(ptr, " "); /* only add a trailing space if its not the last polygon in the set */
596  }
597  }
598 
599  /* Close outmost tag */
600  ptr += sprintf(ptr, "' /></IndexedFaceSet>");
601 
602  return (ptr-output);
603 }
int npoints
Definition: liblwgeom.h:370
LWPOLY ** geoms
Definition: liblwgeom.h:573
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1533
POINTARRAY ** rings
Definition: liblwgeom.h:456
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1531
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asx3d3_poly_buf(const LWPOLY *poly, char *srs, char *output, int precision, int opts, int is_patch, const char *defid)
Compute the X3D coordinates of the polygon.
Definition: lwout_x3d.c:339
int ngeoms
Definition: liblwgeom.h:571

Here is the call graph for this function:

Here is the caller graph for this function: