lab 5: implement set_bump_marker()
This commit is contained in:
@@ -10,6 +10,7 @@ class MapViewApp(App):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
# додати необхідні змінні
|
# додати необхідні змінні
|
||||||
|
self.pothole_markers = []
|
||||||
|
|
||||||
def on_start(self):
|
def on_start(self):
|
||||||
"""
|
"""
|
||||||
@@ -29,10 +30,23 @@ class MapViewApp(App):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def set_pothole_marker(self, point):
|
def set_pothole_marker(self, point):
|
||||||
"""
|
if isinstance(point, dict):
|
||||||
Встановлює маркер для ями
|
lat = point.get("lat")
|
||||||
:param point: GPS координати
|
lon = point.get("lon")
|
||||||
"""
|
else:
|
||||||
|
lat, lon = point
|
||||||
|
|
||||||
|
if lat is None or lon is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
marker = MapMarker(
|
||||||
|
lat=lat,
|
||||||
|
lon=lon,
|
||||||
|
source="images/pothole.png"
|
||||||
|
)
|
||||||
|
|
||||||
|
self.mapview.add_marker(marker)
|
||||||
|
self.pothole_markers.append(marker)
|
||||||
|
|
||||||
def set_bump_marker(self, point):
|
def set_bump_marker(self, point):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user