PostGIS  2.1.10dev-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 917 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_poly(), and asgml3_psurface_buf().

918 {
919  int i;
920  char *ptr=output;
921  int dimension=2;
922 
923  if (FLAGS_GET_Z(poly->flags)) dimension = 3;
924  if (is_patch)
925  {
926  ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
927 
928  }
929  else
930  {
931  ptr += sprintf(ptr, "<%sPolygon", prefix);
932  }
933 
934  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
935  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
936 
937  if ( lwpoly_is_empty(poly) ) {
938  ptr += sprintf(ptr, "/>");
939  return (ptr-output);
940  }
941  ptr += sprintf(ptr, ">");
942 
943  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
944  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
945  else ptr += sprintf(ptr, "<%sposList>", prefix);
946 
947  ptr += pointArray_toGML3(poly->rings[0], ptr, precision, opts);
948  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
949  prefix, prefix, prefix);
950  for (i=1; i<poly->nrings; i++)
951  {
952  ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
953  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
954  else ptr += sprintf(ptr, "<%sposList>", prefix);
955  ptr += pointArray_toGML3(poly->rings[i], ptr, precision, opts);
956  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
957  prefix, prefix, prefix);
958  }
959  if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
960  else ptr += sprintf(ptr, "</%sPolygon>", prefix);
961 
962  return (ptr-output);
963 }
#define IS_DIMS(x)
Definition: liblwgeom.h:1367
POINTARRAY ** rings
Definition: liblwgeom.h:413
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:327
int nrings
Definition: liblwgeom.h:411
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1393
uint8_t flags
Definition: liblwgeom.h:408

Here is the call graph for this function:

Here is the caller graph for this function: