PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asx3d3_multi_sb()

static int asx3d3_multi_sb ( const LWCOLLECTION col,
__attribute__((__unused__)) char *  srs,
int  precision,
int  opts,
const char *  defid,
stringbuffer_t sb 
)
static

Use Polypoint2D instead

Definition at line 270 of file lwout_x3d.c.

271 {
272  char *x3dtype;
273  uint32_t i;
274  int dimension=2;
275 
276  if (FLAGS_GET_Z(col->flags)) dimension = 3;
277  LWGEOM *subgeom;
278  x3dtype="";
279 
280 
281  switch (col->type)
282  {
283  case MULTIPOINTTYPE:
284  x3dtype = "PointSet";
285  if ( dimension == 2 ){
286  x3dtype = "Polypoint2D";
287  stringbuffer_aprintf(sb, "<%s %s point='", x3dtype, defid);
288  }
289  else {
290  stringbuffer_aprintf(sb, "<%s %s>", x3dtype, defid);
291  }
292  break;
293  case MULTILINETYPE:
294  x3dtype = "IndexedLineSet";
295  stringbuffer_aprintf(sb, "<%s %s coordIndex='", x3dtype, defid);
296  asx3d3_mline_coordindex_sb((const LWMLINE *)col, sb);
297  stringbuffer_aprintf(sb, "'>");
298  break;
299  case MULTIPOLYGONTYPE:
300  x3dtype = "IndexedFaceSet";
301  stringbuffer_aprintf(sb, "<%s %s convex='false' coordIndex='", x3dtype, defid);
302  asx3d3_mpoly_coordindex_sb((const LWMPOLY *)col, sb);
303  stringbuffer_aprintf(sb, "'>");
304  break;
305  default:
306  lwerror("asx3d3_multi_buf: '%s' geometry type not supported", lwtype_name(col->type));
307  return 0;
308  }
309  if (dimension == 3){
310  if ( X3D_USE_GEOCOORDS(opts) )
311  stringbuffer_aprintf(sb, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
312  else
313  stringbuffer_aprintf(sb, "<Coordinate point='");
314  }
315 
316  for (i=0; i<col->ngeoms; i++)
317  {
318  subgeom = col->geoms[i];
319  if (subgeom->type == POINTTYPE)
320  {
321  asx3d3_point_sb((LWPOINT*)subgeom, 0, precision, opts, defid, sb);
322  stringbuffer_aprintf(sb, " ");
323  }
324  else if (subgeom->type == LINETYPE)
325  {
326  asx3d3_line_coords_sb((LWLINE*)subgeom, precision, opts, sb);
327  stringbuffer_aprintf(sb, " ");
328  }
329  else if (subgeom->type == POLYGONTYPE)
330  {
331  asx3d3_poly_sb((LWPOLY*)subgeom, 0, precision, opts, 0, defid, sb);
332  stringbuffer_aprintf(sb, " ");
333  }
334  }
335 
336  /* Close outmost tag */
337  if (dimension == 3){
338  stringbuffer_aprintf(sb, "' /></%s>", x3dtype);
339  }
340  else { stringbuffer_aprintf(sb, "' />"); }
341  return LW_SUCCESS;
342 
343 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LINETYPE
Definition: liblwgeom.h:86
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition: liblwgeom.h:1560
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define X3D_USE_GEOCOORDS(x)
Definition: liblwgeom.h:1562
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static int asx3d3_mpoly_coordindex_sb(const LWMPOLY *psur, stringbuffer_t *sb)
Definition: lwout_x3d.c:175
static int asx3d3_line_coords_sb(const LWLINE *line, int precision, int opts, stringbuffer_t *sb)
Definition: lwout_x3d.c:122
static int asx3d3_point_sb(const LWPOINT *point, __attribute__((__unused__)) char *srs, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Definition: lwout_x3d.c:114
static int asx3d3_mline_coordindex_sb(const LWMLINE *mgeom, stringbuffer_t *sb)
Definition: lwout_x3d.c:130
static int asx3d3_poly_sb(const LWPOLY *poly, __attribute__((__unused__)) char *srs, int precision, int opts, __attribute__((__unused__)) int is_patch, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Compute the X3D coordinates of the polygon and add to string buffer.
Definition: lwout_x3d.c:246
opts
Definition: ovdump.py:44
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
Definition: stringbuffer.c:253
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t type
Definition: liblwgeom.h:506
uint8_t flags
Definition: liblwgeom.h:507
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

References asx3d3_line_coords_sb(), asx3d3_mline_coordindex_sb(), asx3d3_mpoly_coordindex_sb(), asx3d3_point_sb(), asx3d3_poly_sb(), LWCOLLECTION::flags, FLAGS_GET_Z, LWCOLLECTION::geoms, LINETYPE, LW_SUCCESS, LW_X3D_FLIP_XY, lwerror(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, ovdump::opts, POINTTYPE, POLYGONTYPE, precision, stringbuffer_aprintf(), LWGEOM::type, LWMLINE::type, LWCOLLECTION::type, and X3D_USE_GEOCOORDS.

Referenced by asx3d3_collection_sb(), and lwgeom_to_x3d3_sb().

Here is the call graph for this function:
Here is the caller graph for this function: