MCPcopy Create free account
hub / github.com/comaps/comaps / SaveLineStrings

Function SaveLineStrings

libs/kml/serdes.cpp:439–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439void SaveLineStrings(Writer & writer, MultiGeometry const & geom)
440{
441 auto linesIndent = kIndent4;
442 auto const lineStringsSize = geom.GetNumberOfLinesWithouTimestamps();
443
444 if (lineStringsSize > 1)
445 {
446 linesIndent = kIndent8;
447 writer << kIndent4 << "<MultiGeometry>\n";
448 }
449
450 for (size_t lineIndex = 0; lineIndex < geom.m_lines.size(); ++lineIndex)
451 {
452 auto const & line = geom.m_lines[lineIndex];
453 if (line.empty())
454 {
455 LOG(LERROR, ("Unexpected empty Track"));
456 continue;
457 }
458
459 // Skip the tracks with the timestamps when writing the <LineString> points.
460 if (geom.HasTimestampsFor(lineIndex))
461 continue;
462
463 writer << linesIndent << "<LineString><coordinates>";
464
465 writer << PointToLineString(line[0]);
466 for (size_t pointIndex = 1; pointIndex < line.size(); ++pointIndex)
467 writer << " " << PointToLineString(line[pointIndex]);
468
469 writer << "</coordinates></LineString>\n";
470 }
471
472 if (lineStringsSize > 1)
473 writer << kIndent4 << "</MultiGeometry>\n";
474}
475
476void SaveGxTracks(Writer & writer, MultiGeometry const & geom)
477{

Callers 1

SaveTrackGeometryFunction · 0.85

Calls 5

PointToLineStringFunction · 0.85
HasTimestampsForMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected