Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min_display_zoom & max_display_zoom #944

Merged
merged 12 commits into from Sep 8, 2016
Merged

Conversation

hallahan
Copy link
Contributor

@hallahan hallahan commented Aug 30, 2016

This PR allows you to set a min_zoom parameter in your sources block of your scene.yaml.

When a source is given a min_zoom parameter, it does not fetch tiles below that min zoom. This includes the raster sub-sources we see with normals, as found in Walkabout and other terrain styles.

As @bcamper mentioned, we might actually want to call this parameter min_display_zoom, since we don't under-zoom data at lower zooms--we simply don't provide it.

I'm happy to re-factor that into this PR. Also, we could take a similar approach found here to implement max_display_zoom.

tangrams/tangram#394

Thinking about also implementing bounds, we could build that into DataSource#isActiveForZoom, calling it isActive instead.

cc/ @tallytalwar @blair1618 @bcamper

@hallahan hallahan changed the title Min Zoom min_display_zoom & max_display_zoom Sep 6, 2016
@hallahan
Copy link
Contributor Author

hallahan commented Sep 6, 2016

At this point, I've refactored min_zoom to be min_display_zoom. I have also implemented max_display_zoom.

@hallahan
Copy link
Contributor Author

hallahan commented Sep 6, 2016

Interesting, Travis caught that Android was missing the #define for INT32_MAX. Perhaps I should just #ifndef in the value to the token in the header?

@tallytalwar
Copy link
Member

Can you rebase this with master? some of the commits you have above have already been merged!

@@ -23,7 +23,8 @@ class ClientGeoJsonSource : public DataSource {

public:

ClientGeoJsonSource(const std::string& _name, const std::string& _url, int32_t _maxZoom = 18);
ClientGeoJsonSource(const std::string& _name, const std::string& _url,
int32_t _minDisplayZoom = 0, int32_t _maxDisplayZoom = INT32_MAX, int32_t _maxZoom = 18);
Copy link
Member

Choose a reason for hiding this comment

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

I think its fine to use 18 as the maxDisplayZoom default instead of INT32_MAX.

Copy link
Member

Choose a reason for hiding this comment

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

Or a default value of -1 can be used to ignore any pruning of tiles based on min or max display zooms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't the map actually proxy tile higher zooms than 18? What if we wanted to zoom to 28 and explore a map of the stores in a mall or something?

Copy link
Member

Choose a reason for hiding this comment

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

Yup in that case what I suggested to use is -1. Similar to how js does it and has a null as default.

@hallahan
Copy link
Contributor Author

hallahan commented Sep 7, 2016

@tallytalwar - I implemented the proposed changes. Ready for another look. Thanks!

@@ -12,6 +12,26 @@
#import <UIKit/UIKit.h>
Copy link
Member

Choose a reason for hiding this comment

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

How come these changes are in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understanding, that's because I did a rebase from tangrams/master to hallahan/minZoom. Git gets kinda weird when dealing with another origin sometimes. It's because I did commits at a point before this iOS work and then rebased yesterday. The nature of rebase is that history gets rewritten, so that commit, as you can see, has a different SHA1. The older problem where we saw old commits that have already been merged is because I branched off of hallahan/master instead of tangrams-es/master. It was up to date, but the fact that one origin merged into another created that effect.

The only way I could resolve this is to make a new branch and cherry pick my commits into a new one and open a new PR. However, I wonder, would it take me out of the commit message once you merge the PR? Since, all of my commits should say it was hallahan with tallytalwar? I can do a new PR if needed. Sorry this is such a headache!

http://stackoverflow.com/questions/32826197/interactive-rebase-after-merging-other-commits-interleaving-mine

Copy link
Member

Choose a reason for hiding this comment

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

Hmm.. Probably one more thing you can do here is to take this (c159079) commit out.

  • git rebase -i HEAD~12
  • remove the line mentioning this (c159079) commit.
  • save
  • to be sure you are all good, do a diff of this local branch with the remote.

Copy link
Member

Choose a reason for hiding this comment

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

I also plan to "squash and merge" this PR, so it should say "hallahan with tallytalwar" when merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, when I delete c159079 in the interactive rebase, I get conflicts for each commit. When I resolve each, I then diff it with tangrams master, and it removes all of the iOS code. Continuing to look into this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, after looking further into it. I don't think there is a solution to removing cc159079 from the rebased branch without actually removing the diff that that commit applies.

I went ahead and made a new branch and applied a diff of the minZoom branch.

https://github.com/hallahan/tangram-es/tree/display_zoom

We can a) open a new PR with that, or b) just merge this PR as-is.

Sorry for the weird rebase.

@tallytalwar
Copy link
Member

Changes look good, once the comments are addressed and propertly rebased with master will merge.

Thanks @hallahan

@tallytalwar
Copy link
Member

This is good to go, merging when travis goes green.

@tallytalwar tallytalwar merged commit 94a0ac2 into tangrams:master Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants