From 0a339b6680d807d3dab854bd9f5484e7f2ccda87 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 17 Sep 2018 16:57:08 -0700 Subject: [PATCH] Read and write spline knots, but don't try to interpret them yet --- mvt.cpp | 10 ++++++++++ mvt.hpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mvt.cpp b/mvt.cpp index 0b7a73a..473ac0d 100644 --- a/mvt.cpp +++ b/mvt.cpp @@ -399,6 +399,15 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) { break; } + case 11: /* knots */ + { + auto pi = feature_reader.get_packed_double(); + for (auto it = pi.first; it != pi.second; ++it) { + feature.knots.push_back(*it); + } + break; + } + default: feature_reader.skip(); break; @@ -707,6 +716,7 @@ std::string mvt_tile::encode() { feature_writer.add_packed_uint32(4, std::begin(geometry), std::end(geometry)); feature_writer.add_packed_uint64(6, std::begin(elevations), std::end(elevations)); + feature_writer.add_packed_double(11, std::begin(layers[i].features[f].knots), std::end(layers[i].features[f].knots)); if (has_attributes > 0) { std::vector attributes; diff --git a/mvt.hpp b/mvt.hpp index d947b17..0567fd3 100644 --- a/mvt.hpp +++ b/mvt.hpp @@ -53,13 +53,15 @@ struct mvt_geometry { enum mvt_geometry_type { mvt_point = 1, mvt_linestring = 2, - mvt_polygon = 3 + mvt_polygon = 3, + mvt_curve = 4, }; struct mvt_feature { std::vector tags{}; std::vector properties{}; std::vector geometry{}; + std::vector knots{}; int /* mvt_geometry_type */ type = 0; unsigned long long id = 0; bool has_id = false;