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

Use Polypoint2D instead

Definition at line 405 of file lwout_x3d.c.

References asx3d3_line_coords(), asx3d3_mline_coordindex(), asx3d3_mpoly_coordindex(), asx3d3_point_buf(), asx3d3_poly_buf(), LWCOLLECTION::flags, FLAGS_GET_Z, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by asx3d3_collection_buf(), and asx3d3_multi().

406 {
407  char *ptr, *x3dtype;
408  int i;
409  int dimension=2;
410 
411  if (FLAGS_GET_Z(col->flags)) dimension = 3;
412  LWGEOM *subgeom;
413  ptr = output;
414  x3dtype="";
415 
416 
417  switch (col->type)
418  {
419  case MULTIPOINTTYPE:
420  x3dtype = "PointSet";
421  if ( dimension == 2 ){
422  x3dtype = "Polypoint2D";
423  ptr += sprintf(ptr, "<%s %s point='", x3dtype, defid);
424  }
425  else {
426  ptr += sprintf(ptr, "<%s %s>", x3dtype, defid);
427  }
428  break;
429  case MULTILINETYPE:
430  x3dtype = "IndexedLineSet";
431  ptr += sprintf(ptr, "<%s %s coordIndex='", x3dtype, defid);
432  ptr += asx3d3_mline_coordindex((const LWMLINE *)col, ptr);
433  ptr += sprintf(ptr, "'>");
434  break;
435  case MULTIPOLYGONTYPE:
436  x3dtype = "IndexedFaceSet";
437  ptr += sprintf(ptr, "<%s %s coordIndex='", x3dtype, defid);
438  ptr += asx3d3_mpoly_coordindex((const LWMPOLY *)col, ptr);
439  ptr += sprintf(ptr, "'>");
440  break;
441  default:
442  lwerror("asx3d3_multi_buf: '%s' geometry type not supported", lwtype_name(col->type));
443  return 0;
444  }
445  if (dimension == 3){
446  ptr += sprintf(ptr, "<Coordinate point='");
447  }
448 
449  for (i=0; i<col->ngeoms; i++)
450  {
451  subgeom = col->geoms[i];
452  if (subgeom->type == POINTTYPE)
453  {
454  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
455  ptr += sprintf(ptr, " ");
456  }
457  else if (subgeom->type == LINETYPE)
458  {
459  ptr += asx3d3_line_coords((LWLINE*)subgeom, ptr, precision, opts);
460  ptr += sprintf(ptr, " ");
461  }
462  else if (subgeom->type == POLYGONTYPE)
463  {
464  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
465  ptr += sprintf(ptr, " ");
466  }
467  }
468 
469  /* Close outmost tag */
470  if (dimension == 3){
471  ptr += sprintf(ptr, "' /></%s>", x3dtype);
472  }
473  else { ptr += sprintf(ptr, "' />"); }
474  return (ptr-output);
475 }
#define LINETYPE
Definition: liblwgeom.h:61
uint8_t type
Definition: liblwgeom.h:459
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
uint8_t flags
Definition: liblwgeom.h:460
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
LWGEOM ** geoms
Definition: liblwgeom.h:465
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:108
static size_t asx3d3_line_coords(const LWLINE *line, char *output, int precision, int opts)
Definition: lwout_x3d.c:181
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
static size_t asx3d3_mpoly_coordindex(const LWMPOLY *psur, char *output)
Definition: lwout_x3d.c:237
static size_t asx3d3_mline_coordindex(const LWMLINE *mgeom, char *output)
Definition: lwout_x3d.c:191
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
static size_t asx3d3_poly_buf(const LWPOLY *poly, char *srs, char *output, int precision, int opts, int is_patch, const char *defid)
Compute the X3D coordinates of the polygon.
Definition: lwout_x3d.c:311
#define MULTILINETYPE
Definition: liblwgeom.h:64

Here is the call graph for this function:

Here is the caller graph for this function: