PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgml3_line_buf ( const LWLINE line,
const char *  srs,
char *  output,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 833 of file lwout_gml.c.

References LWLINE::flags, FLAGS_GET_Z, IS_DIMS, LW_GML_SHORTLINE, lwline_is_empty(), pointArray_toGML3(), and LWLINE::points.

Referenced by asgml3_collection_buf(), asgml3_line(), and asgml3_multi_buf().

834 {
835  char *ptr=output;
836  int dimension=2;
837  int shortline = ( opts & LW_GML_SHORTLINE );
838 
839  if (FLAGS_GET_Z(line->flags)) dimension = 3;
840 
841  if ( shortline ) {
842  ptr += sprintf(ptr, "<%sLineString", prefix);
843  } else {
844  ptr += sprintf(ptr, "<%sCurve", prefix);
845  }
846 
847  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
848  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
849 
850  if ( lwline_is_empty(line) ) {
851  ptr += sprintf(ptr, "/>");
852  return (ptr-output);
853  }
854  ptr += sprintf(ptr, ">");
855 
856  if ( ! shortline ) {
857  ptr += sprintf(ptr, "<%ssegments>", prefix);
858  ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
859  }
860 
861  if (IS_DIMS(opts)) {
862  ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
863  prefix, dimension);
864  } else {
865  ptr += sprintf(ptr, "<%sposList>", prefix);
866  }
867 
868  ptr += pointArray_toGML3(line->points, ptr, precision, opts);
869 
870  ptr += sprintf(ptr, "</%sposList>", prefix);
871 
872  if ( shortline ) {
873  ptr += sprintf(ptr, "</%sLineString>", prefix);
874  } else {
875  ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
876  ptr += sprintf(ptr, "</%ssegments>", prefix);
877  ptr += sprintf(ptr, "</%sCurve>", prefix);
878  }
879 
880  return (ptr-output);
881 }
#define LW_GML_SHORTLINE
For GML3, use rather than for lines.
Definition: liblwgeom.h:1362
#define IS_DIMS(x)
Definition: liblwgeom.h:1367
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:464
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1393
uint8_t flags
Definition: liblwgeom.h:375
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: