PostGIS  2.2.7dev-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 416 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, LW_X3D_FLIP_XY, lwerror(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, LWGEOM::type, LWCOLLECTION::type, and X3D_USE_GEOCOORDS.

Referenced by asx3d3_collection_buf(), and asx3d3_multi().

417 {
418  char *ptr, *x3dtype;
419  int i;
420  int dimension=2;
421 
422  if (FLAGS_GET_Z(col->flags)) dimension = 3;
423  LWGEOM *subgeom;
424  ptr = output;
425  x3dtype="";
426 
427 
428  switch (col->type)
429  {
430  case MULTIPOINTTYPE:
431  x3dtype = "PointSet";
432  if ( dimension == 2 ){
433  x3dtype = "Polypoint2D";
434  ptr += sprintf(ptr, "<%s %s point='", x3dtype, defid);
435  }
436  else {
437  ptr += sprintf(ptr, "<%s %s>", x3dtype, defid);
438  }
439  break;
440  case MULTILINETYPE:
441  x3dtype = "IndexedLineSet";
442  ptr += sprintf(ptr, "<%s %s coordIndex='", x3dtype, defid);
443  ptr += asx3d3_mline_coordindex((const LWMLINE *)col, ptr);
444  ptr += sprintf(ptr, "'>");
445  break;
446  case MULTIPOLYGONTYPE:
447  x3dtype = "IndexedFaceSet";
448  ptr += sprintf(ptr, "<%s %s convex='false' coordIndex='", x3dtype, defid);
449  ptr += asx3d3_mpoly_coordindex((const LWMPOLY *)col, ptr);
450  ptr += sprintf(ptr, "'>");
451  break;
452  default:
453  lwerror("asx3d3_multi_buf: '%s' geometry type not supported", lwtype_name(col->type));
454  return 0;
455  }
456  if (dimension == 3){
457  if ( X3D_USE_GEOCOORDS(opts) )
458  ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
459  else
460  ptr += sprintf(ptr, "<Coordinate point='");
461  }
462 
463  for (i=0; i<col->ngeoms; i++)
464  {
465  subgeom = col->geoms[i];
466  if (subgeom->type == POINTTYPE)
467  {
468  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
469  ptr += sprintf(ptr, " ");
470  }
471  else if (subgeom->type == LINETYPE)
472  {
473  ptr += asx3d3_line_coords((LWLINE*)subgeom, ptr, precision, opts);
474  ptr += sprintf(ptr, " ");
475  }
476  else if (subgeom->type == POLYGONTYPE)
477  {
478  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
479  ptr += sprintf(ptr, " ");
480  }
481  }
482 
483  /* Close outmost tag */
484  if (dimension == 3){
485  ptr += sprintf(ptr, "' /></%s>", x3dtype);
486  }
487  else { ptr += sprintf(ptr, "' />"); }
488  return (ptr-output);
489 }
#define LINETYPE
Definition: liblwgeom.h:71
uint8_t type
Definition: liblwgeom.h:487
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1489
uint8_t flags
Definition: liblwgeom.h:488
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWGEOM ** geoms
Definition: liblwgeom.h:493
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:107
static size_t asx3d3_line_coords(const LWLINE *line, char *output, int precision, int opts)
Definition: lwout_x3d.c:188
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1487
uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
static size_t asx3d3_mpoly_coordindex(const LWMPOLY *psur, char *output)
Definition: lwout_x3d.c:244
static size_t asx3d3_mline_coordindex(const LWMLINE *mgeom, char *output)
Definition: lwout_x3d.c:198
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
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:318
#define MULTILINETYPE
Definition: liblwgeom.h:74
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: