PostGIS  3.1.6dev-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 863 of file lwout_gml.c.

864 {
865  char *ptr=output;
866  int dimension=2;
867  int shortline = ( opts & LW_GML_SHORTLINE );
868 
869  if (FLAGS_GET_Z(line->flags)) dimension = 3;
870 
871  if ( shortline )
872  {
873  ptr += sprintf(ptr, "<%sLineString", prefix);
874  }
875  else
876  {
877  ptr += sprintf(ptr, "<%sCurve", prefix);
878  }
879 
880  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
881  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
882 
883  if ( lwline_is_empty(line) )
884  {
885  ptr += sprintf(ptr, "/>");
886  return (ptr-output);
887  }
888  ptr += sprintf(ptr, ">");
889 
890  if ( ! shortline )
891  {
892  ptr += sprintf(ptr, "<%ssegments>", prefix);
893  ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
894  }
895 
896  if (IS_DIMS(opts))
897  {
898  ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
899  prefix, dimension);
900  }
901  else
902  {
903  ptr += sprintf(ptr, "<%sposList>", prefix);
904  }
905 
906  ptr += pointArray_toGML3(line->points, ptr, precision, opts);
907 
908  ptr += sprintf(ptr, "</%sposList>", prefix);
909 
910  if ( shortline )
911  {
912  ptr += sprintf(ptr, "</%sLineString>", prefix);
913  }
914  else
915  {
916  ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
917  ptr += sprintf(ptr, "</%ssegments>", prefix);
918  ptr += sprintf(ptr, "</%sCurve>", prefix);
919  }
920 
921  return (ptr-output);
922 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define IS_DIMS(x)
Definition: liblwgeom.h:1682
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition: liblwgeom.h:1677
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
int lwline_is_empty(const LWLINE *line)
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1897
opts
Definition: ovdump.py:45
lwflags_t flags
Definition: liblwgeom.h:499
POINTARRAY * points
Definition: liblwgeom.h:497

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: