PostGIS  2.2.7dev-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 861 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: