PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 49 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, and LWGEOM::type.

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

50 {
51  int type = geom->type;
52 
53  switch (type)
54  {
55  case POINTTYPE:
56  return asx3d3_point((LWPOINT*)geom, srs, precision, opts, defid);
57 
58  case LINETYPE:
59  return asx3d3_line((LWLINE*)geom, srs, precision, opts, defid);
60 
61  case POLYGONTYPE:
62  {
67  char *ret = asx3d3_multi(tmp, srs, precision, opts, defid);
68  lwcollection_free(tmp);
69  return ret;
70  }
71 
72  case TRIANGLETYPE:
73  return asx3d3_triangle((LWTRIANGLE*)geom, srs, precision, opts, defid);
74 
75  case MULTIPOINTTYPE:
76  case MULTILINETYPE:
77  case MULTIPOLYGONTYPE:
78  return asx3d3_multi((LWCOLLECTION*)geom, srs, precision, opts, defid);
79 
81  return asx3d3_psurface((LWPSURFACE*)geom, srs, precision, opts, defid);
82 
83  case TINTYPE:
84  return asx3d3_tin((LWTIN*)geom, srs, precision, opts, defid);
85 
86  case COLLECTIONTYPE:
87  return asx3d3_collection((LWCOLLECTION*)geom, srs, precision, opts, defid);
88 
89  default:
90  lwerror("lwgeom_to_x3d3: '%s' geometry type not supported", lwtype_name(type));
91  return NULL;
92  }
93 }
#define LINETYPE
Definition: liblwgeom.h:61
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:282
static char * asx3d3_multi(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:481
static char * asx3d3_point(const LWPOINT *point, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:129
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
static char * asx3d3_tin(const LWTIN *tin, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:651
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:570
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define TINTYPE
Definition: liblwgeom.h:74
static char * asx3d3_collection(const LWCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:760
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:316
static char * asx3d3_triangle(const LWTRIANGLE *triangle, char *srs, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:348
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: