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

add tileset encoding option to darwin sources - #11274

Merged
mollymerp merged 4 commits into
masterfrom
encoding-param-darwin
Feb 26, 2018
Merged

mollymerp merged 4 commits into
masterfrom
encoding-param-darwin

Conversation

@mollymerp

@mollymerp mollymerp commented Feb 21, 2018 •

Copy link
Copy Markdown
Contributor

part of #11224

@1ec5 I didn't end up following your instructions exactly because encoding is not a constructor option for RasterDEMTileset but rather an option on the base Tileset class so I didn't understand how to add the option handling further down in the source inheritance – but maybe I'm doing something wrong 😅

@mollymerp
mollymerp requested a review from 1ec5 February 21, 2018 19:51
Comment thread platform/darwin/src/MGLTileSource.h Outdated

/**
Raster tiles generated with the Mapbox encoding formula where
elevaion = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)

@1ec5 1ec5 Feb 21, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: elevation.

Also, I’m not sure how this comment will be interpreted by reStructuredText and Markdown parsers, but this will at least format it like a pretty formula in the jazzy documentation (which uses a Markdown parser):

<var>elevation</var> = −10000 + ((<var>red</var> × 256² + <var>green</var> × 256 + <var>blue</var>))

Comment thread platform/darwin/src/MGLTileSource.h Outdated

/**
Raster tiles generated with the Mapzen Terrarium encoding formula where
elevaion = (R * 256 + G + B / 256) - 32768

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

<var>elevation</var> = (<var>red</var> × 256 + <var>green</var> + <var>blue</var> ÷ 256) − 32768

// when the dem enciding is changed using an NSValue
MGLDEMEncoding terrarium = MGLDEMEncodingTerrarium;
tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{
MGLTileSourceOptionDEMEncoding: [NSValue value:&terrarium withObjCType:@encode(MGLDEMEncoding)],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use @(MGLDEMEncoding) instead, so that the value in the dictionary is “boxed” in an NSInteger instead of an NSValue. Most option dictionaries use NSIntegers for more convenient unboxing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should I delete this test altogether then because the one above it uses @(MGLDEMEncoding) and NSNumber

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, I see, I misread this. You’re right, carry on. 👍

tileSet.encoding = mbgl::Tileset::DEMEncoding::Mapbox;
break;
case MGLDEMEncodingTerrarium:
tileSet.encoding = mbgl::Tileset::DEMEncoding::Terrarium;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If encoding is supported by TileSet no matter which source type the TileSet is used with, then this implementation is fine and the second and third steps in #11224 (comment) are unnecessary.

Comment thread platform/darwin/src/MGLTileSource.h Outdated
MGLDEMEncodingMapbox = 0,

/**
Raster tiles generated with the Mapzen Terrarium encoding formula where

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, that works too.

Comment thread platform/darwin/src/MGLTileSource.h Outdated
typedef NS_ENUM(NSUInteger, MGLDEMEncoding) {

/**
Raster tiles generated with the Mapbox encoding formula where

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider linking to this document in lieu of a standard specification.

@1ec5 1ec5 added GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Feb 21, 2018
@1ec5 1ec5 added this to the ios-v4.0.0 milestone Feb 21, 2018
@mollymerp
mollymerp force-pushed the encoding-param-darwin branch from d10a3f5 to 611ea72 Compare February 21, 2018 21:29
Comment thread platform/darwin/src/MGLTileSource.h Outdated
Raster tiles generated with the Mapbox encoding formula where
elevaion = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)
Raster tiles generated with the Mapbox encoding formula.
See more details here: https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Documentation comments use Markdown format. Link “Mapbox encoding formula” to this URL using Markdown format. (Technically, HTML syntax would be preferable, but Quick Help’s formatting is currently broken, so the only parser we care much about right now is jazzy’s.)

@mollymerp
mollymerp force-pushed the encoding-param-darwin branch from b47c18d to 484f979 Compare February 26, 2018 21:48
@mollymerp
mollymerp merged commit d425ec7 into master Feb 26, 2018
@mollymerp
mollymerp deleted the encoding-param-darwin branch February 26, 2018 22:13
mollymerp added a commit that referenced this pull request Feb 26, 2018
* add tileset encoding option to darwin sources

* correct style guide

* link out to dem encoding docs

* markdownify comments
mollymerp added a commit that referenced this pull request Feb 27, 2018
…o boba (#11324)

* [ios, macos] add tileset encoding option to darwin sources (#11274)

* add tileset encoding option to darwin sources

* correct style guide

* link out to dem encoding docs

* markdownify comments

* correct changelog
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants