NIVissimSingleTypeParser_Parkplatzdefinition.cpp

Go to the documentation of this file.
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 <vector>
00032 #include <utility>
00033 #include <utils/common/TplConvert.h>
00034 #include <utils/common/ToString.h>
00035 #include <utils/common/VectorHelper.h>
00036 #include <netbuild/NBDistrictCont.h>
00037 #include <netbuild/NBDistrict.h>
00038 #include <netbuild/NBNode.h>
00039 #include <netbuild/NBNodeCont.h>
00040 #include "../NIImporter_Vissim.h"
00041 #include "../tempstructs/NIVissimDistrictConnection.h"
00042 #include "NIVissimSingleTypeParser_Parkplatzdefinition.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_Parkplatzdefinition::NIVissimSingleTypeParser_Parkplatzdefinition(NIImporter_Vissim &parent)
00053         : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
00054 
00055 
00056 NIVissimSingleTypeParser_Parkplatzdefinition::~NIVissimSingleTypeParser_Parkplatzdefinition() {}
00057 
00058 
00059 bool
00060 NIVissimSingleTypeParser_Parkplatzdefinition::parse(std::istream &from) {
00061     int id;
00062     from >> id;
00063 
00064     std::string tag;
00065     from >> tag;
00066     std::string name = readName(from);
00067 
00068     // parse the districts
00069     //  and allocate them if not done before
00070     //  A district may be already saved when another parking place with
00071     //  the same district was already build.
00072     IntVector districts;
00073     DoubleVector percentages;
00074     readUntil(from, "bezirke"); // "Bezirke"
00075     while (tag!="ort") {
00076         SUMOReal perc = -1;
00077         int districtid;
00078         from >> districtid;
00079         tag = myRead(from);
00080         if (tag=="anteil") {
00081             from >> perc;
00082         }
00083         districts.push_back(districtid);
00084         percentages.push_back(perc);
00085         tag = myRead(from);
00086     }
00087 
00088     from >> tag; // "Strecke"
00089     int edgeid;
00090     from >> edgeid;
00091 
00092     SUMOReal position;
00093     from >> tag; // "bei"
00094     from >> position;
00095 
00096     SUMOReal length;
00097     from >> tag;
00098     from >> length;
00099 
00100     from >> tag; // "Kapazität"
00101     from >> tag; // "Kapazität"-value
00102 
00103     tag = myRead(from);
00104     if (tag=="belegung") {
00105         from >> tag;
00106         tag = myRead(from); // "fahrzeugklasse"
00107     }
00108 
00109     std::vector<std::pair<int, int> > assignedVehicles;
00110     while (tag!="default") {
00111         int vclass;
00112         from >> vclass;
00113         from >> tag; // "vwunsch"
00114         int vwunsch;
00115         from >> vwunsch; // "vwunsch"-value
00116         assignedVehicles.push_back(std::pair<int, int>(vclass, vwunsch));
00117         tag = myRead(from);
00118     }
00119 
00120     from >> tag;
00121     from >> tag;
00122 //    NIVissimEdge *e = NIVissimEdge::dictionary(edgeid);
00123 //    e->addReferencedDistrict(id);
00124 
00125     // build the district connection
00126     return NIVissimDistrictConnection::dictionary(id, name,
00127             districts, percentages, edgeid, position, assignedVehicles);
00128 }
00129 
00130 
00131 
00132 /****************************************************************************/
00133 

Generated on Wed May 5 00:06:34 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6