PostGIS  2.2.7dev-r@@SVN_REVISION@@
static size_t asgml3_poly_buf ( const LWPOLY poly,
const char *  srs,
char *  output,
int  precision,
int  opts,
int  is_patch,
const char *  prefix,
const char *  id 
)
static

Definition at line 1021 of file lwout_gml.c.

References LWPOLY::flags, FLAGS_GET_Z, IS_DIMS, lwpoly_is_empty(), LWPOLY::nrings, pointArray_toGML3(), and LWPOLY::rings.

Referenced by asgml3_collection_buf(), asgml3_multi_buf(), asgml3_multisurface_buf(), asgml3_poly(), and asgml3_psurface_buf().

1022 {
1023  int i;
1024  char *ptr=output;
1025  int dimension=2;
1026 
1027  if (FLAGS_GET_Z(poly->flags)) dimension = 3;
1028  if (is_patch)
1029  {
1030  ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
1031 
1032  }
1033  else
1034  {
1035  ptr += sprintf(ptr, "<%sPolygon", prefix);
1036  }
1037 
1038  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1039  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1040 
1041  if ( lwpoly_is_empty(poly) )
1042  {
1043  ptr += sprintf(ptr, "/>");
1044  return (ptr-output);
1045  }
1046  ptr += sprintf(ptr, ">");
1047 
1048  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
1049  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1050  else ptr += sprintf(ptr, "<%sposList>", prefix);
1051 
1052  ptr += pointArray_toGML3(poly->rings[0], ptr, precision, opts);
1053  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
1054  prefix, prefix, prefix);
1055  for (i=1; i<poly->nrings; i++)
1056  {
1057  ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
1058  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1059  else ptr += sprintf(ptr, "<%sposList>", prefix);
1060  ptr += pointArray_toGML3(poly->rings[i], ptr, precision, opts);
1061  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
1062  prefix, prefix, prefix);
1063  }
1064  if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
1065  else ptr += sprintf(ptr, "</%sPolygon>", prefix);
1066 
1067  return (ptr-output);
1068 }
#define IS_DIMS(x)
Definition: liblwgeom.h:1478
POINTARRAY ** rings
Definition: liblwgeom.h:441
uint8_t precision
Definition: cu_in_twkb.c:25
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:332
int nrings
Definition: liblwgeom.h:439
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1896
uint8_t flags
Definition: liblwgeom.h:436

Here is the call graph for this function:

Here is the caller graph for this function: