PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ asx3d3_collection_sb()

static int asx3d3_collection_sb ( const LWCOLLECTION col,
char *  srs,
int  precision,
int  opts,
const char *  defid,
stringbuffer_t sb 
)
static

: if collection should be grouped, we'll wrap in a group tag. Still needs cleanup like the shapes should really be in a transform

Definition at line 440 of file lwout_x3d.c.

References asx3d3_line_sb(), asx3d3_multi_sb(), asx3d3_point_sb(), asx3d3_poly_sb(), asx3d3_psurface_sb(), asx3d3_tin_sb(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, LW_SUCCESS, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, stringbuffer_aprintf(), TINTYPE, and LWGEOM::type.

Referenced by lwgeom_to_x3d3_sb().

441 {
442  uint32_t i;
443  LWGEOM *subgeom;
444 
445  /* Open outmost tag */
448 #ifdef PGIS_X3D_OUTERMOST_TAGS
449  stringbuffer_aprintf(sb, "<%sGroup>", defid);
450 #endif
451 
452  for (i=0; i<col->ngeoms; i++)
453  {
454  subgeom = col->geoms[i];
455  stringbuffer_aprintf(sb, "<Shape%s>", defid);
456  if ( subgeom->type == POINTTYPE )
457  {
458  asx3d3_point_sb((LWPOINT*)subgeom, 0, precision, opts, defid, sb);
459  }
460  else if ( subgeom->type == LINETYPE )
461  {
462  asx3d3_line_sb((LWLINE*)subgeom, 0, precision, opts, defid, sb);
463  }
464  else if ( subgeom->type == POLYGONTYPE )
465  {
466  asx3d3_poly_sb((LWPOLY*)subgeom, 0, precision, opts, 0, defid, sb);
467  }
468  else if ( subgeom->type == TINTYPE )
469  {
470  asx3d3_tin_sb((LWTIN*)subgeom, srs, precision, opts, defid, sb);
471 
472  }
473  else if ( subgeom->type == POLYHEDRALSURFACETYPE )
474  {
475  asx3d3_psurface_sb((LWPSURFACE*)subgeom, srs, precision, opts, defid, sb);
476 
477  }
478  else if ( lwgeom_is_collection(subgeom) )
479  {
480  if ( subgeom->type == COLLECTIONTYPE )
481  asx3d3_collection_sb((LWCOLLECTION*)subgeom, 0, precision, opts, defid, sb);
482  else
483  asx3d3_multi_sb((LWCOLLECTION*)subgeom, 0, precision, opts, defid, sb);
484  }
485  else
486  lwerror("asx3d3_collection_buf: unknown geometry type");
487 
488  stringbuffer_aprintf(sb, "</Shape>");
489  }
490 
491  /* Close outmost tag */
492 #ifdef PGIS_X3D_OUTERMOST_TAGS
493  stringbuffer_aprintf(sb, "</%sGroup>", defid);
494 #endif
495 
496  return LW_SUCCESS;
497 }
#define LINETYPE
Definition: liblwgeom.h:85
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define LW_SUCCESS
Definition: liblwgeom.h:79
static int asx3d3_psurface_sb(const LWPSURFACE *psur, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:349
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
uint32_t ngeoms
Definition: liblwgeom.h:509
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
unsigned int uint32_t
Definition: uthash.h:78
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
static int asx3d3_multi_sb(const LWCOLLECTION *col, __attribute__((__unused__)) char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:270
LWGEOM ** geoms
Definition: liblwgeom.h:511
#define TINTYPE
Definition: liblwgeom.h:98
uint8_t precision
Definition: cu_in_twkb.c:25
static int asx3d3_point_sb(const LWPOINT *point, __attribute__((__unused__)) char *srs, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:114
static int asx3d3_line_sb(const LWLINE *line, __attribute__((__unused__)) char *srs, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Return the linestring as an X3D LineSet.
Definition: lwout_x3d.c:219
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
static int asx3d3_collection_sb(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:440
opts
Definition: ovdump.py:44
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
static int asx3d3_tin_sb(const LWTIN *tin, __attribute__((__unused__)) char *srs, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:402
Here is the call graph for this function:
Here is the caller graph for this function: