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

◆ asgml3_line()

static void asgml3_line ( stringbuffer_t sb,
const LWLINE line,
const GML_Options opts 
)
static

Definition at line 401 of file lwout_gml.c.

402{
403 int dimension = FLAGS_GET_Z(line->flags) ? 3 : 2;
404 int shortline = (opts->opts & LW_GML_SHORTLINE);
405
406 if (shortline)
407 {
408 stringbuffer_aprintf(sb, "<%sLineString", opts->prefix);
409 }
410 else
411 {
412 stringbuffer_aprintf(sb, "<%sCurve", opts->prefix);
413 }
414
415 if (opts->srs) stringbuffer_aprintf(sb, " srsName=\"%s\"", opts->srs);
416 if (opts->id) stringbuffer_aprintf(sb, " %sid=\"%s\"", opts->prefix, opts->id);
417
418 if (lwline_is_empty(line))
419 {
420 stringbuffer_append(sb, "/>");
421 return;
422 }
423 stringbuffer_append(sb, ">");
424
425 if (!shortline)
426 {
427 stringbuffer_aprintf(sb, "<%ssegments>", opts->prefix);
428 stringbuffer_aprintf(sb, "<%sLineStringSegment>", opts->prefix);
429 }
430
431 if (IS_DIMS(opts->opts))
432 {
433 stringbuffer_aprintf(sb, "<%sposList srsDimension=\"%d\">", opts->prefix, dimension);
434 }
435 else
436 {
437 stringbuffer_aprintf(sb, "<%sposList>", opts->prefix);
438 }
439
440 asgml3_ptarray(sb, line->points, opts);
441 stringbuffer_aprintf(sb, "</%sposList>", opts->prefix);
442
443 if (shortline)
444 {
445 stringbuffer_aprintf(sb, "</%sLineString>", opts->prefix);
446 }
447 else
448 {
449 stringbuffer_aprintf(sb, "</%sLineStringSegment>", opts->prefix);
450 stringbuffer_aprintf(sb, "</%ssegments>", opts->prefix);
451 stringbuffer_aprintf(sb, "</%sCurve>", opts->prefix);
452 }
453}
#define IS_DIMS(x)
Definition liblwgeom.h:1721
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition liblwgeom.h:1716
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
int lwline_is_empty(const LWLINE *line)
static void asgml3_ptarray(stringbuffer_t *sb, const POINTARRAY *pa, const GML_Options *opts)
Definition lwout_gml.c:112
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
lwflags_t flags
Definition liblwgeom.h:485
POINTARRAY * points
Definition liblwgeom.h:483

References asgml3_ptarray(), LWLINE::flags, FLAGS_GET_Z, IS_DIMS, LW_GML_SHORTLINE, lwline_is_empty(), LWLINE::points, stringbuffer_append(), and stringbuffer_aprintf().

Referenced by asgml3_collection(), asgml3_multi(), asgml3_multicurve(), and lwgeom_to_gml3().

Here is the call graph for this function:
Here is the caller graph for this function: