SUMO - Simulation of Urban MObility
|
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/common/TplConvert.h> 00034 #include <utils/geom/Position.h> 00035 #include <utils/geom/PositionVector.h> 00036 #include "../NIImporter_Vissim.h" 00037 #include "../tempstructs/NIVissimNodeParticipatingEdge.h" 00038 #include "../tempstructs/NIVissimNodeParticipatingEdgeVector.h" 00039 #include "../tempstructs/NIVissimNodeDef_Edges.h" 00040 #include "../tempstructs/NIVissimNodeDef_Poly.h" 00041 #include "../tempstructs/NIVissimNodeDef.h" 00042 #include "NIVissimSingleTypeParser_Knotendefinition.h" 00043 00044 #ifdef CHECK_MEMORY_LEAKS 00045 #include <foreign/nvwa/debug_new.h> 00046 #endif // CHECK_MEMORY_LEAKS 00047 00048 00049 // =========================================================================== 00050 // method definitions 00051 // =========================================================================== 00052 NIVissimSingleTypeParser_Knotendefinition::NIVissimSingleTypeParser_Knotendefinition(NIImporter_Vissim& parent) 00053 : NIImporter_Vissim::VissimSingleTypeParser(parent) {} 00054 00055 00056 NIVissimSingleTypeParser_Knotendefinition::~NIVissimSingleTypeParser_Knotendefinition() {} 00057 00058 00059 bool 00060 NIVissimSingleTypeParser_Knotendefinition::parse(std::istream& from) { 00061 // 00062 int id; 00063 from >> id; 00064 // 00065 std::string tag; 00066 from >> tag; 00067 std::string name = readName(from); 00068 // 00069 tag = overrideOptionalLabel(from); 00070 // 00071 while (tag != "netzausschnitt") { 00072 tag = myRead(from); 00073 } 00074 // 00075 tag = myRead(from); 00076 if (tag == "strecke") { 00077 NIVissimNodeParticipatingEdgeVector edges; 00078 while (tag == "strecke") { 00079 int edgeid; 00080 SUMOReal from_pos, to_pos; 00081 from_pos = to_pos = -1.0; 00082 from >> edgeid; 00083 tag = readEndSecure(from, "strecke"); 00084 if (tag == "von") { 00085 from >> from_pos; // type-checking is missing! 00086 from >> tag; 00087 from >> to_pos; // type-checking is missing! 00088 tag = readEndSecure(from, "strecke"); 00089 } 00090 edges.push_back(new NIVissimNodeParticipatingEdge(edgeid, from_pos, to_pos)); 00091 } 00092 NIVissimNodeDef_Edges::dictionary(id, name, edges); 00093 } else { 00094 int no = TplConvert<char>::_2int(tag.c_str()); 00095 PositionVector poly; 00096 for (int i = 0; i < no; i++) { 00097 poly.push_back(getPosition(from)); 00098 } 00099 poly.closePolygon(); 00100 NIVissimNodeDef_Poly::dictionary(id, name, poly); 00101 } 00102 return true; 00103 } 00104 00105 00106 00107 /****************************************************************************/ 00108