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_Fahrzeugklassendefinition.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 <
utils/common/VectorHelper.h
>
36
#include "../NIImporter_Vissim.h"
37
#include "../tempstructs/NIVissimVehTypeClass.h"
38
#include "
NIVissimSingleTypeParser_Fahrzeugklassendefinition.h
"
39
40
#ifdef CHECK_MEMORY_LEAKS
41
#include <
foreign/nvwa/debug_new.h
>
42
#endif // CHECK_MEMORY_LEAKS
43
44
45
// ===========================================================================
46
// method definitions
47
// ===========================================================================
48
NIVissimSingleTypeParser_Fahrzeugklassendefinition::NIVissimSingleTypeParser_Fahrzeugklassendefinition
(
49
NIImporter_Vissim
& parent,
NIImporter_Vissim::ColorMap
& colorMap)
50
:
NIImporter_Vissim
::VissimSingleTypeParser(parent),
51
myColorMap(colorMap) {}
52
53
54
NIVissimSingleTypeParser_Fahrzeugklassendefinition::~NIVissimSingleTypeParser_Fahrzeugklassendefinition
() {}
55
56
57
bool
58
NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse
(std::istream& from) {
59
// id
60
int
id;
61
from >> id;
// type-checking is missing!
62
// name
63
std::string tag;
64
from >> tag;
65
std::string name =
readName
(from);
66
// color
67
from >> tag;
68
std::string colorName =
myRead
(from);
69
RGBColor
color;
70
NIImporter_Vissim::ColorMap::iterator i =
myColorMap
.find(colorName);
71
if
(i !=
myColorMap
.end()) {
72
color = (*i).second;
73
}
else
{
74
int
r, g, b;
75
r =
TplConvert::_2int
(colorName.c_str());
76
from >> g;
// type-checking is missing!
77
from >> b;
// type-checking is missing!
78
color =
RGBColor
(r, g, b, 255);
79
}
80
// types
81
from >> tag;
82
if
(tag ==
"ANM_ID"
) {
83
readName
(from);
84
from >> tag;
85
}
86
std::vector<int> types;
87
from >> tag;
88
do
{
89
types.push_back(
TplConvert::_2int
(tag.c_str()));
90
tag =
readEndSecure
(from);
91
}
while
(tag !=
"DATAEND"
);
92
return
NIVissimVehTypeClass::dictionary
(
id
, name, color, types);
93
}
94
95
96
97
/****************************************************************************/
98
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
netimport
vissim
typeloader
NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp
Generated on Sun Jun 16 2013 07:08:04 for SUMO - Simulation of Urban MObility by
1.8.1.2