PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asx3d3_psurface_buf()

static size_t asx3d3_psurface_buf ( const LWPSURFACE psur,
char *  srs,
char *  output,
int  precision,
int  opts,
const char *  defid 
)
static

Definition at line 531 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().

532 {
533  char *ptr;
534  int i;
535  int j;
536  int k;
537  int np;
538  LWPOLY *patch;
539 
540  ptr = output;
541 
542  /* Open outmost tag */
543  ptr += sprintf(ptr, "<IndexedFaceSet convex='false' %s coordIndex='",defid);
544 
545  j = 0;
546  for (i=0; i<psur->ngeoms; i++)
547  {
548  patch = (LWPOLY *) psur->geoms[i];
549  np = patch->rings[0]->npoints - 1;
550  for (k=0; k < np ; k++)
551  {
552  if (k)
553  {
554  ptr += sprintf(ptr, " ");
555  }
556  ptr += sprintf(ptr, "%d", (j + k));
557  }
558  if (i < (psur->ngeoms - 1) )
559  {
560  ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
561  }
562  j += k;
563  }
564 
565  if ( X3D_USE_GEOCOORDS(opts) )
566  ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
567  else ptr += sprintf(ptr, "'><Coordinate point='");
568 
569  for (i=0; i<psur->ngeoms; i++)
570  {
571  ptr += asx3d3_poly_buf(psur->geoms[i], 0, ptr, precision, opts, 1, defid);
572  if (i < (psur->ngeoms - 1) )
573  {
574  ptr += sprintf(ptr, " "); /* only add a trailing space if its not the last polygon in the set */
575  }
576  }
577 
578  /* Close outmost tag */
579  ptr += sprintf(ptr, "' /></IndexedFaceSet>");
580 
581  return (ptr-output);
582 }
int npoints
Definition: liblwgeom.h:355
LWPOLY ** geoms
Definition: liblwgeom.h:558
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1489
POINTARRAY ** rings
Definition: liblwgeom.h:441
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1487
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:318
opts
Definition: ovdump.py:44
int ngeoms
Definition: liblwgeom.h:556
Here is the call graph for this function:
Here is the caller graph for this function: