#include <NIVissimSingleTypeParser_Verbindungsdefinition.h>

Definition at line 44 of file NIVissimSingleTypeParser_Verbindungsdefinition.h.
Public Member Functions | |
| NIVissimSingleTypeParser_Verbindungsdefinition (NIImporter_Vissim &parent) | |
| Constructor. | |
| bool | parse (std::istream &from) |
| Parses the data type from the given stream. | |
| ~NIVissimSingleTypeParser_Verbindungsdefinition () | |
| Destructor. | |
Protected Member Functions | |
| Position2D | getPosition2D (std::istream &from) |
| returns the 2d-position saved as next within the stream | |
| std::string | myRead (std::istream &from) |
| reads from the stream and returns the lower case version of the read value | |
| std::string | overrideOptionalLabel (std::istream &from, const std::string &tag="") |
| overrides the optional label definition; returns the next tag as done by readEndSecure | |
| IntVector | parseAssignedVehicleTypes (std::istream &from, const std::string &next) |
| parses a listof vehicle types assigned to the current data field One should remeber, that -1 means "all" vehicle types | |
| std::string | readEndSecure (std::istream &from, const std::vector< std::string > &excl) |
| std::string | readEndSecure (std::istream &from, const std::string &excl="") |
| as myRead, but returns "DATAEND" when the current field has ended | |
| NIVissimExtendedEdgePoint | readExtEdgePointDef (std::istream &from) |
| std::string | readName (std::istream &from) |
| Reads the structures name We cannot use the "<<" operator, as names may contain more than one word which are joined using '"'. | |
| void | readUntil (std::istream &from, const std::string &name) |
| Reads from the stream until the keywor occurs. | |
| bool | skipOverreading (std::istream &from, const std::string &name="") |
| Overreads the named parameter (if) given and skips the rest until "DATAEND". | |
| NIVissimSingleTypeParser_Verbindungsdefinition::NIVissimSingleTypeParser_Verbindungsdefinition | ( | NIImporter_Vissim & | parent | ) |
Constructor.
Definition at line 45 of file NIVissimSingleTypeParser_Verbindungsdefinition.cpp.
00046 : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
| NIVissimSingleTypeParser_Verbindungsdefinition::~NIVissimSingleTypeParser_Verbindungsdefinition | ( | ) |
| Position2D NIImporter_Vissim::VissimSingleTypeParser::getPosition2D | ( | std::istream & | from | ) | [protected, inherited] |
returns the 2d-position saved as next within the stream
Definition at line 222 of file NIImporter_Vissim.cpp.
References SUMOReal.
Referenced by NIVissimSingleTypeParser_Streckendefinition::parse(), and NIVissimSingleTypeParser_Knotendefinition::parse().
00222 { 00223 SUMOReal x, y; 00224 from >> x; // type-checking is missing! 00225 from >> y; // type-checking is missing! 00226 return Position2D(x, y); 00227 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::myRead | ( | std::istream & | from | ) | [protected, inherited] |
reads from the stream and returns the lower case version of the read value
Definition at line 144 of file NIImporter_Vissim.cpp.
References StringUtils::to_lower_case().
Referenced by NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel(), NIVissimSingleTypeParser_Zusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verlustzeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), NIVissimSingleTypeParser_Routenentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Reisezeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parse(), NIVissimSingleTypeParser_Querschnittsmessungsdefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parse(), NIVissimSingleTypeParser_Langsamfahrbereichdefinition::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Haltestellendefinition::parse(), NIVissimSingleTypeParser_Fensterdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), NIVissimSingleTypeParser_Detektordefinition::parse(), NIVissimSingleTypeParser_Auswertungsdefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parseFixedTime(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated(), NIVissimSingleTypeParser_Signalgruppendefinition::parseVAS(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), NIImporter_Vissim::VissimSingleTypeParser::readUntil(), and NIImporter_Vissim::VissimSingleTypeParser::skipOverreading().
00144 { 00145 std::string tmp; 00146 from >> tmp; 00147 return StringUtils::to_lower_case(tmp); 00148 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel | ( | std::istream & | from, | |
| const std::string & | tag = "" | |||
| ) | [protected, inherited] |
overrides the optional label definition; returns the next tag as done by readEndSecure
Definition at line 201 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead().
Referenced by NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), and NIVissimSingleTypeParser_Knotendefinition::parse().
00202 { 00203 std::string tmp; 00204 if (tag=="") { 00205 tmp = myRead(from); 00206 } else { 00207 tmp = tag; 00208 } 00209 if (tmp=="beschriftung") { 00210 tmp = myRead(from); 00211 if (tmp=="keine") { 00212 from >> tmp; 00213 } 00214 tmp = myRead(from); 00215 tmp = myRead(from); 00216 } 00217 return tmp; 00218 }
| bool NIVissimSingleTypeParser_Verbindungsdefinition::parse | ( | std::istream & | from | ) | [virtual] |
Parses the data type from the given stream.
Implements NIImporter_Vissim::VissimSingleTypeParser.
Definition at line 53 of file NIVissimSingleTypeParser_Verbindungsdefinition.cpp.
References TplConvert< E >::_2int(), TplConvert< E >::_2SUMOReal(), NIVissimConnection::dictionary(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIVissimConnection::NIVC_DIR_ALL, NIVissimConnection::NIVC_DIR_LEFT, NIVissimConnection::NIVC_DIR_RIGHT, NIImporter_Vissim::VissimSingleTypeParser::overrideOptionalLabel(), Position2DVector::push_back_noDoublePos(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef(), NIImporter_Vissim::VissimSingleTypeParser::readName(), and SUMOReal.
00053 { 00054 int id; 00055 from >> id; // type-checking is missing! 00056 std::string tag; 00057 // Read optional value "Name", skip optional value "Beschriftung" 00058 std::string name; 00059 while (tag!="von") { 00060 tag = overrideOptionalLabel(from); 00061 if (tag=="name") { 00062 name = readName(from); 00063 } 00064 } 00065 // Read the geometry information 00066 NIVissimExtendedEdgePoint from_def = readExtEdgePointDef(from); 00067 Position2DVector geom; 00068 tag = myRead(from); // "ueber" 00069 while (tag!="nach") { 00070 std::string x = myRead(from); 00071 std::string y = myRead(from); 00072 if (y!="nach") { 00073 geom.push_back_noDoublePos( 00074 Position2D( 00075 TplConvert<char>::_2SUMOReal(x.c_str()), 00076 TplConvert<char>::_2SUMOReal(y.c_str()) 00077 )); 00078 tag = myRead(from); 00079 try { 00080 TplConvert<char>::_2SUMOReal(tag.c_str()); 00081 tag = myRead(from); 00082 } catch (NumberFormatException &) {} 00083 } else { 00084 tag = y; 00085 } 00086 } 00087 NIVissimExtendedEdgePoint to_def = readExtEdgePointDef(from); 00088 // read some optional values until mandatory "Fahrzeugklassen" occurs 00089 SUMOReal dxnothalt = 0; 00090 SUMOReal dxeinordnen = 0; 00091 SUMOReal zuschlag1, zuschlag2; 00092 zuschlag1 = zuschlag2 = 0; 00093 SUMOReal seglength = 0; 00094 tag = myRead(from); 00095 NIVissimConnection::Direction direction = NIVissimConnection::NIVC_DIR_ALL; 00096 while (tag!="fahrzeugklassen"&&tag!="sperrung"&&tag!="auswertung"&&tag!="DATAEND") { 00097 if (tag=="rechts") { 00098 direction = NIVissimConnection::NIVC_DIR_RIGHT; 00099 } else if (tag=="links") { 00100 direction = NIVissimConnection::NIVC_DIR_LEFT; 00101 } else if (tag=="alle") { 00102 direction = NIVissimConnection::NIVC_DIR_ALL; 00103 } else if (tag=="dxnothalt") { 00104 from >> dxnothalt; // type-checking is missing! 00105 } else if (tag=="dxeinordnen") { 00106 from >> dxeinordnen; // type-checking is missing! 00107 } else if (tag=="segment") { 00108 from >> tag; 00109 from >> seglength; 00110 } 00111 if (tag=="zuschlag") { 00112 from >> zuschlag1; // type-checking is missing! 00113 tag = readEndSecure(from); 00114 if (tag=="zuschlag") { 00115 from >> zuschlag2; // type-checking is missing! 00116 tag = readEndSecure(from, "auswertung"); 00117 } 00118 } else { 00119 tag = readEndSecure(from, "auswertung"); 00120 } 00121 } 00122 // read in allowed vehicle classes 00123 IntVector assignedVehicles; 00124 if (tag=="fahrzeugklassen") { 00125 tag = readEndSecure(from); 00126 while (tag!="DATAEND"&&tag!="sperrung"&&tag!="auswertung") { 00127 int classes = TplConvert<char>::_2int(tag.c_str()); 00128 assignedVehicles.push_back(classes); 00129 tag = readEndSecure(from, "auswertung"); 00130 } 00131 } 00132 // Read definitions of closed lanes 00133 NIVissimClosedLanesVector clv; 00134 if (tag!="DATAEND") { 00135 do { 00136 // check whether a next close lane definition can be found 00137 tag = readEndSecure(from); 00138 if (tag=="spur") { 00139 // get the lane number 00140 // from >> tag; 00141 int laneNo; 00142 from >> laneNo; // type-checking is missing! 00143 // get the list of assigned car classes 00144 IntVector assignedVehicles; 00145 tag = myRead(from); 00146 if (tag=="fahrzeugklassen") { 00147 tag = myRead(from); 00148 } 00149 while (tag!="DATAEND"&&tag!="spur") { 00150 int classes = TplConvert<char>::_2int(tag.c_str()); 00151 assignedVehicles.push_back(classes); 00152 tag = readEndSecure(from); 00153 } 00154 // build and add the definition 00155 NIVissimClosedLaneDef *cld = new NIVissimClosedLaneDef(laneNo, assignedVehicles); 00156 clv.push_back(cld); 00157 } 00158 } while (tag!="DATAEND"); 00159 } 00160 NIVissimConnection *c = new NIVissimConnection(id, name, from_def, to_def, geom, 00161 direction, dxnothalt, dxeinordnen, zuschlag1, zuschlag2, seglength, 00162 assignedVehicles, clv); 00163 00164 if (!NIVissimConnection::dictionary(id, c)) { 00165 return false; 00166 } 00167 return true; 00168 //return NIVissimAbstractEdge::dictionary(id, c); 00169 }
| IntVector NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes | ( | std::istream & | from, | |
| const std::string & | next | |||
| ) | [protected, inherited] |
parses a listof vehicle types assigned to the current data field One should remeber, that -1 means "all" vehicle types
Definition at line 231 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::readEndSecure().
Referenced by NIVissimSingleTypeParser_Signalgeberdefinition::parse().
00232 { 00233 std::string tmp = readEndSecure(from); 00234 IntVector ret; 00235 if (tmp=="alle") { 00236 ret.push_back(-1); 00237 return ret; 00238 } 00239 while (tmp!="DATAEND"&&tmp!=next) { 00240 ret.push_back(TplConvert<char>::_2int(tmp.c_str())); 00241 tmp = readEndSecure(from); 00242 } 00243 return ret; 00244 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readEndSecure | ( | std::istream & | from, | |
| const std::vector< std::string > & | excl | |||
| ) | [protected, inherited] |
Definition at line 171 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::admitContinue(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIImporter_Vissim::VissimSingleTypeParser::myVissimParent, and StringUtils::to_lower_case().
00172 { 00173 std::vector<std::string> myExcl; 00174 std::vector<std::string>::const_iterator i; 00175 for (i=excl.begin(); i!=excl.end(); i++) { 00176 std::string mes = StringUtils::to_lower_case(*i); 00177 myExcl.push_back(mes); 00178 } 00179 std::string tmp = myRead(from); 00180 if (tmp=="") { 00181 return "DATAEND"; 00182 } 00183 00184 bool equals = false; 00185 for (i=myExcl.begin(); i!=myExcl.end()&&!equals; i++) { 00186 if ((*i)==tmp) { 00187 equals = true; 00188 } 00189 } 00190 if (!equals 00191 && 00192 (tmp.substr(0, 2)=="--"||!myVissimParent.admitContinue(tmp)) 00193 ) { 00194 return "DATAEND"; 00195 } 00196 return StringUtils::to_lower_case(tmp); 00197 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readEndSecure | ( | std::istream & | from, | |
| const std::string & | excl = "" | |||
| ) | [protected, inherited] |
as myRead, but returns "DATAEND" when the current field has ended
Definition at line 153 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::admitContinue(), NIImporter_Vissim::VissimSingleTypeParser::myRead(), NIImporter_Vissim::VissimSingleTypeParser::myVissimParent, and StringUtils::to_lower_case().
Referenced by NIVissimSingleTypeParser_Zusammensetzungsdefinition::parse(), NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_Zeitenverteilungsdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verlustzeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Stopschilddefinition::parse(), NIVissimSingleTypeParser_Routenentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Reisezeitmessungsdefinition::parse(), NIVissimSingleTypeParser_Querschnittsmessungsdefinition::parse(), NIVissimSingleTypeParser_Laengenverteilungsdefinition::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Kantensperrung::parse(), NIVissimSingleTypeParser_Haltestellendefinition::parse(), NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), NIVissimSingleTypeParser_DynUml::parse(), NIVissimSingleTypeParser_Detektordefinition::parse(), NIVissimSingleTypeParser_Auswertungsdefinition::parse(), NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseFixedTime(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePos(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseRestActuated(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parseVAS(), NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef(), and NIImporter_Vissim::VissimSingleTypeParser::skipOverreading().
00154 { 00155 std::string myExcl = StringUtils::to_lower_case(excl); 00156 std::string tmp = myRead(from); 00157 if (tmp=="") { 00158 return "DATAEND"; 00159 } 00160 if (tmp!=myExcl 00161 && 00162 (tmp.substr(0, 2)=="--"||!myVissimParent.admitContinue(tmp)) 00163 ) { 00164 return "DATAEND"; 00165 } 00166 return StringUtils::to_lower_case(tmp); 00167 }
| NIVissimExtendedEdgePoint NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef | ( | std::istream & | from | ) | [protected, inherited] |
Definition at line 248 of file NIImporter_Vissim.cpp.
References TplConvert< E >::_2int(), NIImporter_Vissim::VissimSingleTypeParser::readEndSecure(), and SUMOReal.
Referenced by parse().
00249 { 00250 std::string tag; 00251 from >> tag; // "Strecke" 00252 int edgeid; 00253 from >> edgeid; // type-checking is missing! 00254 from >> tag; // "Spuren" 00255 IntVector lanes; 00256 while (tag!="bei") { 00257 tag = readEndSecure(from); 00258 if (tag!="bei") { 00259 int lane = TplConvert<char>::_2int(tag.c_str()); 00260 lanes.push_back(lane-1); 00261 } 00262 } 00263 SUMOReal position; 00264 from >> position; 00265 IntVector dummy; 00266 return NIVissimExtendedEdgePoint(edgeid, lanes, position, dummy); 00267 }
| std::string NIImporter_Vissim::VissimSingleTypeParser::readName | ( | std::istream & | from | ) | [protected, inherited] |
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word which are joined using '"'.
Definition at line 271 of file NIImporter_Vissim.cpp.
References StringUtils::convertUmlaute().
Referenced by NIVissimSingleTypeParser_Zuflussdefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition::parse(), parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Signalgruppendefinition::parse(), NIVissimSingleTypeParser_Signalgeberdefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), NIVissimSingleTypeParser_Lichtsignalanlagendefinition::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Kennungszeile::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), and NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered().
00271 { 00272 std::string name; 00273 from >> name; 00274 if (name[0]=='"') { 00275 while (name[name.length()-1]!='"') { 00276 std::string tmp; 00277 from >> tmp; 00278 name = name + " " + tmp; 00279 } 00280 name = name.substr(1, name.length()-2); 00281 } 00282 return StringUtils::convertUmlaute(name); 00283 }
| void NIImporter_Vissim::VissimSingleTypeParser::readUntil | ( | std::istream & | from, | |
| const std::string & | name | |||
| ) | [protected, inherited] |
Reads from the stream until the keywor occurs.
Definition at line 287 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead().
Referenced by NIVissimSingleTypeParser_Streckentypdefinition::parse(), NIVissimSingleTypeParser_Stopschilddefinition::parse(), NIVissimSingleTypeParser_Parkplatzdefinition::parse(), NIVissimSingleTypeParser_Langsamfahrbereichdefinition::parse(), NIVissimSingleTypeParser_Fensterdefinition::parse(), NIVissimSingleTypeParser_Fahrverhaltendefinition::parse(), and NIVissimSingleTypeParser_DynUml::parse().
00288 { 00289 std::string tag; 00290 while (tag!=name) { 00291 tag = myRead(from); 00292 } 00293 }
| bool NIImporter_Vissim::VissimSingleTypeParser::skipOverreading | ( | std::istream & | from, | |
| const std::string & | name = "" | |||
| ) | [protected, inherited] |
Overreads the named parameter (if) given and skips the rest until "DATAEND".
Definition at line 296 of file NIImporter_Vissim.cpp.
References NIImporter_Vissim::VissimSingleTypeParser::myRead(), and NIImporter_Vissim::VissimSingleTypeParser::readEndSecure().
Referenced by NIVissimSingleTypeParser_Stauzaehlerdefinition::parse(), NIVissimSingleTypeParser_Richtungsentscheidungsdefinition::parse(), and NIVissimSingleTypeParser_Messungsdefinition::parse().
00297 { 00298 std::string tag; 00299 while (tag!=name) { 00300 tag = myRead(from); 00301 } 00302 while (tag!="DATAEND") { 00303 tag = readEndSecure(from); 00304 } 00305 return true; 00306 }
1.5.6