mirror of
https://github.com/Rhinemann/IoT-Systems.git
synced 2026-03-14 20:50:39 +02:00
Compare commits
5 Commits
87facff668
...
17738d07fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17738d07fe | ||
|
|
6b5831ff1b | ||
|
|
54505db70e | ||
|
|
6f4b3b0ea6 | ||
|
|
948a936a1f |
@ -15,11 +15,15 @@ class MapViewApp(App):
|
||||
self.line_layer = None
|
||||
self.car_marker = None
|
||||
|
||||
# додати необхідні змінні
|
||||
self.bump_markers = []
|
||||
self.pothole_markers = []
|
||||
|
||||
def on_start(self):
|
||||
"""
|
||||
Встановлює необхідні маркери, викликає функцію для оновлення мапи
|
||||
"""
|
||||
Clock.schedule_interval(self.update, 0.3)
|
||||
Clock.schedule_once(lambda dt: self.set_bump_marker((50.4501, 30.5234)), 0)
|
||||
|
||||
def update(self, *args):
|
||||
"""
|
||||
@ -75,16 +79,43 @@ class MapViewApp(App):
|
||||
self.mapview.center_on(lat, lon)
|
||||
|
||||
def set_pothole_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/pothole.png"
|
||||
)
|
||||
|
||||
self.mapview.add_marker(marker)
|
||||
self.pothole_markers.append(marker)
|
||||
|
||||
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