PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ asx3d3_collection_size()

static size_t asx3d3_collection_size ( const LWCOLLECTION col,
char *  srs,
int  precision,
int  opts,
const char *  defid 
)
static

if ( srs ) size += strlen(srs) + sizeof(" srsName=..");

for collections we need to wrap each in a shape tag to make valid

Definition at line 704 of file lwout_x3d.c.

References asx3d3_line_size(), asx3d3_multi_size(), asx3d3_point_size(), asx3d3_poly_size(), asx3d3_psurface_size(), asx3d3_tin_size(), LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, and LWGEOM::type.

Referenced by asx3d3_collection().

705 {
706  int i;
707  size_t size;
708  size_t defidlen = strlen(defid);
709  LWGEOM *subgeom;
710 
711  /* size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; */
712  size = defidlen*2;
713 
717  for (i=0; i<col->ngeoms; i++)
718  {
719  subgeom = col->geoms[i];
720  size += ( sizeof("<Shape />") + defidlen ) * 2;
721  if ( subgeom->type == POINTTYPE )
722  {
723  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
724  }
725  else if ( subgeom->type == LINETYPE )
726  {
727  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
728  }
729  else if ( subgeom->type == POLYGONTYPE )
730  {
731  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
732  }
733  else if ( subgeom->type == TINTYPE )
734  {
735  size += asx3d3_tin_size((LWTIN*)subgeom, 0, precision, opts, defid);
736  }
737  else if ( subgeom->type == POLYHEDRALSURFACETYPE )
738  {
739  size += asx3d3_psurface_size((LWPSURFACE*)subgeom, 0, precision, opts, defid);
740  }
741  else if ( lwgeom_is_collection(subgeom) )
742  {
743  size += asx3d3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, defid);
744  }
745  else
746  lwerror("asx3d3_collection_size: unknown geometry type");
747  }
748 
749  return size;
750 }
#define LINETYPE
Definition: liblwgeom.h:86
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1040
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
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
LWGEOM ** geoms
Definition: liblwgeom.h:509
#define TINTYPE
Definition: liblwgeom.h:99
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asx3d3_tin_size(const LWTIN *tin, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:622
#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_psurface_size(const LWPSURFACE *psur, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:529
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
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static size_t asx3d3_multi_size(const LWCOLLECTION *col, char *srs, int precisioSn, int opts, const char *defid)
Compute max size required for X3D version of this inspected geometry.
Definition: lwout_x3d.c:394
Here is the call graph for this function:
Here is the caller graph for this function: