PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ asx3d3_multi_buf()

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 437 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, LWMPOLY::type, LWCOLLECTION::type, and X3D_USE_GEOCOORDS.

Referenced by asx3d3_collection_buf(), and asx3d3_multi().

438 {
439  char *ptr, *x3dtype;
440  int i;
441  int dimension=2;
442 
443  if (FLAGS_GET_Z(col->flags)) dimension = 3;
444  LWGEOM *subgeom;
445  ptr = output;
446  x3dtype="";
447 
448 
449  switch (col->type)
450  {
451  case MULTIPOINTTYPE:
452  x3dtype = "PointSet";
453  if ( dimension == 2 ){
454  x3dtype = "Polypoint2D";
455  ptr += sprintf(ptr, "<%s %s point='", x3dtype, defid);
456  }
457  else {
458  ptr += sprintf(ptr, "<%s %s>", x3dtype, defid);
459  }
460  break;
461  case MULTILINETYPE:
462  x3dtype = "IndexedLineSet";
463  ptr += sprintf(ptr, "<%s %s coordIndex='", x3dtype, defid);
464  ptr += asx3d3_mline_coordindex((const LWMLINE *)col, ptr);
465  ptr += sprintf(ptr, "'>");
466  break;
467  case MULTIPOLYGONTYPE:
468  x3dtype = "IndexedFaceSet";
469  ptr += sprintf(ptr, "<%s %s convex='false' coordIndex='", x3dtype, defid);
470  ptr += asx3d3_mpoly_coordindex((const LWMPOLY *)col, ptr);
471  ptr += sprintf(ptr, "'>");
472  break;
473  default:
474  lwerror("asx3d3_multi_buf: '%s' geometry type not supported", lwtype_name(col->type));
475  return 0;
476  }
477  if (dimension == 3){
478  if ( X3D_USE_GEOCOORDS(opts) )
479  ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
480  else
481  ptr += sprintf(ptr, "<Coordinate point='");
482  }
483 
484  for (i=0; i<col->ngeoms; i++)
485  {
486  subgeom = col->geoms[i];
487  if (subgeom->type == POINTTYPE)
488  {
489  ptr += asx3d3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, defid);
490  ptr += sprintf(ptr, " ");
491  }
492  else if (subgeom->type == LINETYPE)
493  {
494  ptr += asx3d3_line_coords((LWLINE*)subgeom, ptr, precision, opts);
495  ptr += sprintf(ptr, " ");
496  }
497  else if (subgeom->type == POLYGONTYPE)
498  {
499  ptr += asx3d3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
500  ptr += sprintf(ptr, " ");
501  }
502  }
503 
504  /* Close outmost tag */
505  if (dimension == 3){
506  ptr += sprintf(ptr, "' /></%s>", x3dtype);
507  }
508  else { ptr += sprintf(ptr, "' />"); }
509  return (ptr-output);
510 }
#define LINETYPE
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:502
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1533
uint8_t flags
Definition: liblwgeom.h:503
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
LWGEOM ** geoms
Definition: liblwgeom.h:508
static size_t asx3d3_point_buf(const LWPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:128
static size_t asx3d3_line_coords(const LWLINE *line, char *output, int precision, int opts)
Definition: lwout_x3d.c:209
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1531
uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:139
static size_t asx3d3_mpoly_coordindex(const LWMPOLY *psur, char *output)
Definition: lwout_x3d.c:265
static size_t asx3d3_mline_coordindex(const LWMLINE *mgeom, char *output)
Definition: lwout_x3d.c:219
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
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:339
#define MULTILINETYPE
Definition: liblwgeom.h:88
opts
Definition: ovdump.py:44
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
Here is the call graph for this function:
Here is the caller graph for this function: