PostGIS  2.4.9dev-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 1034 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().

1035 {
1036  int i;
1037  char *ptr=output;
1038  int dimension=2;
1039 
1040  if (FLAGS_GET_Z(poly->flags)) dimension = 3;
1041  if (is_patch)
1042  {
1043  ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
1044 
1045  }
1046  else
1047  {
1048  ptr += sprintf(ptr, "<%sPolygon", prefix);
1049  }
1050 
1051  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1052  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1053 
1054  if ( lwpoly_is_empty(poly) )
1055  {
1056  ptr += sprintf(ptr, "/>");
1057  return (ptr-output);
1058  }
1059  ptr += sprintf(ptr, ">");
1060 
1061  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
1062  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1063  else ptr += sprintf(ptr, "<%sposList>", prefix);
1064 
1065  ptr += pointArray_toGML3(poly->rings[0], ptr, precision, opts);
1066  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
1067  prefix, prefix, prefix);
1068  for (i=1; i<poly->nrings; i++)
1069  {
1070  ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
1071  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
1072  else ptr += sprintf(ptr, "<%sposList>", prefix);
1073  ptr += pointArray_toGML3(poly->rings[i], ptr, precision, opts);
1074  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
1075  prefix, prefix, prefix);
1076  }
1077  if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
1078  else ptr += sprintf(ptr, "</%sPolygon>", prefix);
1079 
1080  return (ptr-output);
1081 }
#define IS_DIMS(x)
Definition: liblwgeom.h:1544
POINTARRAY ** rings
Definition: liblwgeom.h:457
uint8_t precision
Definition: cu_in_twkb.c:25
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:445
int nrings
Definition: liblwgeom.h:455
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1909
uint8_t flags
Definition: liblwgeom.h:452
opts
Definition: ovdump.py:44
Here is the call graph for this function:
Here is the caller graph for this function: