PostGIS  2.4.9dev-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 394 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().

395 {
396  int i;
397  size_t size;
398  size_t defidlen = strlen(defid);
399  LWGEOM *subgeom;
400 
401  /* the longest possible multi version needs to hold DEF=defid and coordinate breakout */
402  if ( X3D_USE_GEOCOORDS(opts) )
403  size = sizeof("<PointSet><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></PointSet>");
404  else
405  size = sizeof("<PointSet><Coordinate point='' /></PointSet>") + defidlen;
406 
407 
408  /* if ( srs ) size += strlen(srs) + sizeof(" srsName=.."); */
409 
410  for (i=0; i<col->ngeoms; i++)
411  {
412  subgeom = col->geoms[i];
413  if (subgeom->type == POINTTYPE)
414  {
415  /* size += ( sizeof("point=''") + defidlen ) * 2; */
416  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
417  }
418  else if (subgeom->type == LINETYPE)
419  {
420  /* size += ( sizeof("<curveMember>/") + defidlen ) * 2; */
421  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
422  }
423  else if (subgeom->type == POLYGONTYPE)
424  {
425  /* size += ( sizeof("<surfaceMember>/") + defidlen ) * 2; */
426  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
427  }
428  }
429 
430  return size;
431 }
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
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:323
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1555
LWGEOM ** geoms
Definition: liblwgeom.h:509
uint8_t precision
Definition: cu_in_twkb.c:25
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
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:116
static size_t asx3d3_line_size(const LWLINE *line, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:162
Here is the call graph for this function:
Here is the caller graph for this function: