PostGIS  2.1.10dev-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 515 of file lwout_x3d.c.

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

Referenced by asx3d3_psurface().

516 {
517  char *ptr;
518  int i;
519  int j;
520  int k;
521  int np;
522  LWPOLY *patch;
523 
524  ptr = output;
525 
526  /* Open outmost tag */
527  ptr += sprintf(ptr, "<IndexedFaceSet %s coordIndex='",defid);
528 
529  j = 0;
530  for (i=0; i<psur->ngeoms; i++)
531  {
532  patch = (LWPOLY *) psur->geoms[i];
533  np = patch->rings[0]->npoints - 1;
534  for (k=0; k < np ; k++)
535  {
536  if (k)
537  {
538  ptr += sprintf(ptr, " ");
539  }
540  ptr += sprintf(ptr, "%d", (j + k));
541  }
542  if (i < (psur->ngeoms - 1) )
543  {
544  ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
545  }
546  j += k;
547  }
548 
549  ptr += sprintf(ptr, "'><Coordinate point='");
550 
551  for (i=0; i<psur->ngeoms; i++)
552  {
553  ptr += asx3d3_poly_buf(psur->geoms[i], 0, ptr, precision, opts, 1, defid);
554  if (i < (psur->ngeoms - 1) )
555  {
556  ptr += sprintf(ptr, " "); /* only add a trailing space if its not the last polygon in the set */
557  }
558  }
559 
560  /* Close outmost tag */
561  ptr += sprintf(ptr, "' /></IndexedFaceSet>");
562 
563  return (ptr-output);
564 }
int npoints
Definition: liblwgeom.h:327
LWPOLY ** geoms
Definition: liblwgeom.h:530
POINTARRAY ** rings
Definition: liblwgeom.h:413
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:311
int ngeoms
Definition: liblwgeom.h:528

Here is the call graph for this function:

Here is the caller graph for this function: