PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ asgml3_compound_buf()

static size_t asgml3_compound_buf ( const LWCOMPOUND col,
const char *  srs,
char *  output,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1138 of file lwout_gml.c.

References CIRCSTRINGTYPE, LWCOMPOUND::flags, FLAGS_GET_Z, LWCOMPOUND::geoms, IS_DIMS, LINETYPE, LWCOMPOUND::ngeoms, pointArray_toGML3(), and LWGEOM::type.

Referenced by asgml3_compound(), asgml3_curvepoly_buf(), and asgml3_multicurve_buf().

1139 {
1140  LWGEOM *subgeom;
1141  int i;
1142  char* ptr = output;
1143  int dimension=2;
1144 
1145  if (FLAGS_GET_Z(col->flags))
1146  {
1147  dimension = 3;
1148  }
1149 
1150  ptr += sprintf( ptr, "<%sCurve", prefix );
1151  if (srs)
1152  {
1153  ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1154  }
1155  if (id)
1156  {
1157  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
1158  }
1159  ptr += sprintf( ptr, ">" );
1160  ptr += sprintf( ptr, "<%ssegments>", prefix );
1161 
1162  for( i = 0; i < col->ngeoms; ++i )
1163  {
1164  subgeom = col->geoms[i];
1165  if( subgeom->type != LINETYPE && subgeom->type != CIRCSTRINGTYPE )
1166  {
1167  continue;
1168  }
1169 
1170  if ( subgeom->type == LINETYPE )
1171  {
1172  ptr += sprintf( ptr, "<%sLineStringSegment><%sposList", prefix, prefix );
1173  if (IS_DIMS(opts))
1174  {
1175  ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
1176  }
1177  ptr += sprintf(ptr, ">");
1178  ptr += pointArray_toGML3(((LWCIRCSTRING*)subgeom)->points, ptr, precision, opts);
1179  ptr += sprintf( ptr, "</%sposList></%sLineStringSegment>", prefix, prefix );
1180  }
1181  else if( subgeom->type == CIRCSTRINGTYPE )
1182  {
1183  ptr += sprintf( ptr, "<%sArcString><%sposList" , prefix, prefix );
1184  if (IS_DIMS(opts))
1185  {
1186  ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
1187  }
1188  ptr += sprintf(ptr, ">");
1189  ptr += pointArray_toGML3(((LWLINE*)subgeom)->points, ptr, precision, opts);
1190  ptr += sprintf( ptr, "</%sposList></%sArcString>", prefix, prefix );
1191  }
1192  }
1193 
1194  ptr += sprintf( ptr, "</%ssegments>", prefix );
1195  ptr += sprintf( ptr, "</%sCurve>", prefix );
1196  return ( ptr - output );
1197 }
#define LINETYPE
Definition: liblwgeom.h:86
LWGEOM ** geoms
Definition: liblwgeom.h:522
uint8_t flags
Definition: liblwgeom.h:517
#define IS_DIMS(x)
Definition: liblwgeom.h:1544
uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
int ngeoms
Definition: liblwgeom.h:520
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: