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

Compute max size required for X3D version of this inspected geometry.

Will recurse when needed. Don't call this with single-geoms inspected.

Definition at line 366 of file lwout_x3d.c.

References asx3d3_line_size(), asx3d3_point_size(), asx3d3_poly_size(), LWCOLLECTION::geoms, LINETYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by asx3d3_collection_size(), and asx3d3_multi().

367 {
368  int i;
369  size_t size;
370  size_t defidlen = strlen(defid);
371  LWGEOM *subgeom;
372 
373  /* the longest possible multi version needs to hold DEF=defid and coordinate breakout */
374  size = sizeof("<PointSet><Coordinate point='' /></PointSet>") + defidlen;
375 
376  /* if ( srs ) size += strlen(srs) + sizeof(" srsName=.."); */
377 
378  for (i=0; i<col->ngeoms; i++)
379  {
380  subgeom = col->geoms[i];
381  if (subgeom->type == POINTTYPE)
382  {
383  /* size += ( sizeof("point=''") + defidlen ) * 2; */
384  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
385  }
386  else if (subgeom->type == LINETYPE)
387  {
388  /* size += ( sizeof("<curveMember>/") + defidlen ) * 2; */
389  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
390  }
391  else if (subgeom->type == POLYGONTYPE)
392  {
393  /* size += ( sizeof("<surfaceMember>/") + defidlen ) * 2; */
394  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
395  }
396  }
397 
398  return size;
399 }
#define LINETYPE
Definition: liblwgeom.h:61
#define POLYGONTYPE
Definition: liblwgeom.h:62
static size_t asx3d3_poly_size(const LWPOLY *poly, char *srs, int precision, int opts, const char *defid)
Compute the string space needed for the IndexedFaceSet representation of the polygon.
Definition: lwout_x3d.c:295
LWGEOM ** geoms
Definition: liblwgeom.h:465
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
static size_t asx3d3_point_size(const LWPOINT *point, char *srs, int precision, int opts, const char *defid)
defid is the id of the coordinate can be used to hold other elements DEF='abc' transform='' etc...
Definition: lwout_x3d.c:96
static size_t asx3d3_line_size(const LWLINE *line, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:142

Here is the call graph for this function:

Here is the caller graph for this function: