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 #include <iostream> 00031 #include <utils/geom/Position2D.h> 00032 #include <utils/geom/Position2DVector.h> 00033 #include <utils/common/TplConvert.h> 00034 #include "../NIImporter_Vissim.h" 00035 #include <utils/distribution/Distribution_Points.h> 00036 #include <utils/distribution/Distribution_MeanDev.h> 00037 #include <netbuild/NBDistribution.h> 00038 #include "NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h" 00039 00040 #ifdef CHECK_MEMORY_LEAKS 00041 #include <foreign/nvwa/debug_new.h> 00042 #endif // CHECK_MEMORY_LEAKS 00043 00044 00045 // =========================================================================== 00046 // method definitions 00047 // =========================================================================== 00048 NIVissimSingleTypeParser_Zeitenverteilungsdefinition::NIVissimSingleTypeParser_Zeitenverteilungsdefinition(NIImporter_Vissim &parent) 00049 : NIImporter_Vissim::VissimSingleTypeParser(parent) {} 00050 00051 00052 NIVissimSingleTypeParser_Zeitenverteilungsdefinition::~NIVissimSingleTypeParser_Zeitenverteilungsdefinition() {} 00053 00054 00055 bool 00056 NIVissimSingleTypeParser_Zeitenverteilungsdefinition::parse(std::istream &from) { 00057 // id 00058 std::string id; 00059 from >> id; 00060 // list of points 00061 Position2DVector points; 00062 std::string tag; 00063 do { 00064 tag = readEndSecure(from); 00065 if (tag=="mittelwert") { 00066 SUMOReal mean, deviation; 00067 from >> mean; 00068 from >> tag; 00069 from >> deviation; 00070 return NBDistribution::dictionary("times", id, 00071 new Distribution_MeanDev(id, mean, deviation)); 00072 } 00073 if (tag!="DATAEND") { 00074 SUMOReal p1 = TplConvert<char>::_2SUMOReal(tag.c_str()); 00075 from >> tag; 00076 SUMOReal p2 = TplConvert<char>::_2SUMOReal(tag.c_str()); 00077 points.push_back(Position2D(p1, p2)); 00078 } 00079 } while (tag!="DATAEND"); 00080 return NBDistribution::dictionary("times", 00081 id, new Distribution_Points(id, points)); 00082 } 00083 00084 00085 00086 /****************************************************************************/ 00087
1.5.6