PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ lwgeom_to_gml3()

char* lwgeom_to_gml3 ( const LWGEOM geom,
const char *  srs,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)

Definition at line 717 of file lwout_gml.c.

References asgml3_circstring(), asgml3_collection(), asgml3_compound(), asgml3_curvepoly(), asgml3_line(), asgml3_multi(), asgml3_multicurve(), asgml3_multisurface(), asgml3_point(), asgml3_poly(), asgml3_psurface(), asgml3_tin(), asgml3_triangle(), CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwerror(), lwgeom_is_empty(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, ovdump::type, and LWGEOM::type.

Referenced by do_gml3_test(), do_gml3_test_nodims(), do_gml3_test_opts(), do_gml3_test_prefix(), geography_as_gml(), and LWGEOM_asGML().

718 {
719  int type = geom->type;
720 
721  /* Return null for empty (#1377) */
722  if ( lwgeom_is_empty(geom) )
723  return NULL;
724 
725  switch (type)
726  {
727  case POINTTYPE:
728  return asgml3_point((LWPOINT*)geom, srs, precision, opts, prefix, id);
729 
730  case LINETYPE:
731  return asgml3_line((LWLINE*)geom, srs, precision, opts, prefix, id);
732 
733  case CIRCSTRINGTYPE:
734  return asgml3_circstring((LWCIRCSTRING*)geom, srs, precision, opts, prefix, id );
735 
736  case POLYGONTYPE:
737  return asgml3_poly((LWPOLY*)geom, srs, precision, opts, 0, prefix, id);
738 
739  case CURVEPOLYTYPE:
740  return asgml3_curvepoly((LWCURVEPOLY*)geom, srs, precision, opts, prefix, id);
741 
742  case TRIANGLETYPE:
743  return asgml3_triangle((LWTRIANGLE*)geom, srs, precision, opts, prefix, id);
744 
745  case MULTIPOINTTYPE:
746  case MULTILINETYPE:
747  case MULTIPOLYGONTYPE:
748  return asgml3_multi((LWCOLLECTION*)geom, srs, precision, opts, prefix, id);
749 
751  return asgml3_psurface((LWPSURFACE*)geom, srs, precision, opts, prefix, id);
752 
753  case TINTYPE:
754  return asgml3_tin((LWTIN*)geom, srs, precision, opts, prefix, id);
755 
756  case COLLECTIONTYPE:
757  return asgml3_collection((LWCOLLECTION*)geom, srs, precision, opts, prefix, id);
758 
759  case COMPOUNDTYPE:
760  return asgml3_compound( (LWCOMPOUND*)geom, srs, precision, opts, prefix, id );
761 
762  case MULTICURVETYPE:
763  return asgml3_multicurve( (LWMCURVE*)geom, srs, precision, opts, prefix, id );
764 
765  case MULTISURFACETYPE:
766  return asgml3_multisurface( (LWMSURFACE*)geom, srs, precision, opts, prefix, id );
767 
768  default:
769  lwerror("lwgeom_to_gml3: '%s' geometry type not supported", lwtype_name(type));
770  return NULL;
771  }
772 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
static char * asgml3_triangle(const LWTRIANGLE *triangle, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1373
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
static char * asgml3_psurface(const LWPSURFACE *psur, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1555
static char * asgml3_point(const LWPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:815
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwinline.h:172
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
static char * asgml3_compound(const LWCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1181
static char * asgml3_poly(const LWPOLY *poly, const char *srs, int precision, int opts, int is_patch, const char *prefix, const char *id)
Definition: lwout_gml.c:1065
#define TINTYPE
Definition: liblwgeom.h:98
static char * asgml3_multi(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1490
uint8_t precision
Definition: cu_in_twkb.c:25
static char * asgml3_multisurface(const LWMSURFACE *sur, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1876
static char * asgml3_multicurve(const LWMCURVE *cur, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1810
static char * asgml3_line(const LWLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:917
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
static char * asgml3_collection(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1731
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
opts
Definition: ovdump.py:44
static char * asgml3_curvepoly(const LWCURVEPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1318
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static char * asgml3_tin(const LWTIN *tin, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1620
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
static char * asgml3_circstring(const LWCIRCSTRING *circ, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:982
Here is the call graph for this function:
Here is the caller graph for this function: