PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_to_x3d3()

char* lwgeom_to_x3d3 ( const LWGEOM geom,
char *  srs,
int  precision,
int  opts,
const char *  defid 
)

We might change this later, but putting a polygon in an indexed face set seems like the simplest way to go so treat just like a mulitpolygon

Definition at line 48 of file lwout_x3d.c.

References asx3d3_collection(), asx3d3_line(), asx3d3_multi(), asx3d3_point(), asx3d3_psurface(), asx3d3_tin(), asx3d3_triangle(), COLLECTIONTYPE, LINETYPE, lwcollection_free(), lwerror(), lwgeom_as_multi(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, ovdump::type, and LWGEOM::type.

Referenced by do_x3d3_test(), do_x3d3_unsupported(), and LWGEOM_asX3D().

49 {
50  int type = geom->type;
51 
52  switch (type)
53  {
54  case POINTTYPE:
55  return asx3d3_point((LWPOINT*)geom, srs, precision, opts, defid);
56 
57  case LINETYPE:
58  return asx3d3_line((LWLINE*)geom, srs, precision, opts, defid);
59 
60  case POLYGONTYPE:
61  {
66  char *ret = asx3d3_multi(tmp, srs, precision, opts, defid);
67  lwcollection_free(tmp);
68  return ret;
69  }
70 
71  case TRIANGLETYPE:
72  return asx3d3_triangle((LWTRIANGLE*)geom, srs, precision, opts, defid);
73 
74  case MULTIPOINTTYPE:
75  case MULTILINETYPE:
76  case MULTIPOLYGONTYPE:
77  return asx3d3_multi((LWCOLLECTION*)geom, srs, precision, opts, defid);
78 
80  return asx3d3_psurface((LWPSURFACE*)geom, srs, precision, opts, defid);
81 
82  case TINTYPE:
83  return asx3d3_tin((LWTIN*)geom, srs, precision, opts, defid);
84 
85  case COLLECTIONTYPE:
86  return asx3d3_collection((LWCOLLECTION*)geom, srs, precision, opts, defid);
87 
88  default:
89  lwerror("lwgeom_to_x3d3: '%s' geometry type not supported", lwtype_name(type));
90  return NULL;
91  }
92 }
#define LINETYPE
Definition: liblwgeom.h:71
static char * asx3d3_line(const LWLINE *line, char *srs, int precision, int opts, const char *defid)
Return the linestring as an X3D LineSet.
Definition: lwout_x3d.c:289
static char * asx3d3_multi(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:495
static char * asx3d3_point(const LWPOINT *point, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:128
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
static char * asx3d3_tin(const LWTIN *tin, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:671
LWGEOM * lwgeom_as_multi(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate MULTI* type.
Definition: lwgeom.c:284
static char * asx3d3_psurface(const LWPSURFACE *psur, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:588
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define TINTYPE
Definition: liblwgeom.h:84
static char * asx3d3_collection(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:804
uint8_t precision
Definition: cu_in_twkb.c:25
#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
type
Definition: ovdump.py:41
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:326
static char * asx3d3_triangle(const LWTRIANGLE *triangle, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:355
#define MULTILINETYPE
Definition: liblwgeom.h:74
opts
Definition: ovdump.py:44
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: