PostGIS  2.2.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 732 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().

733 {
734  char *ptr;
735  int i;
736  LWGEOM *subgeom;
737 
738  ptr = output;
739 
740  /* Open outmost tag */
742 #ifdef PGIS_X3D_OUTERMOST_TAGS
743  if ( srs )
744  {
745  ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
746  }
747  else
748  {
749  ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
750  }
751 #endif
752 
753  for (i=0; i<col->ngeoms; i++)
754  {
755  subgeom = col->geoms[i];
756  ptr += sprintf(ptr, "<Shape%s>", defid);
757  if ( subgeom->type == POINTTYPE )
758  {
759  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
760  }
761  else if ( subgeom->type == LINETYPE )
762  {
763  ptr += asx3d3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, defid);
764  }
765  else if ( subgeom->type == POLYGONTYPE )
766  {
767  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
768  }
769  else if ( subgeom->type == TINTYPE )
770  {
771  ptr += asx3d3_tin_buf((LWTIN*)subgeom, srs, ptr, precision, opts, defid);
772 
773  }
774  else if ( subgeom->type == POLYHEDRALSURFACETYPE )
775  {
776  ptr += asx3d3_psurface_buf((LWPSURFACE*)subgeom, srs, ptr, precision, opts, defid);
777 
778  }
779  else if ( lwgeom_is_collection(subgeom) )
780  {
781  if ( subgeom->type == COLLECTIONTYPE )
782  ptr += asx3d3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
783  else
784  ptr += asx3d3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
785  }
786  else
787  lwerror("asx3d3_collection_buf: unknown geometry type");
788 
789  ptr += printf(ptr, "</Shape>");
790  }
791 
792  /* Close outmost tag */
793 #ifdef PGIS_X3D_OUTERMOST_TAGS
794  ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
795 #endif
796 
797  return (ptr-output);
798 }
#define LINETYPE
Definition: liblwgeom.h:71
static size_t asx3d3_collection_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:732
static size_t asx3d3_multi_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:416
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:991
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
static size_t asx3d3_tin_buf(const LWTIN *tin, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:625
LWGEOM ** geoms
Definition: liblwgeom.h:493
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:107
#define TINTYPE
Definition: liblwgeom.h:84
uint8_t precision
Definition: cu_in_twkb.c:25
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
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:318
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:164
static size_t asx3d3_psurface_buf(const LWPSURFACE *psur, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:531
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: