13 : m_Name(name), m_Size(size), m_Origin(origin),
49 std::sort(keyframes.begin(), keyframes.end(),
51 if (a.AgentId != b.AgentId) {
52 return a.AgentId < b.AgentId;
59 for (
int i = 0; i < keyframes.size() - 1; i++) {
66 if (keyframes[i].AgentId == keyframes[i + 1].AgentId) {
67 auto iter = m_Routes.find(keyframes[i].AgentId);
68 if (iter == m_Routes.end()) {
69 std::vector<std::vector<Core::CartesianCoordinate>> vec;
70 vec.push_back(m_Routemaker->MakeRoute(keyframes[i],
72 m_Routes.insert(std::make_pair(keyframes[i].AgentId, vec));
74 iter->second.push_back(m_Routemaker->MakeRoute(
75 keyframes[i], keyframes[i + 1]));
86 m_Agents.push_back(newAgent);
90 Scenario::save(std::string filename)
96 Scenario::load(std::string filename)
99 SetOrigin(m_Origin, m_Size);
KeyframeManagement::KeyframeManager & m_KeyframeManager
std::unique_ptr< Routemaker::Routemaker > m_Routemaker
RouteMap & Compile()
Compiles the scenario into a map of routes.
Core::GeographicalCoordinate m_Origin
std::map< int, std::vector< std::vector< Core::CartesianCoordinate > > > RouteMap
Scenario(std::string name, Core::GeographicalCoordinate origin, int size)
Constructs a new Scenario object with the given name, origin, and size.
void SetOrigin(Core::GeographicalCoordinate GeoCoord, int size)
Sets the origin of the scenario to the given geographical coordinates and size.
static void ResetOrigin(Core::GeographicalCoordinate geoCoord, int size)
Sets the origin coordinate to use with relative coordinates.
static Core::UTMCoordinate GeographicToUTM(Core::GeographicalCoordinate GeoCoord)
Function used to convert a geographical coordinate to a UTM coordinate.
std::vector< Core::Keyframe > & GetKeyframes()
Returns a reference to the list of keyframes.
static void GetMap(Core::UTMCoordinate coord, int size)
Retrieves the map from Kartverket for the specified UTM coordinate and size.
void deserialize(std::string filename, ISValue *p)
Function to start deserializing a file.
void serialize(std::string filename, ISValue *p)
Function to start serializing an onbject.
A structure that represents a geographic coordinate.
A structure representing an agent's position in cartesian space at a given point in time.