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

Definition at line 663 of file lwout_x3d.c.

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

Referenced by asx3d3_collection().

664 {
665  int i;
666  size_t size;
667  size_t defidlen = strlen(defid);
668  LWGEOM *subgeom;
669 
670  size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2;
671 
672  if ( srs )
673  size += strlen(srs) + sizeof(" srsName=..");
674 
675  for (i=0; i<col->ngeoms; i++)
676  {
677  subgeom = col->geoms[i];
678  size += ( sizeof("<geometryMember>/") + defidlen ) * 2;
679  if ( subgeom->type == POINTTYPE )
680  {
681  size += asx3d3_point_size((LWPOINT*)subgeom, 0, precision, opts, defid);
682  }
683  else if ( subgeom->type == LINETYPE )
684  {
685  size += asx3d3_line_size((LWLINE*)subgeom, 0, precision, opts, defid);
686  }
687  else if ( subgeom->type == POLYGONTYPE )
688  {
689  size += asx3d3_poly_size((LWPOLY*)subgeom, 0, precision, opts, defid);
690  }
691  else if ( lwgeom_is_collection(subgeom) )
692  {
693  size += asx3d3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, defid);
694  }
695  else
696  lwerror("asx3d3_collection_size: unknown geometry type");
697  }
698 
699  return size;
700 }
#define LINETYPE
Definition: liblwgeom.h:61
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:947
#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
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
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
static size_t asx3d3_multi_size(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
Compute max size required for X3D version of this inspected geometry.
Definition: lwout_x3d.c:366

Here is the call graph for this function:

Here is the caller graph for this function: