PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgml3_poly_buf()

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 1015 of file lwout_gml.c.

1016 {
1017  uint32_t i;
1018  char *ptr=output;
1019  int dimension=2;
1020 
1021  if (FLAGS_GET_Z(poly->flags)) dimension = 3;
1022  if (is_patch)
1023  {
1024  ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
1025 
1026  }
1027  else
1028  {
1029  ptr += sprintf(ptr, "<%sPolygon", prefix);
1030  }
1031 
1032  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1033  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1034 
1035  if ( lwpoly_is_empty(poly) )
1036  {
1037  ptr += sprintf(ptr, "/>");
1038  return (ptr-output);
1039  }
1040  ptr += sprintf(ptr, ">");
1041 
1042  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
1043  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1044  else ptr += sprintf(ptr, "<%sposList>", prefix);
1045 
1046  ptr += pointArray_toGML3(poly->rings[0], ptr, precision, opts);
1047  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
1048  prefix, prefix, prefix);
1049  for (i=1; i<poly->nrings; i++)
1050  {
1051  ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
1052  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1053  else ptr += sprintf(ptr, "<%sposList>", prefix);
1054  ptr += pointArray_toGML3(poly->rings[i], ptr, precision, opts);
1055  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
1056  prefix, prefix, prefix);
1057  }
1058  if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
1059  else ptr += sprintf(ptr, "</%sPolygon>", prefix);
1060 
1061  return (ptr-output);
1062 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define IS_DIMS(x)
Definition: liblwgeom.h:1551
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:418
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1890
opts
Definition: ovdump.py:44
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
uint8_t flags
Definition: liblwgeom.h:455
unsigned int uint32_t
Definition: uthash.h:78

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

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

Here is the call graph for this function:
Here is the caller graph for this function: