mirror of
https://github.com/Rhinemann/IoT-Systems.git
synced 2026-03-14 20:50:39 +02:00
SCRUM-90: implement set_bump_marker
This commit is contained in:
parent
ceffcfeac2
commit
fba2fdd241
@ -10,11 +10,12 @@ class MapViewApp(App):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__()
|
||||
# додати необхідні змінні
|
||||
|
||||
self.bump_markers = []
|
||||
def on_start(self):
|
||||
"""
|
||||
Встановлює необхідні маркери, викликає функцію для оновлення мапи
|
||||
"""
|
||||
Clock.schedule_once(lambda dt: self.set_bump_marker((50.4501, 30.5234)), 0)
|
||||
|
||||
def update(self, *args):
|
||||
"""
|
||||
@ -35,10 +36,24 @@ class MapViewApp(App):
|
||||
"""
|
||||
|
||||
def set_bump_marker(self, point):
|
||||
"""
|
||||
Встановлює маркер для лежачого поліцейського
|
||||
:param point: GPS координати
|
||||
"""
|
||||
if isinstance(point, dict):
|
||||
lat = point.get("lat")
|
||||
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/bump.png"
|
||||
)
|
||||
|
||||
self.mapview.add_marker(marker)
|
||||
self.bump_markers.append(marker)
|
||||
|
||||
|
||||
def build(self):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user