Commit 21ee0785 authored by tobias schroedter's avatar tobias schroedter

Updated FF Router to work with new door states

parent 32698668
......@@ -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));
......
......@@ -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 {
......
......@@ -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());
}
}
......
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