PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asx3d3_multi_sb()

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

Use Polypoint2D instead

Definition at line 282 of file lwout_x3d.c.

283{
284 char *x3dtype;
285 uint32_t i;
286 int dimension=2;
287
288 if (FLAGS_GET_Z(col->flags)) dimension = 3;
289 LWGEOM *subgeom;
290 x3dtype="";
291
292
293 switch (col->type)
294 {
295 case MULTIPOINTTYPE:
296 x3dtype = "PointSet";
297 if ( dimension == 2 ){
298 x3dtype = "Polypoint2D";
299 stringbuffer_aprintf(sb, "<%s %s point='", x3dtype, defid);
300 }
301 else {
302 stringbuffer_aprintf(sb, "<%s %s>", x3dtype, defid);
303 }
304 break;
305 case MULTILINETYPE:
306 x3dtype = "IndexedLineSet";
307 stringbuffer_aprintf(sb, "<%s %s coordIndex='", x3dtype, defid);
308 asx3d3_mline_coordindex_sb((const LWMLINE *)col, sb);
309 stringbuffer_aprintf(sb, "'>");
310 break;
311 case MULTIPOLYGONTYPE:
312 x3dtype = "IndexedFaceSet";
313 stringbuffer_aprintf(sb, "<%s %s convex='false' coordIndex='", x3dtype, defid);
314 asx3d3_mpoly_coordindex_sb((const LWMPOLY *)col, sb);
315 stringbuffer_aprintf(sb, "'>");
316 break;
317 default:
318 lwerror("asx3d3_multi_buf: '%s' geometry type not supported", lwtype_name(col->type));
319 return 0;
320 }
321 if (dimension == 3){
322 if ( X3D_USE_GEOCOORDS(opts) )
323 stringbuffer_aprintf(sb, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
324 else
325 stringbuffer_aprintf(sb, "<Coordinate point='");
326 }
327
328 for (i=0; i<col->ngeoms; i++)
329 {
330 subgeom = col->geoms[i];
331 if (subgeom->type == POINTTYPE)
332 {
333 asx3d3_point_sb((LWPOINT *)subgeom, precision, opts, defid, sb);
334 stringbuffer_aprintf(sb, " ");
335 }
336 else if (subgeom->type == LINETYPE)
337 {
338 asx3d3_line_coords_sb((LWLINE*)subgeom, precision, opts, sb);
339 stringbuffer_aprintf(sb, " ");
340 }
341 else if (subgeom->type == POLYGONTYPE)
342 {
343 asx3d3_poly_sb((LWPOLY *)subgeom, precision, opts, 0, defid, sb);
344 stringbuffer_aprintf(sb, " ");
345 }
346 }
347
348 /* Close outmost tag */
349 if (dimension == 3){
350 stringbuffer_aprintf(sb, "' /></%s>", x3dtype);
351 }
352 else { stringbuffer_aprintf(sb, "' />"); }
353 return LW_SUCCESS;
354
355}
static uint8_t precision
Definition cu_in_twkb.c:25
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define MULTILINETYPE
Definition liblwgeom.h:106
#define LINETYPE
Definition liblwgeom.h:103
#define LW_SUCCESS
Definition liblwgeom.h:97
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition liblwgeom.h:1730
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define X3D_USE_GEOCOORDS(x)
Definition liblwgeom.h:1732
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int asx3d3_point_sb(const LWPOINT *point, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:113
static int asx3d3_poly_sb(const LWPOLY *poly, 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:251
static int asx3d3_mpoly_coordindex_sb(const LWMPOLY *psur, stringbuffer_t *sb)
Definition lwout_x3d.c:177
static int asx3d3_line_coords_sb(const LWLINE *line, int precision, int opts, stringbuffer_t *sb)
Definition lwout_x3d.c:124
static int asx3d3_mline_coordindex_sb(const LWMLINE *mgeom, stringbuffer_t *sb)
Definition lwout_x3d.c:132
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.
lwflags_t flags
Definition liblwgeom.h:577
uint32_t ngeoms
Definition liblwgeom.h:580
uint8_t type
Definition liblwgeom.h:578
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

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, 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: