PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asx3d3_collection_sb()

static int asx3d3_collection_sb ( const LWCOLLECTION col,
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 451 of file lwout_x3d.c.

452{
453 uint32_t i;
454 LWGEOM *subgeom;
455
456 /* Open outmost tag */
459#ifdef PGIS_X3D_OUTERMOST_TAGS
460 stringbuffer_aprintf(sb, "<%sGroup>", defid);
461#endif
462
463 for (i=0; i<col->ngeoms; i++)
464 {
465 subgeom = col->geoms[i];
466 stringbuffer_aprintf(sb, "<Shape%s>", defid);
467 if ( subgeom->type == POINTTYPE )
468 {
469 asx3d3_point_sb((LWPOINT *)subgeom, precision, opts, defid, sb);
470 }
471 else if ( subgeom->type == LINETYPE )
472 {
473 asx3d3_line_sb((LWLINE *)subgeom, precision, opts, defid, sb);
474 }
475 else if ( subgeom->type == POLYGONTYPE )
476 {
477 asx3d3_poly_sb((LWPOLY *)subgeom, precision, opts, 0, defid, sb);
478 }
479 else if ( subgeom->type == TINTYPE )
480 {
481 asx3d3_tin_sb((LWTIN *)subgeom, precision, opts, defid, sb);
482 }
483 else if ( subgeom->type == POLYHEDRALSURFACETYPE )
484 {
485 asx3d3_psurface_sb((LWPSURFACE *)subgeom, precision, opts, defid, sb);
486 }
487 else if ( lwgeom_is_collection(subgeom) )
488 {
489 if ( subgeom->type == COLLECTIONTYPE )
490 asx3d3_collection_sb((LWCOLLECTION *)subgeom, precision, opts, defid, sb);
491 else
492 asx3d3_multi_sb((LWCOLLECTION *)subgeom, precision, opts, defid, sb);
493 }
494 else
495 lwerror("asx3d3_collection_buf: unknown geometry type");
496
497 stringbuffer_aprintf(sb, "</Shape>");
498 }
499
500 /* Close outmost tag */
501#ifdef PGIS_X3D_OUTERMOST_TAGS
502 stringbuffer_aprintf(sb, "</%sGroup>", defid);
503#endif
504
505 return LW_SUCCESS;
506}
static uint8_t precision
Definition cu_in_twkb.c:25
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define LINETYPE
Definition liblwgeom.h:103
#define LW_SUCCESS
Definition liblwgeom.h:97
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define TINTYPE
Definition liblwgeom.h:116
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
#define POLYGONTYPE
Definition liblwgeom.h:104
#define POLYHEDRALSURFACETYPE
Definition liblwgeom.h:114
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int asx3d3_collection_sb(const LWCOLLECTION *col, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:451
static int asx3d3_point_sb(const LWPOINT *point, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:113
static int asx3d3_multi_sb(const LWCOLLECTION *col, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:282
static int asx3d3_tin_sb(const LWTIN *tin, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:414
static int asx3d3_poly_sb(const LWPOLY *poly, 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:251
static int asx3d3_line_sb(const LWLINE *line, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Return the linestring as an X3D LineSet.
Definition lwout_x3d.c:221
static int asx3d3_psurface_sb(const LWPSURFACE *psur, int precision, int opts, const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:361
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.
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

References asx3d3_collection_sb(), 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, precision, stringbuffer_aprintf(), TINTYPE, and LWGEOM::type.

Referenced by asx3d3_collection_sb(), and lwgeom_to_x3d3_sb().

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