PostGIS  2.5.0beta1dev-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.

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(), asgml3_multi_buf(), and asgml3_multicurve_buf().

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 }
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition: liblwgeom.h:1545
#define IS_DIMS(x)
Definition: liblwgeom.h:1550
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:139
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:421
POINTARRAY * points
Definition: liblwgeom.h:424
Here is the call graph for this function:
Here is the caller graph for this function: