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