00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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/common/TplConvert.h>
00032 #include <utils/common/MsgHandler.h>
00033 #include "../NIImporter_Vissim.h"
00034 #include "../tempstructs/NIVissimTL.h"
00035 #include "NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h"
00036
00037 #ifdef CHECK_MEMORY_LEAKS
00038 #include <foreign/nvwa/debug_new.h>
00039 #endif // CHECK_MEMORY_LEAKS
00040
00041
00042
00043
00044
00045 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::NIVissimSingleTypeParser_Lichtsignalanlagendefinition(NIImporter_Vissim &parent)
00046 : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
00047
00048
00049 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::~NIVissimSingleTypeParser_Lichtsignalanlagendefinition() {}
00050
00051
00052 bool
00053 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parse(std::istream &from) {
00054
00055 int id;
00056 from >> id;
00057
00058 std::string tag, name;
00059 tag = myRead(from);
00060 if (tag=="name") {
00061 name = readName(from);
00062 tag = myRead(from);
00063 }
00064
00065 std::string type;
00066 type = myRead(from);
00067 if (type=="festzeit") {
00068 return parseFixedTime(id, name, from);
00069 }
00070 if (type=="vas") {
00071 return parseVAS(id, name, from);
00072 }
00073 if (type=="vsplus") {
00074 return parseRestActuated(id, name, from, type);
00075 }
00076 if (type=="trends") {
00077 return parseRestActuated(id, name, from, type);
00078 }
00079 if (type=="vap") {
00080 return parseRestActuated(id, name, from, type);
00081 }
00082 if (type=="tl") {
00083 return parseRestActuated(id, name, from, type);
00084 }
00085 if (type=="pos") {
00086 return parseRestActuated(id, name, from, type);
00087 }
00088 if (type=="nema") {
00089 return parseRestActuated(id, name, from, type);
00090 }
00091 if (type=="extern") {
00092 return parseRestActuated(id, name, from, type);
00093 }
00094 MsgHandler::getErrorInstance()->inform("Unsupported LSA-Type '" + type + "' occured.");
00095 return false;
00096 }
00097
00098
00099 bool
00100 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseFixedTime(
00101 int id, std::string name, std::istream &from) {
00102 std::string type = "festzeit";
00103 std::string tag;
00104 from >> tag;
00105
00106 SUMOReal absdur;
00107 from >> absdur;
00108
00109 tag = readEndSecure(from);
00110 SUMOReal offset = 0;
00111 if (tag=="versatz") {
00112 from >> offset;
00113 }
00114 if (tag!="szpkonfdatei"&&tag!="DATAEND"&&tag!="progdatei") {
00115 tag = readEndSecure(from);
00116 if (tag=="szpkonfdatei"||tag=="progdatei") {
00117 type = "festzeit_fake";
00118 }
00119 }
00120 return NIVissimTL::dictionary(id, type, name, (SUMOTime) absdur, (SUMOTime) offset);
00121 }
00122
00123
00124 bool
00125 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseVAS(
00126 int id, std::string name, std::istream &from) {
00127 std::string tag;
00128 from >> tag;
00129
00130 SUMOReal absdur;
00131 from >> absdur;
00132
00133 tag = readEndSecure(from);
00134 SUMOReal offset = 0;
00135 if (tag=="versatz") {
00136 from >> offset;
00137 }
00138 return NIVissimTL::dictionary(id, "vas", name, (SUMOTime) absdur, (SUMOTime) offset);
00139 }
00140
00141
00142 bool
00143 NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated(
00144 int id, std::string name, std::istream &from, const std::string &type) {
00145 std::string tag;
00146 from >> tag;
00147
00148 SUMOReal absdur;
00149 from >> absdur;
00150
00151 tag = readEndSecure(from);
00152 SUMOReal offset = 0;
00153 if (tag=="versatz") {
00154 from >> offset;
00155 }
00156 while (tag!="datei") {
00157 tag = myRead(from);
00158 }
00159 return NIVissimTL::dictionary(id, type, name, (SUMOTime) absdur, (SUMOTime) offset);
00160 }
00161
00162
00163
00164
00165