Commit 50537e39 authored by Ulrich Kemloh's avatar Ulrich Kemloh

changing functions signature from void to bool.

Geometry functions now return false on failure.
parent a5161e99
......@@ -315,9 +315,9 @@ void TrajectoriesJPSV04::WriteFrame(int frameNr, Building* building)
string caption = r->GetCaption();
if ((rooms_to_plot.empty() == false)
&& (IsElementInVector(rooms_to_plot, caption) == false)) {
continue;
}
&& (IsElementInVector(rooms_to_plot, caption) == false)) {
continue;
}
data.append(WritePed(ped));
}
......@@ -341,6 +341,7 @@ TrajectoriesFLAT::TrajectoriesFLAT() : Trajectories()
void TrajectoriesFLAT::WriteHeader(int nPeds, double fps, Building* building, int seed)
{
(void) seed; (void) nPeds;
char tmp[CLENGTH] = "";
Write("#description: my super simulation");
sprintf(tmp, "#framerate: %0.2f",fps);
......@@ -356,7 +357,7 @@ void TrajectoriesFLAT::WriteHeader(int nPeds, double fps, Building* building, in
void TrajectoriesFLAT::WriteGeometry(Building* building)
{
(void) building;
}
void TrajectoriesFLAT::WriteFrame(int frameNr, Building* building)
......@@ -392,6 +393,8 @@ TrajectoriesVTK::TrajectoriesVTK()
void TrajectoriesVTK::WriteHeader(int nPeds, double fps, Building* building, int seed)
{
//suppress unused warnings
(void) nPeds; (void) fps ; (void) seed;
Write("# vtk DataFile Version 4.0");
Write(building->GetCaption());
Write("ASCII");
......@@ -447,6 +450,7 @@ void TrajectoriesVTK::WriteGeometry(Building* building)
void TrajectoriesVTK::WriteFrame(int frameNr, Building* building)
{
(void) frameNr; (void)building;
}
void TrajectoriesVTK::WriteFooter()
......@@ -481,24 +485,24 @@ void TrajectoriesJPSV06::WriteHeader(int nPeds, double fps, Building* building,
void TrajectoriesJPSV06::WriteGeometry(Building* building)
{
// just put a link to the geometry file
// string embed_geometry;
// embed_geometry.append("\t<geometry>\n");
// char file_location[CLENGTH] = "";
// sprintf(file_location, "\t<file location= \"%s\"/>\n", building->GetGeometryFilename().c_str());
// embed_geometry.append(file_location);
// //embed_geometry.append("\t</geometry>\n");
//
// const map<int, Hline*>& hlines=building->GetAllHlines();
// if(hlines.size()>0){
// //embed_geometry.append("\t<geometry>\n");
// for (std::map<int, Hline*>::const_iterator it=hlines.begin(); it!=hlines.end(); ++it)
// {
// embed_geometry.append(it->second->WriteElement());
// }
// //embed_geometry.append("\t</geometry>\n");
// }
// embed_geometry.append("\t</geometry>\n");
// Write(embed_geometry);
// string embed_geometry;
// embed_geometry.append("\t<geometry>\n");
// char file_location[CLENGTH] = "";
// sprintf(file_location, "\t<file location= \"%s\"/>\n", building->GetGeometryFilename().c_str());
// embed_geometry.append(file_location);
// //embed_geometry.append("\t</geometry>\n");
//
// const map<int, Hline*>& hlines=building->GetAllHlines();
// if(hlines.size()>0){
// //embed_geometry.append("\t<geometry>\n");
// for (std::map<int, Hline*>::const_iterator it=hlines.begin(); it!=hlines.end(); ++it)
// {
// embed_geometry.append(it->second->WriteElement());
// }
// //embed_geometry.append("\t</geometry>\n");
// }
// embed_geometry.append("\t</geometry>\n");
// Write(embed_geometry);
//set the content of the file
string fileName=building->GetProjectRootDir()+"/"+building->GetGeometryFilename().c_str();
......@@ -510,51 +514,51 @@ void TrajectoriesJPSV06::WriteGeometry(Building* building)
buffer << t.rdbuf();
embed_geometry=buffer.str();
Write(embed_geometry);
//
//
// //collecting the hlines
// std::stringstream hlines_buffer;
// // add the header
// hlines_buffer<<" <routing version=\"0.5\" "
// <<"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
// <<"xsi:noNamespaceSchemaLocation=\"http://134.94.2.137/jps_routing.xsd\" >"<<endl
// <<"<Hlines> "<<endl;
//
// const map<int, Hline*>& hlines=building->GetAllHlines();
// for (std::map<int, Hline*>::const_iterator it=hlines.begin(); it!=hlines.end(); ++it)
// {
// Hline* hl=it->second;
// hlines_buffer <<"\t<Hline id=\""<< hl->GetID()<<"\" room_id=\""<<hl->GetRoom1()->GetID()
// <<"\" subroom_id=\""<< hl->GetSubRoom1()->GetSubRoomID()<<"\">"<<endl;
// hlines_buffer <<"\t\t<vertex px=\""<< hl->GetPoint1()._x<<"\" py=\""<< hl->GetPoint1()._y<<"\" />"<<endl;
// hlines_buffer <<"\t\t<vertex px=\""<< hl->GetPoint2()._x<<"\" py=\""<< hl->GetPoint2()._y<<"\" />"<<endl;
// hlines_buffer <<"\t</Hline>"<<endl;
// }
// hlines_buffer<<"</Hlines> "<<endl;
// hlines_buffer<<"</routing> "<<endl;
//
// string hline_string=hlines_buffer.str();
// string to_replace="</geometry>";
// hline_string.append(to_replace);
//
// size_t start_pos = embed_geometry.find(to_replace);
// if(start_pos == std::string::npos)
// {
// Log->Write("WARNING:\t missing %s tag while writing the geometry in the trajectory file.",to_replace.c_str());
// }
//
// embed_geometry.replace(start_pos, to_replace.length(), hline_string);
// Write(embed_geometry);
// Write("\t<AttributeDescription>");
// Write("\t\t<property tag=\"x\" description=\"xPosition\"/>");
// Write("\t\t<property tag=\"y\" description=\"yPosition\"/>");
// Write("\t\t<property tag=\"z\" description=\"zPosition\"/>");
// Write("\t\t<property tag=\"rA\" description=\"radiusA\"/>");
// Write("\t\t<property tag=\"rB\" description=\"radiusB\"/>");
// Write("\t\t<property tag=\"eC\" description=\"ellipseColor\"/>");
// Write("\t\t<property tag=\"eO\" description=\"ellipseOrientation\"/>");
// Write("\t</AttributeDescription>\n");
//
//
// //collecting the hlines
// std::stringstream hlines_buffer;
// // add the header
// hlines_buffer<<" <routing version=\"0.5\" "
// <<"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
// <<"xsi:noNamespaceSchemaLocation=\"http://134.94.2.137/jps_routing.xsd\" >"<<endl
// <<"<Hlines> "<<endl;
//
// const map<int, Hline*>& hlines=building->GetAllHlines();
// for (std::map<int, Hline*>::const_iterator it=hlines.begin(); it!=hlines.end(); ++it)
// {
// Hline* hl=it->second;
// hlines_buffer <<"\t<Hline id=\""<< hl->GetID()<<"\" room_id=\""<<hl->GetRoom1()->GetID()
// <<"\" subroom_id=\""<< hl->GetSubRoom1()->GetSubRoomID()<<"\">"<<endl;
// hlines_buffer <<"\t\t<vertex px=\""<< hl->GetPoint1()._x<<"\" py=\""<< hl->GetPoint1()._y<<"\" />"<<endl;
// hlines_buffer <<"\t\t<vertex px=\""<< hl->GetPoint2()._x<<"\" py=\""<< hl->GetPoint2()._y<<"\" />"<<endl;
// hlines_buffer <<"\t</Hline>"<<endl;
// }
// hlines_buffer<<"</Hlines> "<<endl;
// hlines_buffer<<"</routing> "<<endl;
//
// string hline_string=hlines_buffer.str();
// string to_replace="</geometry>";
// hline_string.append(to_replace);
//
// size_t start_pos = embed_geometry.find(to_replace);
// if(start_pos == std::string::npos)
// {
// Log->Write("WARNING:\t missing %s tag while writing the geometry in the trajectory file.",to_replace.c_str());
// }
//
// embed_geometry.replace(start_pos, to_replace.length(), hline_string);
// Write(embed_geometry);
// Write("\t<AttributeDescription>");
// Write("\t\t<property tag=\"x\" description=\"xPosition\"/>");
// Write("\t\t<property tag=\"y\" description=\"yPosition\"/>");
// Write("\t\t<property tag=\"z\" description=\"zPosition\"/>");
// Write("\t\t<property tag=\"rA\" description=\"radiusA\"/>");
// Write("\t\t<property tag=\"rB\" description=\"radiusB\"/>");
// Write("\t\t<property tag=\"eC\" description=\"ellipseColor\"/>");
// Write("\t\t<property tag=\"eO\" description=\"ellipseOrientation\"/>");
// Write("\t</AttributeDescription>\n");
}
void TrajectoriesJPSV06::WriteFrame(int frameNr, Building* building)
......
This diff is collapsed.
......@@ -100,7 +100,7 @@ public:
/**
* Read parameters from the argument parser class.
*/
void InitArgs(ArgumentParser *args);
bool InitArgs(ArgumentParser *args);
/**
* @return the total simulated/evacuation time
......
......@@ -22,10 +22,10 @@ EventManager::EventManager(Building *_b){
_lastUpdateTime=0;
_deltaT=0;
if(!_file){
Log->Write("INFO:\tDatei events.txt nicht gefunden. Dynamisches Eventhandling nicht moeglich.");
Log->Write("INFO:\tFiles 'events.txt' missing. Realtime interaction with the simulation not possible.");
}
else{
Log->Write("INFO:\tDatei events.txt gefunden. Dynamisches Eventhandling moeglich.");
Log->Write("INFO:\tFile 'events.txt' will be monitored for new events.");
_dynamic=true;
}
}
......@@ -42,7 +42,7 @@ void EventManager::SetProjectRootDir(const std::string &filename){
}
void EventManager::readEventsXml(){
Log->Write("INFO: \tLooking for events");
Log->Write("INFO: \tLooking for pre-defined events in other files");
//get the geometry filename from the project file
TiXmlDocument doc(_projectFilename);
if (!doc.LoadFile()){
......@@ -97,16 +97,19 @@ void EventManager::readEventsXml(){
Log->Write("INFO: \tEvents were read\n");
}
void EventManager::listEvents(){
if(_event_times.size()==0){
Log->Write("INFO: \tNo events in the events.xml");
}
else{
char buf[10],buf2[10];
for(unsigned int i=0;i<_event_times.size();i++){
sprintf(buf,"%f",_event_times[i]);
sprintf(buf2,"%d",_event_ids[i]);
Log->Write("INFO: \tAfter "+string(buf)+" sec: "+_event_types[i]+" "+string(buf2)+" "+_event_states[i]);
void EventManager::listEvents()
{
if (_event_times.size() == 0) {
//this notification was already printed ealier
//Log->Write("INFO: \tNo events in the events.xml");
} else {
char buf[10], buf2[10];
for (unsigned int i = 0; i < _event_times.size(); i++) {
sprintf(buf, "%f", _event_times[i]);
sprintf(buf2, "%d", _event_ids[i]);
Log->Write(
"INFO: \tAfter " + string(buf) + " sec: " + _event_types[i]
+ " " + string(buf2) + " " + _event_states[i]);
}
}
......
......@@ -162,4 +162,7 @@ template<typename A>
return true;
}
}
//another useful macro
//#define UNUSED(expr) (void)(expr)
#endif /* _MACROS_H */
......@@ -259,7 +259,7 @@ void Building::AddSurroundingRoom()
}
void Building::InitGeometry()
bool Building::InitGeometry()
{
Log->Write("INFO: \tInit Geometry");
for (int i = 0; i < GetNumberOfRooms(); i++) {
......@@ -284,7 +284,8 @@ void Building::InitGeometry()
}
// initialize the poly
s->ConvertLineToPoly(goals);
if(! s->ConvertLineToPoly(goals))
return false;
s->CalculateArea();
goals.clear();
......@@ -292,11 +293,14 @@ void Building::InitGeometry()
const vector<Obstacle*>& obstacles = s->GetAllObstacles();
for (unsigned int obs = 0; obs < obstacles.size(); ++obs) {
if (obstacles[obs]->GetClosed() == 1)
obstacles[obs]->ConvertLineToPoly();
if(!obstacles[obs]->ConvertLineToPoly())
return false;
}
}
}
Log->Write("INFO: \tInit Geometry successful!!!\n");
return true;
}
......@@ -324,7 +328,7 @@ const std::string& Building::GetGeometryFilename() const
return _geometryFilename;
}
void Building::LoadGeometry(const std::string &geometryfile)
bool Building::LoadGeometry(const std::string &geometryfile)
{
//get the geometry filename from the project file
string geoFilenameWithPath= _projectRootDir + geometryfile;
......@@ -335,7 +339,7 @@ void Building::LoadGeometry(const std::string &geometryfile)
if (!doc.LoadFile()) {
Log->Write("ERROR: \t%s", doc.ErrorDesc());
Log->Write("\t could not parse the project file");
exit(EXIT_FAILURE);
return false;
}
Log->Write("INFO: \tParsing the geometry file");
......@@ -352,23 +356,23 @@ void Building::LoadGeometry(const std::string &geometryfile)
if (!docGeo.LoadFile()) {
Log->Write("ERROR: \t%s", docGeo.ErrorDesc());
Log->Write("\t could not parse the geometry file");
exit(EXIT_FAILURE);
return false;
}
TiXmlElement* xRootNode = docGeo.RootElement();
if( ! xRootNode ) {
Log->Write("ERROR:\tRoot element does not exist");
exit(EXIT_FAILURE);
return false;
}
if( xRootNode->ValueStr () != "geometry" ) {
Log->Write("ERROR:\tRoot element value is not 'geometry'.");
exit(EXIT_FAILURE);
return false;
}
if(xRootNode->Attribute("unit"))
if(string(xRootNode->Attribute("unit")) != "m") {
Log->Write("ERROR:\tOnly the unit m (meters) is supported. \n\tYou supplied [%s]",xRootNode->Attribute("unit"));
exit(EXIT_FAILURE);
return false;
}
double version = xmltof(xRootNode->Attribute("version"), -1);
......@@ -377,7 +381,7 @@ void Building::LoadGeometry(const std::string &geometryfile)
Log->Write(" \tWrong geometry version!");
Log->Write(" \tOnly version >= %s supported",JPS_VERSION);
Log->Write(" \tPlease update the version of your geometry file to %s",JPS_VERSION);
exit(EXIT_FAILURE);
return false;
}
_caption = xmltoa(xRootNode->Attribute("caption"), "virtual building");
......@@ -388,7 +392,7 @@ void Building::LoadGeometry(const std::string &geometryfile)
TiXmlNode* xRoomsNode = xRootNode->FirstChild("rooms");
if (!xRoomsNode) {
Log->Write("ERROR: \tThe geometry should have at least one room and one subroom");
exit(EXIT_FAILURE);
return false;
}
for(TiXmlElement* xRoom = xRoomsNode->FirstChildElement("room"); xRoom;
......@@ -431,7 +435,7 @@ void Building::LoadGeometry(const std::string &geometryfile)
if(xSubRoom->FirstChildElement("up")==NULL) {
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the stair");
Log->Write("ERROR:\t check your geometry file");
exit(EXIT_FAILURE);
return false;
}
double up_x = xmltof( xSubRoom->FirstChildElement("up")->Attribute("px"), 0.0);
double up_y = xmltof( xSubRoom->FirstChildElement("up")->Attribute("py"), 0.0);
......@@ -601,8 +605,10 @@ void Building::LoadGeometry(const std::string &geometryfile)
AddTransition(t);
}
Log->Write("INFO: \tLoading building file successful!!!\n");
//everything went fine
return true;
}
......@@ -851,18 +857,21 @@ bool Building::IsVisible(const Point& p1, const Point& p2, bool considerHlines)
return true;
}
void Building::SanityCheck()
bool Building::SanityCheck()
{
Log->Write("INFO: \tChecking the geometry for artifacts");
bool status = true;
for (unsigned int i = 0; i < _rooms.size(); i++) {
Room* room = _rooms[i];
for (int j = 0; j < room->GetNumberOfSubRooms(); j++) {
SubRoom* sub = room->GetSubRoom(j);
sub->SanityCheck();
if (!sub->SanityCheck())
status = false;
}
}
Log->Write("INFO: \t...Done!!!\n");
return status;
}
......@@ -938,25 +947,25 @@ void Building::InitGrid(double cellSize)
Log->Write("INFO: \tDone with Initializing the grid ");
}
void Building::LoadRoutingInfo(const string &filename)
bool Building::LoadRoutingInfo(const string &filename)
{
Log->Write("INFO:\tLoading extra routing information");
if (filename == "") {
Log->Write("INFO:\t No file supplied !");
Log->Write("INFO:\t done with loading extra routing information");
return;
return true;
}
TiXmlDocument docRouting(filename);
if (!docRouting.LoadFile()) {
Log->Write("ERROR: \t%s", docRouting.ErrorDesc());
Log->Write("ERROR: \t could not parse the routing file");
exit(EXIT_FAILURE);
return false;
}
TiXmlElement* xRootNode = docRouting.RootElement();
if( ! xRootNode ) {
Log->Write("ERROR:\tRoot element does not exist");
exit(EXIT_FAILURE);
return false;
}
//load goals and routes
......@@ -993,7 +1002,9 @@ void Building::LoadRoutingInfo(const string &filename)
}
}
goal->ConvertLineToPoly();
if(!goal->ConvertLineToPoly())
return false;
AddGoal(goal);
_routingEngine->AddFinalDestinationID(goal->GetId());
}
......@@ -1008,7 +1019,7 @@ void Building::LoadRoutingInfo(const string &filename)
double id = xmltof(trip->Attribute("id"), -1);
if (id == -1) {
Log->Write("ERROR:\t id missing for trip");
exit(EXIT_FAILURE);
return false;
}
string sTrip = trip->FirstChild()->ValueStr();
vector<string> vTrip;
......@@ -1023,9 +1034,10 @@ void Building::LoadRoutingInfo(const string &filename)
_routingEngine->AddTrip(vTrip);
}
Log->Write("INFO:\tdone with loading extra routing information");
return true;
}
void Building::LoadTrafficInfo()
bool Building::LoadTrafficInfo()
{
Log->Write("INFO:\tLoading the traffic info file");
......@@ -1035,14 +1047,13 @@ void Building::LoadTrafficInfo()
if (!doc.LoadFile()) {
Log->Write("ERROR: \t%s", doc.ErrorDesc());
Log->Write("ERROR: \t could not parse the project file");
exit(EXIT_FAILURE);
return false;
}
TiXmlNode* xRootNode = doc.RootElement()->FirstChild("traffic_constraints");
if( ! xRootNode ) {
Log->Write("WARNING:\tcould not find any traffic information");
return;
//exit(EXIT_FAILURE);
return true;
}
//processing the rooms node
......@@ -1076,6 +1087,7 @@ void Building::LoadTrafficInfo()
}
}
Log->Write("INFO:\tDone with loading traffic info file");
return true;
}
......
......@@ -163,7 +163,7 @@ public:
LCGrid* GetGrid() const;
// convenience methods
void InitGeometry();
bool InitGeometry();
void InitGrid(double cellSize);
//void InitRoomsAndSubroomsMap();
void InitSavePedPathway(const std::string &filename);
......@@ -193,7 +193,7 @@ public:
*
* @param filename, the geometry file
*/
void LoadGeometry(const std::string &geometryfile="");
bool LoadGeometry(const std::string &geometryfile="");
/**
* Write the geometry to the given file.
......@@ -203,15 +203,15 @@ public:
*/
bool SaveGeometry(const std::string &filename);
void LoadTrafficInfo();
void LoadRoutingInfo(const std::string &filename);
bool LoadTrafficInfo();
bool LoadRoutingInfo(const std::string &filename);
void WriteToErrorLog() const;
/**
* Check the scenario for possible errors and
* output user specific informations.
*/
void SanityCheck();
bool SanityCheck();
private:
......
......@@ -182,9 +182,8 @@ bool Goal::Contains(const Point& ped) const
return false;
}
void Goal::ConvertLineToPoly()
bool Goal::ConvertLineToPoly()
{
vector<Line*> copy;
vector<Point> tmpPoly;
Point point;
......@@ -219,11 +218,11 @@ void Goal::ConvertLineToPoly()
char tmp[CLENGTH];
sprintf(tmp, "ERROR: \tGoal::ConvertLineToPoly(): ID %d !!!\n", _id);
Log->Write(tmp);
exit(0);
return false;
}
_poly = tmpPoly;
ComputeControid();
return true;
}
const Point& Goal::GetCentroid() const
......
......@@ -90,7 +90,7 @@ public:
/**
* Create the obstacles polygonal structure from the walls
*/
void ConvertLineToPoly();
bool ConvertLineToPoly();
/**
* @return the Goal as a polygon
......
......@@ -209,15 +209,16 @@ bool Obstacle::Contains(const Point& ped) const
return false;
}
void Obstacle::ConvertLineToPoly()
bool Obstacle::ConvertLineToPoly()
{
if(_isClosed==0.0) {
if(_isClosed==0.0)
{
char tmp[CLENGTH];
sprintf(tmp, "INFO: \tObstacle [%d] is not closed. Not converting to polyline.\n", _id);
Log->Write(tmp);
return;
return true;
}
vector<Line*> copy;
vector<Point> tmpPoly;
Point point;
......@@ -252,9 +253,10 @@ void Obstacle::ConvertLineToPoly()
char tmp[CLENGTH];
sprintf(tmp, "ERROR: \tObstacle::ConvertLineToPoly(): ID %d !!!\n", _id);
Log->Write(tmp);
exit(0);
return false;
}
_poly = tmpPoly;
return true;
}
const Point Obstacle::GetCentroid() const
......
......@@ -112,7 +112,7 @@ public:
/**
* Create the obstacles polygonal structure from the walls
*/
void ConvertLineToPoly();
bool ConvertLineToPoly();
/**
* @return the obstacle as a polygon
......
......@@ -465,7 +465,7 @@ void SubRoom::CheckObstacles()
}
}
void SubRoom::SanityCheck()
bool SubRoom::SanityCheck()
{
if(_obstacles.size()==0) {
if((IsConvex()==false) && (_hlines.size()==0)) {
......@@ -482,7 +482,7 @@ void SubRoom::SanityCheck()
// everything is fine
}
}
return true;
}
///http://stackoverflow.com/questions/471962/how-do-determine-if-a-polygon-is-complex-convex-nonconvex
......@@ -622,7 +622,7 @@ void NormalSubRoom::WriteToErrorLog() const
}
}
void NormalSubRoom::ConvertLineToPoly(vector<Line*> goals)
bool NormalSubRoom::ConvertLineToPoly(vector<Line*> goals)
{
vector<Line*> copy;
vector<Point> tmpPoly;
......@@ -664,9 +664,10 @@ void NormalSubRoom::ConvertLineToPoly(vector<Line*> goals)
Log->Write(tmp);
sprintf(tmp, "ERROR: \tDistance between the points: %lf !!!\n", (tmpPoly[0] - point).Norm());
Log->Write(tmp);
exit(EXIT_FAILURE);
return false;
}
_poly = tmpPoly;
return true;
}
......@@ -866,11 +867,10 @@ const Point* Stair::CheckCorner(const Point** otherPoint, const Point** aktPoint
return rueck;
}
void Stair::ConvertLineToPoly(vector<Line*> goals)
bool Stair::ConvertLineToPoly(vector<Line*> goals)
{
//return NormalSubRoom::ConvertLineToPoly(goals);
vector<Line*> copy;
vector<Point> orgPoly = vector<Point > ();
const Point* aktPoint;
......@@ -924,7 +924,7 @@ void Stair::ConvertLineToPoly(vector<Line*> goals)
sprintf(tmp, "ERROR: \tStair::ConvertLineToPoly(): SubRoom %d Room %d Anfangspunkt ungleich Endpunkt!!!\n"
"\t(%f, %f) != (%f, %f)\n", GetSubRoomID(), GetRoomID(), x1, y1, x2, y2);
Log->Write(tmp);
exit(EXIT_FAILURE);
return false;
}
if (orgPoly.size() != 4) {
......@@ -932,7 +932,7 @@ void Stair::ConvertLineToPoly(vector<Line*> goals)
sprintf(tmp, "ERROR: \tStair::ConvertLineToPoly(): Stair %d Room %d ist kein Viereck!!!\n"
"Anzahl Ecken: %d\n", GetSubRoomID(), (int)GetRoomID(), (int)orgPoly.size());
Log->Write(tmp);
exit(EXIT_FAILURE);
return false;
}
vector<Point> neuPoly = (orgPoly);
// ganz kleine Treppen (nur eine Stufe) nicht
......@@ -957,6 +957,8 @@ void Stair::ConvertLineToPoly(vector<Line*> goals)
}
}
_poly = neuPoly;
return true;
}
bool Stair::IsInSubRoom(const Point& ped) const
......
......@@ -237,7 +237,7 @@ public:
* Check the subroom for possible errors and
* output user specific informations.
*/
void SanityCheck();
bool SanityCheck();
//navigation
void AddCrossing(Crossing* line);
......@@ -291,7 +291,7 @@ public:
virtual std::string WritePolyLine() const=0;
/// convert all walls and transitions(doors) into a polygon representing the subroom
virtual void ConvertLineToPoly(std::vector<Line*> goals) = 0;
virtual bool ConvertLineToPoly(std::vector<Line*> goals) = 0;
///check whether the pedestrians is still in the subroom
virtual bool IsInSubRoom(const Point& ped) const = 0;
......@@ -327,7 +327,7 @@ public:
std::string WritePolyLine() const;
void WriteToErrorLog() const;
void ConvertLineToPoly(std::vector<Line*> goals);
bool ConvertLineToPoly(std::vector<Line*> goals);
bool IsInSubRoom(const Point& ped) const;
};
......@@ -362,7 +362,7 @@ public:
std::string WriteSubRoom() const;
std::string WritePolyLine() const;
virtual void WriteToErrorLog() const;
virtual void ConvertLineToPoly(std::vector<Line*> goals);
virtual bool ConvertLineToPoly(std::vector<Line*> goals);
bool IsInSubRoom(const Point& ped) const;
};
......
......@@ -48,36 +48,38 @@ int main(int argc, char **argv)
time(&starttime);
Simulation sim = Simulation();
sim.InitArgs(args);
Log->Write("INFO: \tStart runSimulation()");
int evacTime = sim.RunSimulation();
Log->Write("\nINFO: \tEnd runSimulation()");
time(&endtime);
if(sim.InitArgs(args))
{
Log->Write("INFO: \tStart runSimulation()");
int evacTime = sim.RunSimulation();
Log->Write(