diff --git a/speed_map_display.py b/speed_map_display.py index 61d8740..ba03a14 100644 --- a/speed_map_display.py +++ b/speed_map_display.py @@ -1,7 +1,9 @@ import pygame +from gps_loader import GPSLoader from map_display import MapDisplay from path import Path +from units import Unit from vec import Vec2 @@ -52,3 +54,30 @@ class SpeedMapDisplay(MapDisplay): b = int(b_span * f + self.min_speed_col[2]) return r, g, b + + +if __name__ == '__main__': + name = "data_28-03" + cities = [ + (Vec2(7.359119, 46.227302), "Sion", "above"), + (Vec2(7.079001, 46.105981), "Martigny", "below"), + (Vec2(7.001849, 46.216559), "Saint-Maurice", "right") + ] + + data = GPSLoader.load_data(f"{name}.csv") + speeds = list(map(lambda s: s.convert(Unit.KM_H).value, data["speeds"])) + path = Path(data["points"], speeds) + + pygame.init() + + win = pygame.display.set_mode([600, 600]) + display = SpeedMapDisplay( + win, + 6.971094, 7.430611, + 46.076312, 46.253036, + cities, + (255, 0, 0), (0, 255, 0), 155) + + display.draw_path(path) + pygame.display.flip() + input()