- Defines Network, StopArea, StopPoints and JourneySections - Loads them from json using the build_from_json method
54 lines
1 KiB
C++
54 lines
1 KiB
C++
#pragma once
|
|
|
|
#include <nlohmann/json.hpp>
|
|
#include "trenesis/geojson.h"
|
|
|
|
namespace trenesis {
|
|
using json = nlohmann::json;
|
|
|
|
struct StopPoint;
|
|
|
|
struct StopArea {
|
|
std::string id;
|
|
std::string label;
|
|
std::string name;
|
|
Point coord;
|
|
|
|
std::unordered_map<std::string, std::unique_ptr<StopPoint>> stop_points;
|
|
|
|
StopArea(std::string id, std::string label, std::string name, Point coord);
|
|
};
|
|
|
|
struct JourneySection {
|
|
StopPoint* origin;
|
|
StopPoint* destination;
|
|
// TODO: use real types for times
|
|
std::string departure_time;
|
|
std::string arrival_time;
|
|
};
|
|
|
|
struct StopPoint {
|
|
std::string id;
|
|
std::string label;
|
|
std::string name;
|
|
Point coord;
|
|
StopArea* stop_area;
|
|
|
|
std::vector<JourneySection> departures;
|
|
|
|
StopPoint(
|
|
std::string id,
|
|
std::string label,
|
|
std::string name,
|
|
Point coord,
|
|
StopArea* stop_area
|
|
);
|
|
};
|
|
|
|
struct Network {
|
|
std::unordered_map<std::string, std::unique_ptr<StopArea>> stop_areas;
|
|
|
|
static Network build_from_json(const json& vehicle_journeys, const json& stop_points);
|
|
};
|
|
|
|
}
|