PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asx3d3_collection_buf ( const LWCOLLECTION col,
char *  srs,
char *  output,
int  precision,
int  opts,
const char *  defid 
)
static

Definition at line 703 of file lwout_x3d.c.

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

Referenced by asx3d3_collection().

704 {
705  char *ptr;
706  int i;
707  LWGEOM *subgeom;
708 
709  ptr = output;
710 
711  /* Open outmost tag */
712  if ( srs )
713  {
714  ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
715  }
716  else
717  {
718  ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
719  }
720 
721  for (i=0; i<col->ngeoms; i++)
722  {
723  subgeom = col->geoms[i];
724  ptr += sprintf(ptr, "<%sgeometryMember>", defid);
725  if ( subgeom->type == POINTTYPE )
726  {
727  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
728  }
729  else if ( subgeom->type == LINETYPE )
730  {
731  ptr += asx3d3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, defid);
732  }
733  else if ( subgeom->type == POLYGONTYPE )
734  {
735  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
736  }
737  else if ( lwgeom_is_collection(subgeom) )
738  {
739  if ( subgeom->type == COLLECTIONTYPE )
740  ptr += asx3d3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
741  else
742  ptr += asx3d3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
743  }
744  else
745  lwerror("asx3d3_collection_buf: unknown geometry type");
746 
747  ptr += sprintf(ptr, "</%sgeometryMember>", defid);
748  }
749 
750  /* Close outmost tag */
751  ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
752 
753  return (ptr-output);
754 }
#define LINETYPE
Definition: liblwgeom.h:61
static size_t asx3d3_collection_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:703
static size_t asx3d3_multi_buf(const LWCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:405
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:947
#define POLYGONTYPE
Definition: liblwgeom.h:62
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
LWGEOM ** geoms
Definition: liblwgeom.h:465
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:108
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
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:311
static size_t asx3d3_line_buf(const LWLINE *line, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:158
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: