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

Parse and expose more style JSON root properties#6002

Merged
kkaefer merged 1 commit into
masterfrom
6002-expose-style-properties
Aug 19, 2016
Merged

Parse and expose more style JSON root properties#6002
kkaefer merged 1 commit into
masterfrom
6002-expose-style-properties

Conversation

@kkaefer
Copy link
Copy Markdown
Member

@kkaefer kkaefer commented Aug 15, 2016

mbgl::style::Parser::parse() should parse the name and metadata root properties out of the style JSON and expose them with accessors on the mbgl::style::Style class. The SDK could read the name of the style aloud in accessibility contexts.

Similarly, root properties such as center and zoom may be useful for establishing a default viewport for the style other than the Null Island default used in the SDK currently. This would enable the developer to set the default viewport once, in Mapbox Studio, and not have to set it again programmatically or in a storyboard.

/cc @jfirebaugh @kkaefer

@1ec5 1ec5 added feature Core The cross-platform C++ core, aka mbgl labels Aug 13, 2016
@kkaefer
Copy link
Copy Markdown
Member

kkaefer commented Aug 15, 2016

What properties from metadata would you use? It seems like they aren't defined and currently are only used internally by Mapbox Studio. Not having a defined spec for those makes it hard/impossible to expose them.

@mention-bot
Copy link
Copy Markdown

@kkaefer, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @1ec5 and @ansis to be potential reviewers.

@kkaefer
Copy link
Copy Markdown
Member

kkaefer commented Aug 15, 2016

@1ec5 This patch parses the properties, but they aren't yet exposed in the SDK. You can obtain the values with Map::getName(), Map::getDefaultLatLng(), Map::getDefaultZoom(), Map::getDefaultBearing(), and Map::getDefaultPitch().

Do you have any specific use case for metadata values?

Comment thread include/mbgl/map/map.hpp Outdated
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.

Should this be getStyleName()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah; renamed.

@1ec5
Copy link
Copy Markdown
Contributor Author

1ec5 commented Aug 15, 2016

Do you have any specific use case for metadata values?

No, I figured this would eventually be opened up to developers, but we can definitely leave it out, especially since the structure is undefined.

@kkaefer kkaefer force-pushed the 6002-expose-style-properties branch from 4dc3f33 to a9eb69e Compare August 15, 2016 15:28
@1ec5
Copy link
Copy Markdown
Contributor Author

1ec5 commented Aug 18, 2016

👍

@kkaefer kkaefer force-pushed the 6002-expose-style-properties branch 2 times, most recently from b8e056c to 44736c1 Compare August 19, 2016 13:49
We're now parsing "name", "center", "zoom", "bearing", and "pitch" from the stylesheet.
@kkaefer kkaefer force-pushed the 6002-expose-style-properties branch from 44736c1 to cb33c86 Compare August 19, 2016 15:34
@kkaefer kkaefer merged commit cb33c86 into master Aug 19, 2016
@kkaefer kkaefer deleted the 6002-expose-style-properties branch August 19, 2016 15:34
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 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants