SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp
Go to the documentation of this file.
1
/****************************************************************************/
8
//
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
22
23
// ===========================================================================
24
// included modules
25
// ===========================================================================
26
#ifdef _MSC_VER
27
#include <
windows_config.h
>
28
#else
29
#include <
config.h
>
30
#endif
31
32
#include <iostream>
33
#include <
utils/common/TplConvert.h
>
34
#include <
utils/common/ToString.h
>
35
#include "../NIImporter_Vissim.h"
36
#include "../tempstructs/NIVissimVehicleType.h"
37
#include "
NIVissimSingleTypeParser_Fahrzeugtypdefinition.h
"
38
39
#ifdef CHECK_MEMORY_LEAKS
40
#include <
foreign/nvwa/debug_new.h
>
41
#endif // CHECK_MEMORY_LEAKS
42
43
44
// ===========================================================================
45
// method definitions
46
// ===========================================================================
47
NIVissimSingleTypeParser_Fahrzeugtypdefinition::NIVissimSingleTypeParser_Fahrzeugtypdefinition
(
48
NIImporter_Vissim
& parent,
NIImporter_Vissim::ColorMap
& colorMap)
49
:
NIImporter_Vissim
::VissimSingleTypeParser(parent),
50
myColorMap(colorMap) {}
51
52
53
NIVissimSingleTypeParser_Fahrzeugtypdefinition::~NIVissimSingleTypeParser_Fahrzeugtypdefinition
() {}
54
55
56
bool
57
NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse
(std::istream& from) {
58
// id
59
int
id;
60
from >> id;
// type-checking is missing!
61
// name
62
std::string tag;
63
from >> tag;
64
std::string name =
readName
(from);
65
// category
66
std::string category;
67
from >> tag;
68
from >> category;
69
// color (optional) and length
70
RGBColor
color;
71
tag =
myRead
(from);
72
while
(tag !=
"laenge"
) {
73
if
(tag ==
"farbe"
) {
74
std::string colorName =
myRead
(from);
75
NIImporter_Vissim::ColorMap::iterator i =
myColorMap
.find(colorName);
76
if
(i !=
myColorMap
.end()) {
77
color = (*i).second;
78
}
else
{
79
int
r, g, b;
80
r =
TplConvert::_2int
(colorName.c_str());
81
from >> g;
// type-checking is missing!
82
from >> b;
// type-checking is missing!
83
color =
RGBColor
(r, g, b, 255);
84
}
85
}
86
tag =
myRead
(from);
87
}
88
SUMOReal
length;
89
from >> length;
90
// overread until "Maxbeschleunigung"
91
while
(tag !=
"maxbeschleunigung"
) {
92
tag =
myRead
(from);
93
}
94
SUMOReal
amax;
95
from >> amax;
// type-checking is missing!
96
// overread until "Maxverzoegerung"
97
while
(tag !=
"maxverzoegerung"
) {
98
tag =
myRead
(from);
99
}
100
SUMOReal
dmax;
101
from >> dmax;
// type-checking is missing!
102
while
(tag !=
"besetzungsgrad"
) {
103
tag =
myRead
(from);
104
}
105
while
(tag !=
"DATAEND"
) {
106
tag =
readEndSecure
(from,
"verlustzeit"
);
107
}
108
return
NIVissimVehicleType::dictionary
(
id
, name,
109
category, length, color, amax, dmax);
110
}
111
112
113
114
/****************************************************************************/
115
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
netimport
vissim
typeloader
NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp
Generated on Sun Jun 16 2013 07:08:05 for SUMO - Simulation of Urban MObility by
1.8.1.2