Commit ae146701 authored by tobias schroedter's avatar tobias schroedter

Updated FF Router Trips to work with new door states

parent 21ee0785
......@@ -371,8 +371,8 @@ void FloorfieldViaFMTrips::createMapEntryInLineToGoalID(const int goalID, bool i
UID_of_MIN = allgoals.at(goalID)->GetCentreCrossing()->GetUniqueID();
} else {
for (const auto& loctrans : transitions) {
// if (!loctrans.second->IsExit() || !loctrans.second->IsOpen()) {
if (!loctrans.second->IsExit()) {
//TODO if (!loctrans.second->IsExit() || !loctrans.second->IsOpen()) {
if (!loctrans.second->IsExit() || loctrans.second->IsClose()) {
continue;
}
......@@ -494,9 +494,8 @@ void FloorfieldViaFMTrips::parseBuilding(const Building* const buildingArg, cons
//create a list of walls
const std::map<int, Transition*>& allTransitions = buildingArg->GetAllTransitions();
for (auto& trans : allTransitions) {
// TODO temp_close
// if (trans.second->IsExit() && trans.second->IsOpen())
if (trans.second->IsExit() ) {
//TODO if (trans.second->IsExit() && trans.second->IsOpen()){
if (trans.second->IsExit() && !trans.second->IsClose()){
_exitsFromScope.emplace_back(Line ( (Line) *(trans.second)));
}
//populate both maps: costmap, neggradmap. These are the lookup maps for floorfields to specific transitions
......@@ -505,13 +504,13 @@ void FloorfieldViaFMTrips::parseBuilding(const Building* const buildingArg, cons
}
_numOfExits = (unsigned int) _exitsFromScope.size();
// TODO temp_close
// for (auto& trans : allTransitions) {
// if (!trans.second->IsOpen()) {
// _wall.emplace_back(Line ( (Line) *(trans.second)));
// }
//
// }
for (auto& trans : allTransitions) {
//TODO if (!trans.second->IsOpen()) {
if (!trans.second->IsOpen()) {
_wall.emplace_back(Line ( (Line) *(trans.second)));
}
}
for (const auto& itRoom : buildingArg->GetAllRooms()) {
for (const auto& itSubroom : itRoom.second->GetAllSubRooms()) {
......@@ -554,6 +553,7 @@ void FloorfieldViaFMTrips::parseBuilding(const Building* const buildingArg, cons
const vector<Crossing*>& allCrossings = itSubroom.second->GetAllCrossings();
for (Crossing* crossPtr : allCrossings) {
//TODO if (!crossPtr->IsOpen()) {
if (!crossPtr->IsOpen()) {
_wall.emplace_back( Line( (Line) *crossPtr));
......@@ -669,9 +669,8 @@ void FloorfieldViaFMTrips::parseBuildingForExits(const Building* const buildingA
//create a list of walls
const std::map<int, Transition*>& allTransitions = buildingArg->GetAllTransitions();
for (auto& trans : allTransitions) {
// TODO temp_close
// if ( trans.second->IsExit() && trans.second->IsOpen() ) {
if ( trans.second->IsExit() ) {
//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;
if (trans.second->GetRoom1()) {
......@@ -689,13 +688,13 @@ void FloorfieldViaFMTrips::parseBuildingForExits(const Building* const buildingA
_neggradmap.emplace(trans.second->GetUniqueID(), nullptr);
}
_numOfExits = (unsigned int) _exitsFromScope.size();
// TODO temp_close
// for (auto& trans : allTransitions) {
// if (!trans.second->IsOpen()) {
// _wall.emplace_back(Line ( (Line) *(trans.second)));
// }
//
// }
for (auto& trans : allTransitions) {
//TODO if (!trans.second->IsOpen()) {
if (!trans.second->IsOpen()) {
_wall.emplace_back(Line ( (Line) *(trans.second)));
}
}
for (const auto& itRoom : buildingArg->GetAllRooms()) {
if (std::find(exitRoomIDs.begin(), exitRoomIDs.end(), itRoom.second->GetID()) == exitRoomIDs.end()) { //room with no exit
continue;
......@@ -739,6 +738,7 @@ void FloorfieldViaFMTrips::parseBuildingForExits(const Building* const buildingA
}
const vector<Crossing*>& allCrossings = itSubroom.second->GetAllCrossings();
for (Crossing* crossPtr : allCrossings) {
//TODO if (!crossPtr->IsOpen()) {
if (!crossPtr->IsOpen()) {
_wall.emplace_back( Line( (Line) *crossPtr));
......
......@@ -159,7 +159,6 @@ public:
{
return _goalToLineUIDmap;
}
std::map<int, int> getGoalToLineUIDmap2() const
{
return _goalToLineUIDmap2;
......
......@@ -87,7 +87,8 @@ UnivFFviaFMTrips::UnivFFviaFMTrips(Room* roomArg, Configuration* const confArg,
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);
......@@ -100,17 +101,17 @@ UnivFFviaFMTrips::UnivFFviaFMTrips(Room* roomArg, Configuration* const confArg,
}
for (auto& trans : tmpTrans) {
uidNotConst = trans->GetUniqueID();
isOpen = trans->IsOpen();
// TODO temp_close
// if (!isOpen) {
// //will be added twice! is it a problem?
// lines.emplace_back((Line)*trans);
// } else {
//TODO isOpen = trans->IsOpen();
isOpen = !trans->IsClose();
if (!isOpen) {
//will be added twice! is it a problem?
lines.emplace_back((Line)*trans);
} else {
anyDoor = Line{*trans};
if (tmpDoors.count(uidNotConst) == 0) {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *trans));
}
// }
}
}
//find insidePoint and save it, together with UID
......@@ -176,7 +177,8 @@ UnivFFviaFMTrips::UnivFFviaFMTrips(SubRoom* subRoomArg, Configuration* const con
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 {
......@@ -185,13 +187,13 @@ UnivFFviaFMTrips::UnivFFviaFMTrips(SubRoom* subRoomArg, Configuration* const con
}
for (auto& trans : tmpTrans) {
uidNotConst = trans->GetUniqueID();
// TODO temp_close
isOpen = trans->IsOpen();
// if (!isOpen) {
// lines.emplace_back((Line)*trans);
// } else {
//TODO isOpen = trans->IsOpen();
isOpen = !trans->IsClose();
if (!isOpen) {
lines.emplace_back((Line)*trans);
} else {
tmpDoors.emplace(std::make_pair(uidNotConst, (Line) *trans));
// }
}
}
_building->GetAllGoals();
......
......@@ -137,8 +137,8 @@ bool FFRouterTrips::Init(Building* building)
roomAndCroTrVector.clear();
for (auto& pair:allTrans) {
// TODO temp_close
// 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()) {
......@@ -150,11 +150,12 @@ bool FFRouterTrips::Init(Building* building)
Room* room2 = pair.second->GetRoom2();
if (room2)
roomAndCroTrVector.emplace_back(std::make_pair(room2->GetID(), pair.second->GetUniqueID()));
// }
}
}
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();
......@@ -556,14 +557,15 @@ int FFRouterTrips::FindExit1(Pedestrian* p)
if (!_targetWithinSubroom) {
//candidates of current room (ID) (provided by Room)
for (auto transUID : _building->GetRoom(p->GetRoomID())->GetAllTransitionsIDs()) {
// TODO temp_close
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());
}
}
......@@ -573,14 +575,15 @@ int FFRouterTrips::FindExit1(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()) {
// TODO temp_close
if (transI->IsOpen()) {
//TODO if (transI->IsOpen()) {
if (!transI->IsClose()) {
DoorUIDsOfRoom.emplace_back(transI->GetUniqueID());
}
}
......
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