mirror of
https://github.com/Rhinemann/IoT-Systems.git
synced 2026-03-14 20:50:39 +02:00
Merge pull request #18 from Rhinemann/dev
Scrum 87 - MapViewApp (check_road_quality, update_car_marker)
This commit is contained in:
commit
0bd3eaa91d
@ -21,12 +21,36 @@ class MapViewApp(App):
|
||||
Викликається регулярно для оновлення мапи
|
||||
"""
|
||||
|
||||
def check_road_quality(self, point):
|
||||
"""
|
||||
Аналізує дані акселерометра для подальшого визначення
|
||||
та відображення ям та лежачих поліцейських
|
||||
"""
|
||||
if len(point) < 3:
|
||||
return
|
||||
|
||||
lat, lon, road_state = point
|
||||
|
||||
if road_state == "pothole":
|
||||
self.set_pothole_marker((lat, lon))
|
||||
elif road_state == "bump":
|
||||
self.set_bump_marker((lat, lon))
|
||||
|
||||
def update_car_marker(self, point):
|
||||
"""
|
||||
Оновлює відображення маркера машини на мапі
|
||||
:param point: GPS координати
|
||||
"""
|
||||
lat, lon = point[0], point[1]
|
||||
|
||||
if not hasattr(self, 'car_marker'):
|
||||
self.car_marker = MapMarker(lat=lat, lon=lon, source='./images/car')
|
||||
self.mapview.add_marker(self.car_marker)
|
||||
else:
|
||||
self.car_marker.lat = lat
|
||||
self.car_marker.lon = lon
|
||||
|
||||
self.mapview.center_on(lat, lon)
|
||||
|
||||
def set_pothole_marker(self, point):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user