PostGIS  2.5.7dev-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

@TODO: 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.

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 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define LINETYPE
Definition: liblwgeom.h:86
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
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:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
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
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
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
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_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
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
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
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

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, ovdump::opts, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, precision, stringbuffer_aprintf(), TINTYPE, and LWGEOM::type.

Referenced by lwgeom_to_x3d3_sb().

Here is the call graph for this function:
Here is the caller graph for this function: