Map.hpp 1.15 KB
Newer Older
Martin Kröning's avatar
Martin Kröning committed
1
2
#pragma once

3
#include "MapAppAPIWrapper.hpp"
Martin Kröning's avatar
Martin Kröning committed
4
5
6
#include <chrono>
#include <iosfwd>
#include <memory>
7
#include <string_view>
Martin Kröning's avatar
Martin Kröning committed
8
9
10
11
12
#include <vector>
class Junction;

class Map {
public:
13
  Map(std::istream &is, std::string_view windowTitle);
Martin Kröning's avatar
Martin Kröning committed
14
15
16
17
18
19
20

  void simulate(std::chrono::seconds duration, double speedFactor,
                double frequency);

private:
  double time;
  std::vector<std::shared_ptr<Junction>> junctions;
21
  MapAppAPIWrapper mapApp;
Martin Kröning's avatar
Martin Kröning committed
22

23
  std::weak_ptr<Junction> getJunction(std::string_view name);
Martin Kröning's avatar
Martin Kröning committed
24
25
26

  /// Required format:
  /// `name` `fuelAmount` `x` `y`
27
  void extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
Martin Kröning's avatar
Martin Kröning committed
28
29
30
31

  /// Required format:
  /// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA` `length in km`
  /// `speedLimit in {1,2,3}` `noPassing` `coordinateCount` `coordinates...`
32
  void extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
Martin Kröning's avatar
Martin Kröning committed
33
34
35
36
37
38
39
40
41
42

  /// Required format:
  /// `name` `topSpeed` `nameStartJunction` `timeOfStart`
  void extractBicycle(std::istream &is);

  /// Required format:
  /// `name` `topSpeed` `fuelConsumption` `fuelCapacity` `nameStartJunction`
  /// `timeOfStart`
  void extractCar(std::istream &is);
};