Map.hpp 1.15 KB
Newer Older
Martin Kröning's avatar
Martin Kröning committed
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once

#include "MapAppABIWrapper.hpp"
#include <chrono>
#include <iosfwd>
#include <memory>
#include <string>
#include <vector>
class Junction;

class Map {
public:
13
  Map(std::istream &is, const std::string &windowTitle);
Martin Kröning's avatar
Martin Kröning committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

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

private:
  double time;
  std::vector<std::shared_ptr<Junction>> junctions;
  MapAppABIWrapper mapApp;

  std::weak_ptr<Junction> getJunction(const std::string &name);

  /// Required format:
  /// `name` `fuelAmount` `x` `y`
  void extractJunctionAndDraw(std::istream &is, MapAppABIWrapper &mapApp);

  /// Required format:
  /// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA` `length in km`
  /// `speedLimit in {1,2,3}` `noPassing` `coordinateCount` `coordinates...`
  void extractRoadAndDraw(std::istream &is, MapAppABIWrapper &mapApp);

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

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