Commit 71abf5ce authored by a.zitz's avatar a.zitz

EventManager in Simulation.cpp bekannt gemacht

parent 7b43d98f
......@@ -42,6 +42,7 @@ Simulation::Simulation() {
_solver = NULL;
_iod = new IODispatcher();
_fps=1;
_em = NULL;
}
Simulation::~Simulation() {
......@@ -51,6 +52,7 @@ Simulation::~Simulation() {
delete _model;
delete _solver;
delete _iod;
delete _em;
}
/************************************************
......@@ -409,7 +411,7 @@ int Simulation::RunSimulation() {
if (frameNr % writeInterval == 0) {
_iod->WriteFrame(frameNr / writeInterval, _building);
}
_eventsManager->Update();
//_eventsManager->Update();
}
// writing the footer
_iod->WriteFooter();
......
......@@ -45,6 +45,7 @@
#include "routing/RoutingEngine.h"
#include "routing/SafestPathRouter.h"
#include "pedestrian/PedDistributor.h"
#include "events/EventManager.h" //neuer Header fuer die Events
extern OutputHandler* Log;
......@@ -73,6 +74,8 @@ private:
ODESolver* _solver;
/// writing the trajectories to file
IODispatcher* _iod;
///new: EventManager
EventManager _em;
public:
......
......@@ -2,14 +2,22 @@
#include <cstdlib>
#include <iostream>
#include <string>
#include "EventManager.h"
#include "../tinyxml/tinyxml.h"
#include "../IO/OutputHandler.h"
using namespace std;
void readEventsXml(string eventfile){
int event_count=0;
/*******************
Konstruktoren
******************/
EventManager::EventManager(){
_event_times=vector<int>();
_event_values=vector<string>();
}
void readEventsXml(string eventfile){
Log->Write("INFO: \tLoading and parsing the event file <%s>",eventfile.c_str());
TiXmlDocument doc(eventfile);
......@@ -32,10 +40,10 @@ void readEventsXml(string eventfile){
}
for(TiXmlElement* e = xEvents->FirstChildElement("event"); e; e= e->NextSiblingElement("event")){
event_times[event_count]=atoi(e->Attribute("time"));
event_values[event_count]=e->Attribute("type"))+"-";
event_values[event_count]=e->Attribute("id"))+"-";
event_values[event_count]=e->Attribute("state"));
event_count++;
_event_times.push_back(atoi(e->Attribute("time")));
string tmp=e->Attribute("type"))+"-");
tmp=tmp+e->Attribute("id"))+"-";
tmp=tmp+=e->Attribute("state"));
_event_values.push_back(tmp);
}
}
\ No newline at end of file
}
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
class EventManager {
private:
std::vector<int> _event_times;
std::vector<string> _event_values;
public:
EventManager();
readEventsXml(string eventfile);
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment