From 21ee07858f1473c3b4b75b41716ef24deba0bbca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Schr=C3=B6dter?= <t.schroedter@fz-juelich.de> Date: Tue, 26 Feb 2019 13:15:39 +0100 Subject: [PATCH] Updated FF Router to work with new door states --- routing/ff_router/FloorfieldViaFM.cpp | 17 ++++++++++------- routing/ff_router/UnivFFviaFM.cpp | 12 ++++++++---- routing/ff_router/ffRouter.cpp | 18 ++++++++++++------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/routing/ff_router/FloorfieldViaFM.cpp b/routing/ff_router/FloorfieldViaFM.cpp index b25c1a52..9fc648e3 100644 --- a/routing/ff_router/FloorfieldViaFM.cpp +++ b/routing/ff_router/FloorfieldViaFM.cpp @@ -369,7 +369,8 @@ void FloorfieldViaFM::createMapEntryInLineToGoalID(const int goalID) double cost_of_MIN3 = DBL_MAX; long int dummykey; for (const auto& loctrans : transitions) { - if (!loctrans.second->IsExit() || !loctrans.second->IsOpen()) { + //TODO if (!loctrans.second->IsExit() || !loctrans.second->IsOpen()) { + if (!loctrans.second->IsExit() || loctrans.second->IsClose()) { continue; } dummykey = _grid->getKeyAtPoint(loctrans.second->GetCentre()); @@ -488,9 +489,8 @@ void FloorfieldViaFM::parseBuilding(const Building* const buildingArg, const dou //create a list of walls const std::map<int, Transition*>& allTransitions = buildingArg->GetAllTransitions(); for (auto& trans : allTransitions) { - if ( - trans.second->IsExit() && trans.second->IsOpen() - ) + //TODO if (trans.second->IsExit() && trans.second->IsOpen()) + if (trans.second->IsExit() && !trans.second->IsClose()) { _exitsFromScope.emplace_back(Line ( (Line) *(trans.second))); } @@ -500,6 +500,7 @@ void FloorfieldViaFM::parseBuilding(const Building* const buildingArg, const dou } _numOfExits = (unsigned int) _exitsFromScope.size(); for (auto& trans : allTransitions) { + //TODO if (!trans.second->IsOpen()) { if (!trans.second->IsOpen()) { _wall.emplace_back(Line ( (Line) *(trans.second))); } @@ -546,6 +547,7 @@ void FloorfieldViaFM::parseBuilding(const Building* const buildingArg, const dou const vector<Crossing*>& allCrossings = itSubroom.second->GetAllCrossings(); for (Crossing* crossPtr : allCrossings) { + //TODO if (!crossPtr->IsOpen()) { if (!crossPtr->IsOpen()) { _wall.emplace_back( Line( (Line) *crossPtr)); @@ -661,9 +663,8 @@ void FloorfieldViaFM::parseBuildingForExits(const Building* const buildingArg, c //create a list of walls const std::map<int, Transition*>& allTransitions = buildingArg->GetAllTransitions(); for (auto& trans : allTransitions) { - if ( - trans.second->IsExit() && trans.second->IsOpen() - ) + //TODO if (trans.second->IsExit() && trans.second->IsOpen()) + if (trans.second->IsExit() && !trans.second->IsClose()) { _exitsFromScope.emplace_back(Line ( (Line) *(trans.second))); int roomID = -1; @@ -683,6 +684,7 @@ void FloorfieldViaFM::parseBuildingForExits(const Building* const buildingArg, c } _numOfExits = (unsigned int) _exitsFromScope.size(); for (auto& trans : allTransitions) { + //TODO if (!trans.second->IsOpen()) { if (!trans.second->IsOpen()) { _wall.emplace_back(Line ( (Line) *(trans.second))); } @@ -731,6 +733,7 @@ void FloorfieldViaFM::parseBuildingForExits(const Building* const buildingArg, c } const vector<Crossing*>& allCrossings = itSubroom.second->GetAllCrossings(); for (Crossing* crossPtr : allCrossings) { + //TODO if (!crossPtr->IsOpen()) { if (!crossPtr->IsOpen()) { _wall.emplace_back( Line( (Line) *crossPtr)); diff --git a/routing/ff_router/UnivFFviaFM.cpp b/routing/ff_router/UnivFFviaFM.cpp index d7382d5c..be5e5d04 100644 --- a/routing/ff_router/UnivFFviaFM.cpp +++ b/routing/ff_router/UnivFFviaFM.cpp @@ -81,7 +81,8 @@ UnivFFviaFM::UnivFFviaFM(Room* roomArg, Configuration* const confArg, double hx, bool isOpen = false; for (auto& cross : tmpCross) { uidNotConst = cross->GetUniqueID(); - isOpen = cross->IsOpen(); + //TODO isOpen = cross->IsOpen(); + isOpen = !cross->IsClose(); if (!isOpen) { //will be added twice! is it a problem? lines.emplace_back((Line)*cross); @@ -94,7 +95,8 @@ UnivFFviaFM::UnivFFviaFM(Room* roomArg, Configuration* const confArg, double hx, } for (auto& trans : tmpTrans) { uidNotConst = trans->GetUniqueID(); - isOpen = trans->IsOpen(); + //TODO isOpen = trans->IsOpen(); + isOpen = !trans->IsClose(); if (!isOpen) { //will be added twice! is it a problem? lines.emplace_back((Line)*trans); @@ -167,7 +169,8 @@ UnivFFviaFM::UnivFFviaFM(SubRoom* subRoomArg, Configuration* const confArg, doub bool isOpen = false; for (auto& cross : tmpCross) { uidNotConst = cross->GetUniqueID(); - isOpen = cross->IsOpen(); + //TODO isOpen = cross->IsOpen(); + isOpen = !cross->IsClose(); if (!isOpen) { lines.emplace_back((Line)*cross); } else { @@ -176,7 +179,8 @@ UnivFFviaFM::UnivFFviaFM(SubRoom* subRoomArg, Configuration* const confArg, doub } for (auto& trans : tmpTrans) { uidNotConst = trans->GetUniqueID(); - isOpen = trans->IsOpen(); + //TODO isOpen = trans->IsOpen(); + isOpen = !trans->IsClose(); if (!isOpen) { lines.emplace_back((Line)*trans); } else { diff --git a/routing/ff_router/ffRouter.cpp b/routing/ff_router/ffRouter.cpp index 7eccb01a..3152fd59 100644 --- a/routing/ff_router/ffRouter.cpp +++ b/routing/ff_router/ffRouter.cpp @@ -120,7 +120,8 @@ bool FFRouter::Init(Building* building) std::vector<std::pair<int, int>> roomAndCroTrVector; roomAndCroTrVector.clear(); for (auto& pair:allTrans) { - if (pair.second->IsOpen()) { + //TODO if (pair.second->IsOpen()) { + if (!pair.second->IsClose()) { _allDoorUIDs.emplace_back(pair.second->GetUniqueID()); _CroTrByUID.insert(std::make_pair(pair.second->GetUniqueID(), pair.second)); if (pair.second->IsExit()) { @@ -133,7 +134,8 @@ bool FFRouter::Init(Building* building) } } for (auto& pair:allCross) { - if (pair.second->IsOpen()) { + //TODO if (pair.second->IsOpen()) { + if (!pair.second->IsClose()) { _allDoorUIDs.emplace_back(pair.second->GetUniqueID()); _CroTrByUID.insert(std::make_pair(pair.second->GetUniqueID(), pair.second)); Room* room1 = pair.second->GetRoom1(); @@ -494,13 +496,15 @@ int FFRouter::FindExit(Pedestrian* p) if (!_targetWithinSubroom) { //candidates of current room (ID) (provided by Room) for (auto transUID : _building->GetRoom(p->GetRoomID())->GetAllTransitionsIDs()) { - if ((_CroTrByUID.count(transUID) != 0) && (_CroTrByUID[transUID]->IsOpen())) { + // TODO if ((_CroTrByUID.count(transUID) != 0) && (_CroTrByUID[transUID]->IsOpen())) { + if ((_CroTrByUID.count(transUID) != 0) && (!_CroTrByUID[transUID]->IsClose())) { DoorUIDsOfRoom.emplace_back(transUID); } } for (auto &subIPair : _building->GetRoom(p->GetRoomID())->GetAllSubRooms()) { for (auto &crossI : subIPair.second->GetAllCrossings()) { - if (crossI->IsOpen()) { + // TODO if (crossI->IsOpen()) { + if (!crossI->IsClose()) { DoorUIDsOfRoom.emplace_back(crossI->GetUniqueID()); } } @@ -510,13 +514,15 @@ int FFRouter::FindExit(Pedestrian* p) { //candidates of current subroom only for (auto &crossI : _building->GetRoom(p->GetRoomID())->GetSubRoom(p->GetSubRoomID())->GetAllCrossings()) { - if (crossI->IsOpen()) { + //TODO if (crossI->IsOpen()) { + if (!crossI->IsClose()) { DoorUIDsOfRoom.emplace_back(crossI->GetUniqueID()); } } for (auto &transI : _building->GetRoom(p->GetRoomID())->GetSubRoom(p->GetSubRoomID())->GetAllTransitions()) { - if (transI->IsOpen()) { + //TODO if (transI->IsClose()) { + if (!transI->IsClose()) { DoorUIDsOfRoom.emplace_back(transI->GetUniqueID()); } } -- GitLab