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
PCTypeMap.cpp
Go to the documentation of this file.
1
/****************************************************************************/
7
// A storage for type mappings
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11
/****************************************************************************/
12
//
13
// This file is part of SUMO.
14
// SUMO is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
/****************************************************************************/
20
21
22
// ===========================================================================
23
// included modules
24
// ===========================================================================
25
#ifdef _MSC_VER
26
#include <
windows_config.h
>
27
#else
28
#include <
config.h
>
29
#endif
30
31
#include <string>
32
#include <map>
33
#include "
utils/options/OptionsCont.h
"
34
#include "
PCTypeMap.h
"
35
36
#ifdef CHECK_MEMORY_LEAKS
37
#include <
foreign/nvwa/debug_new.h
>
38
#endif // CHECK_MEMORY_LEAKS
39
40
41
// ===========================================================================
42
// method definitions
43
// ===========================================================================
44
PCTypeMap::PCTypeMap
(
const
OptionsCont
& oc) {
45
myDefaultType
.
id
= oc.
getString
(
"type"
);
46
myDefaultType
.
color
=
RGBColor::parseColor
(oc.
getString
(
"color"
));
47
myDefaultType
.
layer
= oc.
getInt
(
"layer"
);
48
myDefaultType
.
discard
= oc.
getBool
(
"discard"
);
49
myDefaultType
.
allowFill
=
true
;
50
myDefaultType
.
prefix
= oc.
getString
(
"prefix"
);
51
}
52
53
54
PCTypeMap::~PCTypeMap
() {}
55
56
57
bool
58
PCTypeMap::add
(
const
std::string&
id
,
const
std::string& newid,
59
const
std::string& color,
const
std::string& prefix,
60
int
layer,
bool
discard,
bool
allowFill) {
61
if
(
has
(
id
)) {
62
return
false
;
63
}
64
TypeDef
td;
65
td.
id
= newid;
66
td.
color
=
RGBColor::parseColor
(color);
67
td.
layer
= layer;
68
td.
discard
= discard;
69
td.
allowFill
= allowFill;
70
td.
prefix
= prefix;
71
myTypes
[id] = td;
72
return
true
;
73
}
74
75
76
const
PCTypeMap::TypeDef
&
77
PCTypeMap::get
(
const
std::string&
id
) {
78
return
myTypes
.find(
id
)->second;
79
}
80
81
82
bool
83
PCTypeMap::has
(
const
std::string&
id
) {
84
return
myTypes
.find(
id
) !=
myTypes
.end();
85
}
86
87
88
89
/****************************************************************************/
90
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
polyconvert
PCTypeMap.cpp
Generated on Sun Jun 16 2013 07:08:17 for SUMO - Simulation of Urban MObility by
1.8.1.2