SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // junction. 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include "MSInternalJunction.h" 00034 #include "MSLane.h" 00035 #include "MSJunctionLogic.h" 00036 #include "MSBitSetLogic.h" 00037 #include <algorithm> 00038 #include <cassert> 00039 #include <cmath> 00040 00041 #ifdef CHECK_MEMORY_LEAKS 00042 #include <foreign/nvwa/debug_new.h> 00043 #endif // CHECK_MEMORY_LEAKS 00044 00045 00046 // =========================================================================== 00047 // method definitions 00048 // =========================================================================== 00049 #ifdef HAVE_INTERNAL_LANES 00050 MSInternalJunction::MSInternalJunction(const std::string& id, 00051 const Position& position, 00052 const PositionVector& shape, 00053 std::vector<MSLane*> incoming, 00054 std::vector<MSLane*> internal) 00055 : MSLogicJunction(id, position, shape, incoming, internal) {} 00056 00057 00058 00059 MSInternalJunction::~MSInternalJunction() {} 00060 00061 00062 void 00063 MSInternalJunction::postloadInit() { 00064 // inform links where they have to report approaching vehicles to 00065 unsigned int requestPos = 0; 00066 for (std::vector<MSLane*>::iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) { 00067 const MSLinkCont& lc = (*i)->getLinkCont(); 00068 for (MSLinkCont::const_iterator q = lc.begin(); q != lc.end(); ++q) { 00069 if ((*q)->getViaLane() != 0) { 00070 myInternalLaneFoes.push_back((*q)->getViaLane()); 00071 } else { 00072 myInternalLaneFoes.push_back(*i); 00073 } 00074 } 00075 00076 } 00077 for (std::vector<MSLane*>::const_iterator i = myIncomingLanes.begin() + 1; i != myIncomingLanes.end(); ++i) { 00078 MSLane* l = *i; 00079 const MSLinkCont& lc = l->getLinkCont(); 00080 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) { 00081 MSLane* via = (*j)->getViaLane(); 00082 if (std::find(myInternalLanes.begin(), myInternalLanes.end(), via) == myInternalLanes.end()) { 00083 continue; 00084 } 00085 myInternalLinkFoes.push_back(*j); 00086 } 00087 } 00088 if (myIncomingLanes.size() != 0) { 00089 // for the first incoming lane 00090 const MSLinkCont& links = myIncomingLanes[0]->getLinkCont(); 00091 // ... set information for every link 00092 for (MSLinkCont::const_iterator j = links.begin(); j != links.end(); j++) { 00093 (*j)->setRequestInformation(requestPos, requestPos, true, false, myInternalLinkFoes, myInternalLaneFoes); 00094 requestPos++; 00095 for (std::vector<MSLink*>::const_iterator k = myInternalLinkFoes.begin(); k != myInternalLinkFoes.end(); ++k) { 00096 (*j)->addBlockedLink(*k); 00097 (*k)->addBlockedLink(*j); 00098 } 00099 } 00100 } 00101 } 00102 00103 00104 #endif 00105 00106 00107 /****************************************************************************/ 00108