diff --git a/MapView/main.py b/MapView/main.py index 3e925f1..d97feb3 100644 --- a/MapView/main.py +++ b/MapView/main.py @@ -17,6 +17,7 @@ class MapViewApp(App): # додати необхідні змінні self.bump_markers = [] + self.pothole_markers = [] def on_start(self): """ @@ -78,10 +79,23 @@ 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): if isinstance(point, dict):