Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] add support for mapzen terrarium #11154

Merged
merged 5 commits into from
Feb 14, 2018
Merged

[core] add support for mapzen terrarium #11154

merged 5 commits into from
Feb 14, 2018

Conversation

mollymerp
Copy link
Contributor

@mollymerp mollymerp commented Feb 8, 2018

port of mapbox/mapbox-gl-js#6110 adding support for mapzen terrarium encoded dem RGB tiles.

ended up #includeing Tileset all over the place because it seemed like the place we store top-level source keys like encoding, but not sure this is the best approach – happy to hear suggestions of alternatives.

closes #11204

@mollymerp mollymerp added GL JS parity For feature parity with Mapbox GL JS Core The cross-platform C++ core, aka mbgl labels Feb 8, 2018
@mollymerp mollymerp requested a review from kkaefer February 8, 2018 22:22
@@ -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) {
Copy link

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.


std::vector<std::string> tiles;
Range<uint8_t> zoomRange;
std::string attribution;
Scheme scheme;
Encoding encoding;
Copy link
Contributor

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?).

@@ -16,28 +17,28 @@ auto fakeImage = [](Size s) {

TEST(DEMData, Constructor) {
Copy link
Contributor

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.

Copy link
Member

@kkaefer kkaefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tests

@@ -14,22 +14,27 @@ namespace mbgl {
class Tileset {
public:
enum class Scheme : bool { XYZ, TMS };
enum class Encoding : bool { Mapbox, Terrarium };
Copy link
Member

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?

@mollymerp mollymerp force-pushed the mapzen-terrarium branch 2 times, most recently from ad41b04 to e7aa8e1 Compare February 14, 2018 01:57
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);
Copy link
Contributor

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 @

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Mapzen terrain
4 participants