Correcting a bug when computing NewRoadripOverlay

pull/7/head
Arthur VALIN 2 years ago
parent e9b9ccdd38
commit 5e44f01779

@ -17,6 +17,7 @@ class AddMarkerOverlay(val roadManager: RoadManager) : Overlay() {
private var locations: MutableSet<GeoPoint> = mutableSetOf()
private lateinit var roadOverlay: Polyline
private var newRoadtripOverlayVisible = false;
override fun onDoubleTap(e: MotionEvent?, mapView: MapView?): Boolean {
Log.d("GeoMap", "Longpress")
val proj = mapView?.projection;
@ -48,9 +49,15 @@ class AddMarkerOverlay(val roadManager: RoadManager) : Overlay() {
fun computeNewRoadtripOverlay(mapView: MapView){
if (locations.size > 1) {
mapView.overlays.add(NewRoadtripOverlay(locations))
if(!newRoadtripOverlayVisible) {
mapView.overlays.add(NewRoadtripOverlay(locations))
newRoadtripOverlayVisible = true
}
}else{
Log.d("GeoRoad", "TRY DELETE ROADTRIP OVERLAY" + locations.size)
Log.d("GeoRoad", ""+mapView.overlays.size)
mapView.overlays.remove(mapView.overlays.find { it is NewRoadtripOverlay})
newRoadtripOverlayVisible=false
}
}

Loading…
Cancel
Save