PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ asx3d3_collection_buf()

static size_t asx3d3_collection_buf ( const LWCOLLECTION col,
char *  srs,
char *  output,
int  precision,
int  opts,
const char *  defid 
)
static

: decide if we need outtermost tags, this one was just a copy from gml so is wrong

Definition at line 753 of file lwout_x3d.c.

References asx3d3_line_buf(), asx3d3_multi_buf(), asx3d3_point_buf(), asx3d3_poly_buf(), asx3d3_psurface_buf(), asx3d3_tin_buf(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, and LWGEOM::type.

Referenced by asx3d3_collection().

754 {
755  char *ptr;
756  int i;
757  LWGEOM *subgeom;
758 
759  ptr = output;
760 
761  /* Open outmost tag */
763 #ifdef PGIS_X3D_OUTERMOST_TAGS
764  if ( srs )
765  {
766  ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
767  }
768  else
769  {
770  ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
771  }
772 #endif
773 
774  for (i=0; i<col->ngeoms; i++)
775  {
776  subgeom = col->geoms[i];
777  ptr += sprintf(ptr, "<Shape%s>", defid);
778  if ( subgeom->type == POINTTYPE )
779  {
780  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
781  }
782  else if ( subgeom->type == LINETYPE )
783  {
784  ptr += asx3d3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, defid);
785  }
786  else if ( subgeom->type == POLYGONTYPE )
787  {
788  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
789  }
790  else if ( subgeom->type == TINTYPE )
791  {
792  ptr += asx3d3_tin_buf((LWTIN*)subgeom, srs, ptr, precision, opts, defid);
793 
794  }
795  else if ( subgeom->type == POLYHEDRALSURFACETYPE )
796  {
797  ptr += asx3d3_psurface_buf((LWPSURFACE*)subgeom, srs, ptr, precision, opts, defid);
798 
799  }
800  else if ( lwgeom_is_collection(subgeom) )
801  {
802  if ( subgeom->type == COLLECTIONTYPE )
803  ptr += asx3d3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
804  else
805  ptr += asx3d3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
806  }
807  else
808  lwerror("asx3d3_collection_buf: unknown geometry type");
809 
810  ptr += printf(ptr, "</Shape>");
811  }
812 
813  /* Close outmost tag */
814 #ifdef PGIS_X3D_OUTERMOST_TAGS
815  ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
816 #endif
817 
818  return (ptr-output);
819 }
#define LINETYPE
Definition: liblwgeom.h:85
static size_t asx3d3_collection_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:753
static size_t asx3d3_multi_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:437
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1004
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
static size_t asx3d3_tin_buf(const LWTIN *tin, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:646
LWGEOM ** geoms
Definition: liblwgeom.h:508
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:128
#define TINTYPE
Definition: liblwgeom.h:98
uint8_t precision
Definition: cu_in_twkb.c:25
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
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:339
opts
Definition: ovdump.py:44
static size_t asx3d3_line_buf(const LWLINE *line, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:185
static size_t asx3d3_psurface_buf(const LWPSURFACE *psur, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:552
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: