otsaloma / whogo-maps

Vector maps and navigation for Sailfish OS
https://openrepos.net/content/otsaloma/whogo-maps
GNU General Public License v3.0
11 stars 5 forks source link

Lock to integer zoom levels for raster sources? #14

Closed otsaloma closed 6 years ago

rinigus commented 6 years ago

Taking into account slight blurriness of the raster tiles (https://github.com/mapbox/mapbox-gl-native/issues/10076), I don't think you have to lock the zoom levels. Not from the rendering quality POV, at least.

otsaloma commented 6 years ago

There's also the issue of the amount of detail. It just looks bad when you overzoom and the map is very empty. It doesn't look too hard, so I think I'll just test it and see how it works. Do I understand correctly, that I should edit onPinchFinished in MapboxMapGestureArea? That's not exposed, but I can test by copying the whole file and if it works maybe we can add it to the MapboxMapGestureArea API?

rinigus commented 6 years ago

I think so, editing onPitchFinished should allow you to use discrete zoom values. And if you find it useful, we can add that to the API. In the end, API was shaped by porting Poor Maps with the hope that it will be useful for all map applications.

rinigus commented 6 years ago

PS: but I think over-zoom is handled via maximumZoomLevel property of the map object.

otsaloma commented 6 years ago

By overzoom, in this case, I mean e.g. the map being at zoom 14.9, using tiles from zoom level 14.

rinigus commented 6 years ago

14.9 should actually use 15 zoom. The shift should occur at .5 . There was a corresponding commit regarding it in Mapbox GL and I think we already use the version with it.

otsaloma commented 6 years ago

Looks to me like the shift occurs at .0, but I'll see better when I can test with the locking on and off.

rinigus commented 6 years ago

Confirmed for vector tiles - indeed, shift occurs at .0 and, for safety, you have to even add a little tolerance (0.01?) to force the shift. No idea, where did I remember this .5 from. Sorry for confusion

otsaloma commented 6 years ago

Much better with integer zoom levels! I can send a PR, I'd suggest adding a boolean property integerZoomLevels for the Map component and check for that under onPitchFinished. Would that be fine? In WhoGo Maps I would then just update the property as part of setBasemap, setting it to true for raster maps, false for vectors.

rinigus commented 6 years ago

Excellent! Please send the PR.

If you want to add integerZoomLevels to the Map, then it has to be C++, right? For pure QML, we could add it to the gesture area as a property since the logic is in that anyway. Against QML is the possibility (however quite distant) to try to get QtLocation map gesture area working with the widget. Then keeping the property in the map is better.

Whatever choice you will make, I am sure it will be fine.

I am working on cache cleaning. As soon as these both are in, we can push out new release for the widget so you could work with the up-to-date version.