int NetworkManager::GetBuildingIDForUE (UserEquipment *ue) { std::vector<Building*>* buildingContainer = GetBuildingContainer (); std::vector<Building*>::iterator iter; Building *building; if (buildingContainer->size()>0) { for (iter = buildingContainer->begin (); iter !=buildingContainer->end (); iter++) { building = *iter; if ( ( abs( building->GetCenterPosition()->GetCoordinateX() - ue->GetMobilityModel()->GetAbsolutePosition()->GetCoordinateX() ) < building->GetSide()[0]/2 ) && ( abs( building->GetCenterPosition()->GetCoordinateY() - ue->GetMobilityModel()->GetAbsolutePosition()->GetCoordinateY() ) < building->GetSide()[1]/2 ) ) { return building->GetIdBuilding(); } } } return -1; }
Building* NetworkManager::GetBuildingByID (int idBuilding) { std::vector<Building*>* buildingContainer = GetBuildingContainer (); std::vector<Building*>::iterator iter; Building *building; for (iter = buildingContainer->begin (); iter !=buildingContainer->end (); iter++) { building = *iter; if (building->GetIdBuilding() == idBuilding) { return building; } } return false; }