-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] add support for mapzen terrarium #11154
Conversation
5010847
to
0bbd54c
Compare
src/mbgl/geometry/dem_data.cpp
Outdated
@@ -13,13 +13,22 @@ DEMData::DEMData(const PremultipliedImage& _image): | |||
throw std::runtime_error("raster-dem tiles must be square."); | |||
} | |||
|
|||
auto decodeRGB = [&] (const uint8_t r, const uint8_t g, const uint8_t b) { | |||
if (encoding == Tileset::Encoding::Mapbox) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using an if, as it's called inside a loop, you could change that to a Functor so it gets inlined and resembles what you did in the js version, selecting the decode function before the loop.
include/mbgl/util/tileset.hpp
Outdated
|
||
std::vector<std::string> tiles; | ||
Range<uint8_t> zoomRange; | ||
std::string attribution; | ||
Scheme scheme; | ||
Encoding encoding; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tileset
primarily mirrors TileJSON
, so it would be helpful to add a comment here that encoding
is not a part of the spec (as yet?).
test/geometry/dem_data.test.cpp
Outdated
@@ -16,28 +17,28 @@ auto fakeImage = [](Size s) { | |||
|
|||
TEST(DEMData, Constructor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have tests for Terrarium
data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests
include/mbgl/util/tileset.hpp
Outdated
@@ -14,22 +14,27 @@ namespace mbgl { | |||
class Tileset { | |||
public: | |||
enum class Scheme : bool { XYZ, TMS }; | |||
enum class Encoding : bool { Mapbox, Terrarium }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a more specific name, e.g. DEMEncoding
?
ad41b04
to
e7aa8e1
Compare
test/geometry/dem_data.test.cpp
Outdated
EXPECT_EQ(demdata.border, 8); | ||
EXPECT_EQ(demdata.stride, 32); | ||
EXPECT_EQ(demdata.getImage()->bytes(), size_t(32*32*4)); | ||
EXPECT_EQ(demdata.dim, 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: duplicate expects for dim
and border
@
31d217c
to
719cdb0
Compare
719cdb0
to
f445ac9
Compare
port of mapbox/mapbox-gl-js#6110 adding support for mapzen terrarium encoded dem RGB tiles.
ended up
#include
ingTileset
all over the place because it seemed like the place we store top-level source keys likeencoding
, but not sure this is the best approach – happy to hear suggestions of alternatives.closes #11204