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

Custom size generator #25

Merged
merged 5 commits into from Jan 27, 2019
Merged

Custom size generator #25

merged 5 commits into from Jan 27, 2019

Conversation

devindi
Copy link
Owner

@devindi devindi commented Jan 27, 2019

Implemented generation of image with custom size ( #4 )

import com.google.firebase.perf.FirebasePerformance
import org.osmdroid.util.GeoPoint
import timber.log.Timber
Copy link
Owner Author

Choose a reason for hiding this comment

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

⚠️ Unused import

package com.devindi.wallpaper.model.map

import com.devindi.wallpaper.misc.RectD
import org.osmdroid.tileprovider.cachemanager.CacheManager
Copy link
Owner Author

Choose a reason for hiding this comment

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

⚠️ Unused import


// Here is some math magic). Those calculations are taken from OSM wiki
// https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
fun lonToTile(lon: Double, zoom: Int) = (lon + HALF_CIRCLE_DEGREES) / CIRCLE_DEGREES * (1 shl zoom)
Copy link
Owner Author

Choose a reason for hiding this comment

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

⚠️ Exceeded max line length (100) (cannot be auto-corrected)

// https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
fun lonToTile(lon: Double, zoom: Int) = (lon + HALF_CIRCLE_DEGREES) / CIRCLE_DEGREES * (1 shl zoom)

fun latToTile(lat: Double, zoom: Int): Double = (1 shl zoom) * (1 - (Math.log(Math.tan(Math.toRadians(lat)) + 1 / (Math.cos(Math.toRadians(lat))))) / Math.PI) / 2
Copy link
Owner Author

Choose a reason for hiding this comment

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

⚠️ Exceeded max line length (100) (cannot be auto-corrected)

@devindi devindi merged commit 3713752 into master Jan 27, 2019
@devindi devindi deleted the custom_size_generator branch October 3, 2019 09:21
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

1 participant