PostGIS  2.2.8dev-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 683 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().

684 {
685  int i;
686  size_t size;
687  size_t defidlen = strlen(defid);
688  LWGEOM *subgeom;
689 
690  /* size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; */
691  size = defidlen*2;
692 
696  for (i=0; i<col->ngeoms; i++)
697  {
698  subgeom = col->geoms[i];
699  size += ( sizeof("<Shape />") + defidlen ) * 2;
700  if ( subgeom->type == POINTTYPE )
701  {
702  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
703  }
704  else if ( subgeom->type == LINETYPE )
705  {
706  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
707  }
708  else if ( subgeom->type == POLYGONTYPE )
709  {
710  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
711  }
712  else if ( subgeom->type == TINTYPE )
713  {
714  size += asx3d3_tin_size((LWTIN*)subgeom, 0, precision, opts, defid);
715  }
716  else if ( subgeom->type == POLYHEDRALSURFACETYPE )
717  {
718  size += asx3d3_psurface_size((LWPSURFACE*)subgeom, 0, precision, opts, defid);
719  }
720  else if ( lwgeom_is_collection(subgeom) )
721  {
722  size += asx3d3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, defid);
723  }
724  else
725  lwerror("asx3d3_collection_size: unknown geometry type");
726  }
727 
728  return size;
729 }
#define LINETYPE
Definition: liblwgeom.h:71
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:991
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
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
LWGEOM ** geoms
Definition: liblwgeom.h:493
#define TINTYPE
Definition: liblwgeom.h:84
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:601
#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_psurface_size(const LWPSURFACE *psur, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:508
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
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
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:373
Here is the call graph for this function:
Here is the caller graph for this function: