SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // ------------------- 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <utils/common/VectorHelper.h> 00033 #include <netbuild/NBEdge.h> 00034 #include "NIVissimExtendedEdgePoint.h" 00035 #include "NIVissimEdge.h" 00036 00037 #ifdef CHECK_MEMORY_LEAKS 00038 #include <foreign/nvwa/debug_new.h> 00039 #endif // CHECK_MEMORY_LEAKS 00040 00041 00042 // =========================================================================== 00043 // method definitions 00044 // =========================================================================== 00045 NIVissimExtendedEdgePoint::NIVissimExtendedEdgePoint( 00046 int edgeid, const std::vector<int>& lanes, SUMOReal position, 00047 const std::vector<int>& assignedVehicles) 00048 : myEdgeID(edgeid), myLanes(lanes), myPosition(position), 00049 myAssignedVehicles(assignedVehicles) {} 00050 00051 00052 NIVissimExtendedEdgePoint::~NIVissimExtendedEdgePoint() {} 00053 00054 00055 int 00056 NIVissimExtendedEdgePoint::getEdgeID() const { 00057 return myEdgeID; 00058 } 00059 00060 00061 SUMOReal 00062 NIVissimExtendedEdgePoint::getPosition() const { 00063 return myPosition; 00064 } 00065 00066 00067 Position 00068 NIVissimExtendedEdgePoint::getGeomPosition() const { 00069 return 00070 NIVissimAbstractEdge::dictionary(myEdgeID)->getGeomPosition(myPosition); 00071 } 00072 00073 00074 const std::vector<int>& 00075 NIVissimExtendedEdgePoint::getLanes() const { 00076 return myLanes; 00077 } 00078 00079 00080 void 00081 NIVissimExtendedEdgePoint::recheckLanes(const NBEdge* const edge) { 00082 // check whether an "all" indicator is there 00083 bool hadAll = false; 00084 for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) { 00085 if ((*i) == -1) { 00086 hadAll = true; 00087 } 00088 } 00089 // no -> return 00090 if (!hadAll) { 00091 return; 00092 } 00093 // patch lane indices 00094 myLanes.clear(); 00095 for (int i = 0; i < (int) edge->getNumLanes(); ++i) { 00096 myLanes.push_back(i); 00097 } 00098 } 00099 00100 00101 /****************************************************************************/ 00102