pull/7/head
Arthur VALIN 2 years ago
parent 5ea669fd5f
commit ad24c55bc4

@ -70,7 +70,7 @@ class Map : Fragment() {
map.setTileSource(TileSourceFactory.MAPNIK);
spinner = view.findViewById(R.id.mapLoading);
spinner.visibility=View.VISIBLE;
map.minZoomLevel = 10.0
map.minZoomLevel = 4.0
map.controller.setZoom(21.0);
if (ContextCompat.checkSelfPermission(requireActivity(), ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissionLauncher.launch(ACCESS_FINE_LOCATION)

@ -27,7 +27,6 @@ class AddMarkerOverlay(val roadManager: RoadManager) : Overlay() {
locations.add(loc)
val marker = PlaceMarker(mapView, locations, this)
marker.position = loc
marker.title = "Step " + locations.size
mapView.overlays.add(marker)
computeRoad(mapView)
addNewRoadtripOverlay(mapView);
@ -51,7 +50,7 @@ class AddMarkerOverlay(val roadManager: RoadManager) : Overlay() {
fun addNewRoadtripOverlay(mapView: MapView){
if (locations.size > 1) {
mapView.overlays.add(NewRoadtripOverlay())
mapView.overlays.add(NewRoadtripOverlay(locations))
}else{
mapView.overlays.remove(mapView.overlays.find { it is NewRoadtripOverlay})
}

@ -14,7 +14,7 @@ import org.osmdroid.views.overlay.Overlay
import uca.baptistearthur.geocaching.R
class NewRoadtripOverlay() : Overlay() {
class NewRoadtripOverlay(val points: Collection<GeoPoint>) : Overlay() {
private var circleRectF=RectF()
@ -49,7 +49,8 @@ class NewRoadtripOverlay() : Overlay() {
override fun onSingleTapConfirmed(e: MotionEvent?, mapView: MapView?) =
if (e != null && circleRectF.contains(e.x, e.y)) {
Log.d("GeoRoad", "CONFIRM")
// TODO: Sauvegarder le trajet (dans la variable points).
Log.d("GeoRoad", "CONFIRM : "+points.size)
true
}else{
false

@ -6,9 +6,12 @@ import org.osmdroid.bonuspack.routing.RoadManager
import org.osmdroid.util.GeoPoint
import org.osmdroid.views.MapView
import org.osmdroid.views.overlay.Marker
import org.osmdroid.views.overlay.infowindow.InfoWindow
class PlaceMarker(val mapView: MapView, val locations: MutableSet<GeoPoint>, val parent : AddMarkerOverlay) : Marker(mapView) {
override fun getTitle(): String {
return "Step " + (locations.indexOf(this.position)+1)
}
override fun onLongPress(e: MotionEvent?, mapView: MapView?): Boolean {
if(mapView!=null && this.hitTest(e, mapView)) {
locations.remove(this.position)

Loading…
Cancel
Save