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-2012 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<char>::_2int
(colorName.c_str());
81
from >> g;
// type-checking is missing!
82
from >> b;
// type-checking is missing!
83
color =
RGBColor
(
84
(
SUMOReal
) r / (
SUMOReal
) 255.0,
85
(
SUMOReal
) g / (
SUMOReal
) 255.0,
86
(
SUMOReal
) b / (
SUMOReal
) 255.0);
87
}
88
}
89
tag =
myRead
(from);
90
}
91
SUMOReal
length;
92
from >> length;
93
// overread until "Maxbeschleunigung"
94
while
(tag !=
"maxbeschleunigung"
) {
95
tag =
myRead
(from);
96
}
97
SUMOReal
amax;
98
from >> amax;
// type-checking is missing!
99
// overread until "Maxverzoegerung"
100
while
(tag !=
"maxverzoegerung"
) {
101
tag =
myRead
(from);
102
}
103
SUMOReal
dmax;
104
from >> dmax;
// type-checking is missing!
105
while
(tag !=
"besetzungsgrad"
) {
106
tag =
myRead
(from);
107
}
108
while
(tag !=
"DATAEND"
) {
109
tag =
readEndSecure
(from,
"verlustzeit"
);
110
}
111
return
NIVissimVehicleType::dictionary
(
id
, name,
112
category, length, color, amax, dmax);
113
}
114
115
116
117
/****************************************************************************/
118
tmp
buildd
sumo-0.15.0~dfsg
src
netimport
vissim
typeloader
NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp
Generated on Sun May 27 2012 14:52:08 for SUMO - Simulation of Urban MObility by
1.8.1