PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asx3d3_multi_size()

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 373 of file lwout_x3d.c.

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

Referenced by asx3d3_collection_size(), and asx3d3_multi().

374 {
375  int i;
376  size_t size;
377  size_t defidlen = strlen(defid);
378  LWGEOM *subgeom;
379 
380  /* the longest possible multi version needs to hold DEF=defid and coordinate breakout */
381  if ( X3D_USE_GEOCOORDS(opts) )
382  size = sizeof("<PointSet><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></PointSet>");
383  else
384  size = sizeof("<PointSet><Coordinate point='' /></PointSet>") + defidlen;
385 
386 
387  /* if ( srs ) size += strlen(srs) + sizeof(" srsName=.."); */
388 
389  for (i=0; i<col->ngeoms; i++)
390  {
391  subgeom = col->geoms[i];
392  if (subgeom->type == POINTTYPE)
393  {
394  /* size += ( sizeof("point=''") + defidlen ) * 2; */
395  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
396  }
397  else if (subgeom->type == LINETYPE)
398  {
399  /* size += ( sizeof("<curveMember>/") + defidlen ) * 2; */
400  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
401  }
402  else if (subgeom->type == POLYGONTYPE)
403  {
404  /* size += ( sizeof("<surfaceMember>/") + defidlen ) * 2; */
405  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
406  }
407  }
408 
409  return size;
410 }
#define LINETYPE
Definition: liblwgeom.h:71
#define POLYGONTYPE
Definition: liblwgeom.h:72
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:302
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1489
LWGEOM ** geoms
Definition: liblwgeom.h:493
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
opts
Definition: ovdump.py:44
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=&#39;abc&#39; transform=&#39;&#39; etc...
Definition: lwout_x3d.c:95
static size_t asx3d3_line_size(const LWLINE *line, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:141
Here is the call graph for this function:
Here is the caller graph for this function: