PostGIS  2.4.9dev-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 874 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().

875 {
876  char *ptr=output;
877  int dimension=2;
878  int shortline = ( opts & LW_GML_SHORTLINE );
879 
880  if (FLAGS_GET_Z(line->flags)) dimension = 3;
881 
882  if ( shortline )
883  {
884  ptr += sprintf(ptr, "<%sLineString", prefix);
885  }
886  else
887  {
888  ptr += sprintf(ptr, "<%sCurve", prefix);
889  }
890 
891  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
892  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
893 
894  if ( lwline_is_empty(line) )
895  {
896  ptr += sprintf(ptr, "/>");
897  return (ptr-output);
898  }
899  ptr += sprintf(ptr, ">");
900 
901  if ( ! shortline )
902  {
903  ptr += sprintf(ptr, "<%ssegments>", prefix);
904  ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
905  }
906 
907  if (IS_DIMS(opts))
908  {
909  ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
910  prefix, dimension);
911  }
912  else
913  {
914  ptr += sprintf(ptr, "<%sposList>", prefix);
915  }
916 
917  ptr += pointArray_toGML3(line->points, ptr, precision, opts);
918 
919  ptr += sprintf(ptr, "</%sposList>", prefix);
920 
921  if ( shortline )
922  {
923  ptr += sprintf(ptr, "</%sLineString>", prefix);
924  }
925  else
926  {
927  ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
928  ptr += sprintf(ptr, "</%ssegments>", prefix);
929  ptr += sprintf(ptr, "</%sCurve>", prefix);
930  }
931 
932  return (ptr-output);
933 }
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition: liblwgeom.h:1539
#define IS_DIMS(x)
Definition: liblwgeom.h:1544
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:140
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:525
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
Definition: lwout_gml.c:1909
opts
Definition: ovdump.py:44
uint8_t flags
Definition: liblwgeom.h:419
POINTARRAY * points
Definition: liblwgeom.h:422
Here is the call graph for this function:
Here is the caller graph for this function: