PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ asgml3_curvepoly_buf()

static size_t asgml3_curvepoly_buf ( const LWCURVEPOLY poly,
const char *  srs,
char *  output,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1258 of file lwout_gml.c.

References asgml3_circstring_buf(), asgml3_compound_buf(), CIRCSTRINGTYPE, COMPOUNDTYPE, LWCURVEPOLY::flags, FLAGS_GET_Z, IS_DIMS, LINETYPE, LWCURVEPOLY::nrings, pointArray_toGML3(), LWCURVEPOLY::rings, and LWGEOM::type.

Referenced by asgml3_curvepoly(), and asgml3_multisurface_buf().

1259 {
1260  int i;
1261  LWGEOM* subgeom;
1262  char *ptr=output;
1263  int dimension=2;
1264 
1265  if (FLAGS_GET_Z(poly->flags))
1266  {
1267  dimension = 3;
1268  }
1269 
1270  ptr += sprintf( ptr, "<%sPolygon", prefix );
1271  if (srs)
1272  {
1273  ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1274  }
1275  if (id)
1276  {
1277  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
1278  }
1279  ptr += sprintf(ptr, ">");
1280 
1281  for( i = 0; i < poly->nrings; ++i )
1282  {
1283  if( i == 0 )
1284  {
1285  ptr += sprintf( ptr, "<%sexterior>", prefix);
1286  }
1287  else
1288  {
1289  ptr += sprintf( ptr, "<%sinterior>", prefix);
1290  }
1291 
1292  subgeom = poly->rings[i];
1293  if ( subgeom->type == LINETYPE )
1294  {
1295  ptr += sprintf( ptr, "<%sLinearRing>", prefix );
1296  ptr += sprintf( ptr, "<%sposList", prefix );
1297  if (IS_DIMS(opts))
1298  {
1299  ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
1300  }
1301  ptr += sprintf( ptr, ">" );
1302  ptr += pointArray_toGML3(((LWLINE*)subgeom)->points, ptr, precision, opts);
1303  ptr += sprintf( ptr, "</%sposList>", prefix );
1304  ptr += sprintf( ptr, "</%sLinearRing>", prefix );
1305  }
1306  else if( subgeom->type == CIRCSTRINGTYPE )
1307  {
1308  ptr += sprintf( ptr, "<%sRing>", prefix );
1309  ptr += sprintf( ptr, "<%scurveMember>", prefix );
1310  ptr += asgml3_circstring_buf( (LWCIRCSTRING*)subgeom, srs, ptr, precision, opts, prefix, id );
1311  ptr += sprintf( ptr, "</%scurveMember>", prefix );
1312  ptr += sprintf( ptr, "</%sRing>", prefix );
1313  }
1314  else if( subgeom->type == COMPOUNDTYPE )
1315  {
1316  ptr += sprintf( ptr, "<%sRing>", prefix );
1317  ptr += sprintf( ptr, "<%scurveMember>", prefix );
1318  ptr += asgml3_compound_buf( (LWCOMPOUND*)subgeom, srs, ptr, precision, opts, prefix, id );
1319  ptr += sprintf( ptr, "</%scurveMember>", prefix );
1320  ptr += sprintf( ptr, "</%sRing>", prefix );
1321  }
1322 
1323  if( i == 0 )
1324  {
1325  ptr += sprintf( ptr, "</%sexterior>", prefix);
1326  }
1327  else
1328  {
1329  ptr += sprintf( ptr, "</%sinterior>", prefix);
1330  }
1331  }
1332 
1333  ptr += sprintf( ptr, "</%sPolygon>", prefix );
1334  return (ptr - output);
1335 }
#define LINETYPE
Definition: liblwgeom.h:86
LWGEOM ** rings
Definition: liblwgeom.h:535
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
static size_t asgml3_compound_buf(const LWCOMPOUND *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1138
static size_t asgml3_circstring_buf(const LWCIRCSTRING *circ, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:962
#define IS_DIMS(x)
Definition: liblwgeom.h:1544
uint8_t precision
Definition: cu_in_twkb.c:25
uint8_t flags
Definition: liblwgeom.h:530
#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 type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
opts
Definition: ovdump.py:44
Here is the call graph for this function:
Here is the caller graph for this function: