PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

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

855{
856 char *ptr=output;
857 int dimension=2;
858 int shortline = ( opts & LW_GML_SHORTLINE );
859
860 if (FLAGS_GET_Z(line->flags)) dimension = 3;
861
862 if ( shortline )
863 {
864 ptr += sprintf(ptr, "<%sLineString", prefix);
865 }
866 else
867 {
868 ptr += sprintf(ptr, "<%sCurve", prefix);
869 }
870
871 if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
872 if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
873
874 if ( lwline_is_empty(line) )
875 {
876 ptr += sprintf(ptr, "/>");
877 return (ptr-output);
878 }
879 ptr += sprintf(ptr, ">");
880
881 if ( ! shortline )
882 {
883 ptr += sprintf(ptr, "<%ssegments>", prefix);
884 ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
885 }
886
887 if (IS_DIMS(opts))
888 {
889 ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
890 prefix, dimension);
891 }
892 else
893 {
894 ptr += sprintf(ptr, "<%sposList>", prefix);
895 }
896
897 ptr += pointArray_toGML3(line->points, ptr, precision, opts);
898
899 ptr += sprintf(ptr, "</%sposList>", prefix);
900
901 if ( shortline )
902 {
903 ptr += sprintf(ptr, "</%sLineString>", prefix);
904 }
905 else
906 {
907 ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
908 ptr += sprintf(ptr, "</%ssegments>", prefix);
909 ptr += sprintf(ptr, "</%sCurve>", prefix);
910 }
911
912 return (ptr-output);
913}
static uint8_t precision
Definition cu_in_twkb.c:25
#define IS_DIMS(x)
Definition liblwgeom.h:1657
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition liblwgeom.h:1652
#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:1889
lwflags_t flags
Definition liblwgeom.h:471
POINTARRAY * points
Definition liblwgeom.h:469

References LWLINE::flags, FLAGS_GET_Z, IS_DIMS, LW_GML_SHORTLINE, lwline_is_empty(), 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: