kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
minor fixes/tweaks
rodzic
ec61d0c66e
commit
17cbce1d41
|
@ -140,7 +140,9 @@ class CustomTileSource {
|
||||||
|
|
||||||
private val MAPNIK: OnlineTileSourceBase = TileSourceFactory.MAPNIK
|
private val MAPNIK: OnlineTileSourceBase = TileSourceFactory.MAPNIK
|
||||||
private val USGS_TOPO: OnlineTileSourceBase = TileSourceFactory.USGS_TOPO
|
private val USGS_TOPO: OnlineTileSourceBase = TileSourceFactory.USGS_TOPO
|
||||||
|
private val OPEN_TOPO: OnlineTileSourceBase = TileSourceFactory.OpenTopo
|
||||||
private val USGS_SAT: OnlineTileSourceBase = TileSourceFactory.USGS_SAT
|
private val USGS_SAT: OnlineTileSourceBase = TileSourceFactory.USGS_SAT
|
||||||
|
private val SEAMAP: OnlineTileSourceBase = TileSourceFactory.OPEN_SEAMAP
|
||||||
val DEFAULT_TILE_SOURCE: OnlineTileSourceBase = TileSourceFactory.DEFAULT_TILE_SOURCE
|
val DEFAULT_TILE_SOURCE: OnlineTileSourceBase = TileSourceFactory.DEFAULT_TILE_SOURCE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,6 +152,7 @@ class CustomTileSource {
|
||||||
listOf(
|
listOf(
|
||||||
MAPNIK,
|
MAPNIK,
|
||||||
USGS_TOPO,
|
USGS_TOPO,
|
||||||
|
OPEN_TOPO,
|
||||||
USGS_SAT,
|
USGS_SAT,
|
||||||
ESRI_IMAGERY,
|
ESRI_IMAGERY,
|
||||||
)
|
)
|
||||||
|
|
|
@ -55,16 +55,13 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
private lateinit var map: MapView
|
private lateinit var map: MapView
|
||||||
private lateinit var downloadBtn: FloatingActionButton
|
private lateinit var downloadBtn: FloatingActionButton
|
||||||
private lateinit var cacheEstimate: TextView
|
private lateinit var cacheEstimate: TextView
|
||||||
private lateinit var cancelDownload: Button
|
|
||||||
private lateinit var fiveMileButton: Button
|
|
||||||
private lateinit var tenMileButton: Button
|
|
||||||
private lateinit var fifteenMileButton: Button
|
|
||||||
private lateinit var executeJob: Button
|
private lateinit var executeJob: Button
|
||||||
private var downloadPrompt: AlertDialog? = null
|
private var downloadPrompt: AlertDialog? = null
|
||||||
private var alertDialog: AlertDialog? = null
|
private var alertDialog: AlertDialog? = null
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
private val defaultMinZoom = 1.5
|
private val defaultMinZoom = 1.5
|
||||||
|
private val defaultMaxZoom = 18.0
|
||||||
private val nodeZoomLevel = 8.5
|
private val nodeZoomLevel = 8.5
|
||||||
private val defaultZoomSpeed = 3000L
|
private val defaultZoomSpeed = 3000L
|
||||||
private val prefsName = "org.geeksville.osm.prefs"
|
private val prefsName = "org.geeksville.osm.prefs"
|
||||||
|
@ -72,9 +69,12 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
private var nodePositions = listOf<MarkerWithLabel>()
|
private var nodePositions = listOf<MarkerWithLabel>()
|
||||||
private var wayPoints = listOf<MarkerWithLabel>()
|
private var wayPoints = listOf<MarkerWithLabel>()
|
||||||
private val nodeLayer = 1
|
private val nodeLayer = 1
|
||||||
private val zoomLevelLowest = 16.0
|
|
||||||
private val zoomLevelMiddle = 14.0
|
// Distance of bottom corner to top corner of bounding box
|
||||||
private val zoomLevelHighest = 10.0
|
private val zoomLevelLowest = 13.0 // approx 5 miles long
|
||||||
|
private val zoomLevelMiddle = 12.25 // approx 10 miles long
|
||||||
|
private val zoomLevelHighest = 11.5 // approx 15 miles long
|
||||||
|
|
||||||
private var zoomLevelMin = 0.0
|
private var zoomLevelMin = 0.0
|
||||||
private var zoomLevelMax = 0.0
|
private var zoomLevelMax = 0.0
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
// set dialog message
|
// set dialog message
|
||||||
alertDialogBuilder.setItems(
|
alertDialogBuilder.setItems(
|
||||||
arrayOf<CharSequence>(
|
arrayOf<CharSequence>(
|
||||||
"Cache current size",
|
"Current Cache size",
|
||||||
"Download Region",
|
"Download Region",
|
||||||
"Clear Cache",
|
"Clear Cache",
|
||||||
resources.getString(R.string.cancel)
|
resources.getString(R.string.cancel)
|
||||||
|
@ -182,7 +182,7 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearCache() {
|
private fun clearCache() {
|
||||||
map.canZoomIn()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,12 +222,9 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
binding.downloadButton.hide()
|
binding.downloadButton.hide()
|
||||||
binding.cacheLayout.visibility = View.VISIBLE
|
binding.cacheLayout.visibility = View.VISIBLE
|
||||||
val builder = AlertDialog.Builder(activity)
|
val builder = AlertDialog.Builder(activity)
|
||||||
fiveMileButton = binding.box5miles
|
binding.box5miles.setOnClickListener(this)
|
||||||
fiveMileButton.setOnClickListener(this)
|
binding.box10miles.setOnClickListener(this)
|
||||||
tenMileButton = binding.box10miles
|
binding.box15miles.setOnClickListener(this)
|
||||||
tenMileButton.setOnClickListener(this)
|
|
||||||
fifteenMileButton = binding.box15miles
|
|
||||||
fifteenMileButton.setOnClickListener(this)
|
|
||||||
cacheEstimate = binding.cacheEstimate
|
cacheEstimate = binding.cacheEstimate
|
||||||
generateBoxOverlay(zoomLevelLowest)
|
generateBoxOverlay(zoomLevelLowest)
|
||||||
executeJob = binding.executeJob
|
executeJob = binding.executeJob
|
||||||
|
@ -246,11 +243,10 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
* Creates Box overlay showing what area can be downloaded
|
* Creates Box overlay showing what area can be downloaded
|
||||||
*/
|
*/
|
||||||
private fun generateBoxOverlay(zoomLevel: Double) {
|
private fun generateBoxOverlay(zoomLevel: Double) {
|
||||||
map.invalidate()
|
|
||||||
map.setMultiTouchControls(false)
|
|
||||||
drawOverlays()
|
drawOverlays()
|
||||||
|
map.setMultiTouchControls(false)
|
||||||
zoomLevelMax = zoomLevel
|
zoomLevelMax = zoomLevel
|
||||||
zoomLevelMin = map.minZoomLevel
|
zoomLevelMin = map.tileProvider.tileSource.minimumZoomLevel.toDouble()
|
||||||
mapController.setZoom(zoomLevel)
|
mapController.setZoom(zoomLevel)
|
||||||
downloadRegionBoundingBox = map.boundingBox
|
downloadRegionBoundingBox = map.boundingBox
|
||||||
val polygon = Polygon()
|
val polygon = Polygon()
|
||||||
|
@ -495,6 +491,7 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
||||||
true // scales the map tiles to the display density of the screen
|
true // scales the map tiles to the display density of the screen
|
||||||
map.minZoomLevel =
|
map.minZoomLevel =
|
||||||
defaultMinZoom // sets the minimum zoom level (the furthest out you can zoom)
|
defaultMinZoom // sets the minimum zoom level (the furthest out you can zoom)
|
||||||
|
map.maxZoomLevel = defaultMaxZoom
|
||||||
map.setMultiTouchControls(true) // Sets gesture controls to true.
|
map.setMultiTouchControls(true) // Sets gesture controls to true.
|
||||||
map.zoomController.setVisibility(CustomZoomButtonsController.Visibility.NEVER) // Disables default +/- button for zooming
|
map.zoomController.setVisibility(CustomZoomButtonsController.Visibility.NEVER) // Disables default +/- button for zooming
|
||||||
map.addMapListener(object : MapListener {
|
map.addMapListener(object : MapListener {
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
<string-array name="map_styles">
|
<string-array name="map_styles">
|
||||||
<item>OpenStreetMap</item>
|
<item>OpenStreetMap</item>
|
||||||
<item>USGS TOPO</item>
|
<item>USGS TOPO</item>
|
||||||
|
<item>Open TOPO</item>
|
||||||
<item>USGS Satellite</item>
|
<item>USGS Satellite</item>
|
||||||
<item>ESRI World Overview</item>
|
<item>ESRI World Overview</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
Ładowanie…
Reference in New Issue