PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgml3_line_buf()

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

856 {
857  char *ptr=output;
858  int dimension=2;
859  int shortline = ( opts & LW_GML_SHORTLINE );
860 
861  if (FLAGS_GET_Z(line->flags)) dimension = 3;
862 
863  if ( shortline )
864  {
865  ptr += sprintf(ptr, "<%sLineString", prefix);
866  }
867  else
868  {
869  ptr += sprintf(ptr, "<%sCurve", prefix);
870  }
871 
872  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
873  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
874 
875  if ( lwline_is_empty(line) )
876  {
877  ptr += sprintf(ptr, "/>");
878  return (ptr-output);
879  }
880  ptr += sprintf(ptr, ">");
881 
882  if ( ! shortline )
883  {
884  ptr += sprintf(ptr, "<%ssegments>", prefix);
885  ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
886  }
887 
888  if (IS_DIMS(opts))
889  {
890  ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
891  prefix, dimension);
892  }
893  else
894  {
895  ptr += sprintf(ptr, "<%sposList>", prefix);
896  }
897 
898  ptr += pointArray_toGML3(line->points, ptr, precision, opts);
899 
900  ptr += sprintf(ptr, "</%sposList>", prefix);
901 
902  if ( shortline )
903  {
904  ptr += sprintf(ptr, "</%sLineString>", prefix);
905  }
906  else
907  {
908  ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
909  ptr += sprintf(ptr, "</%ssegments>", prefix);
910  ptr += sprintf(ptr, "</%sCurve>", prefix);
911  }
912 
913  return (ptr-output);
914 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define IS_DIMS(x)
Definition: liblwgeom.h:1551
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition: liblwgeom.h:1546
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:511
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1890
opts
Definition: ovdump.py:44
uint8_t flags
Definition: liblwgeom.h:422
POINTARRAY * points
Definition: liblwgeom.h:425

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

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

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