Created
December 24, 2020 15:06
-
-
Save lagner/1952060f80761151aa705c8e31700ce4 to your computer and use it in GitHub Desktop.
2GIS Native SDK map bounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun printMapCorners(mapView: MapView, map: Map) { | |
val projection = map.camera.projection() | |
projection.screenToMap(ViewportPoint(0F, 0F))?.let { geoPoint -> | |
Log.i("", "top left corner $geoPoint") | |
} | |
projection.screenToMap(ViewportPoint(mapView.width.toFloat(), 0F))?.let { geoPoint -> | |
Log.i("", "top right corner $geoPoint") | |
} | |
projection.screenToMap(ViewportPoint(0F, mapView.height.toFloat()))?.let { geoPoint -> | |
Log.i("", "bottom left corner $geoPoint") | |
} | |
projection.screenToMap(ViewportPoint(mapView.width.toFloat(), mapView.height.toFloat()))?.let { geoPoint -> | |
Log.i("", "bottom right corner $geoPoint") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment