00001 /****************************************************************************/ 00007 // ------------------- 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 00020 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 00031 #include <map> 00032 #include "NIVissimEdgePosMap.h" 00033 00034 #ifdef CHECK_MEMORY_LEAKS 00035 #include <foreign/nvwa/debug_new.h> 00036 #endif // CHECK_MEMORY_LEAKS 00037 00038 00039 NIVissimEdgePosMap::NIVissimEdgePosMap() {} 00040 00041 00042 NIVissimEdgePosMap::~NIVissimEdgePosMap() {} 00043 00044 00045 void 00046 NIVissimEdgePosMap::add(int edgeid, SUMOReal pos) { 00047 add(edgeid, pos, pos); 00048 } 00049 00050 00051 void 00052 NIVissimEdgePosMap::add(int edgeid, SUMOReal from, SUMOReal to) { 00053 if (from>to) { 00054 SUMOReal tmp = from; 00055 from = to; 00056 to = tmp; 00057 } 00058 ContType::iterator i=myCont.find(edgeid); 00059 if (i==myCont.end()) { 00060 myCont[edgeid] = Range(from, to); 00061 } else { 00062 SUMOReal pfrom = (*i).second.first; 00063 SUMOReal pto = (*i).second.second; 00064 if (pfrom<from) { 00065 from = pfrom; 00066 } 00067 if (pto>to) { 00068 to = pto; 00069 } 00070 myCont[edgeid] = Range(from, to); 00071 } 00072 } 00073 00074 00075 void 00076 NIVissimEdgePosMap::join(NIVissimEdgePosMap &with) { 00077 for (ContType::iterator i=with.myCont.begin(); i!=with.myCont.end(); i++) { 00078 add((*i).first, (*i).second.first, (*i).second.second); 00079 } 00080 } 00081 00082 00083 00084 /****************************************************************************/ 00085
1.5.6