Eclipse SUMO - Simulation of Urban MObility
NIVissimEdgePosMap.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
15
// -------------------
16
/****************************************************************************/
17
18
19
// ===========================================================================
20
// included modules
21
// ===========================================================================
22
#include <
config.h
>
23
24
25
#include <map>
26
#include "
NIVissimEdgePosMap.h
"
27
28
29
NIVissimEdgePosMap::NIVissimEdgePosMap
() {}
30
31
32
NIVissimEdgePosMap::~NIVissimEdgePosMap
() {}
33
34
35
void
36
NIVissimEdgePosMap::add
(
int
edgeid,
double
pos) {
37
add
(edgeid, pos, pos);
38
}
39
40
41
void
42
NIVissimEdgePosMap::add
(
int
edgeid,
double
from,
double
to) {
43
if
(from > to) {
44
double
tmp = from;
45
from = to;
46
to = tmp;
47
}
48
ContType::iterator i =
myCont
.find(edgeid);
49
if
(i ==
myCont
.end()) {
50
myCont
[edgeid] =
Range
(from, to);
51
}
else
{
52
double
pfrom = (*i).second.first;
53
double
pto = (*i).second.second;
54
if
(pfrom < from) {
55
from = pfrom;
56
}
57
if
(pto > to) {
58
to = pto;
59
}
60
myCont
[edgeid] =
Range
(from, to);
61
}
62
}
63
64
65
void
66
NIVissimEdgePosMap::join
(
NIVissimEdgePosMap
& with) {
67
for
(ContType::iterator i = with.
myCont
.begin(); i != with.
myCont
.end(); i++) {
68
add
((*i).first, (*i).second.first, (*i).second.second);
69
}
70
}
71
72
73
74
/****************************************************************************/
75
NIVissimEdgePosMap::Range
std::pair< double, double > Range
Definition:
NIVissimEdgePosMap.h:43
NIVissimEdgePosMap::myCont
ContType myCont
Definition:
NIVissimEdgePosMap.h:45
NIVissimEdgePosMap::join
void join(NIVissimEdgePosMap &with)
Definition:
NIVissimEdgePosMap.cpp:66
NIVissimEdgePosMap::~NIVissimEdgePosMap
~NIVissimEdgePosMap()
Definition:
NIVissimEdgePosMap.cpp:32
NIVissimEdgePosMap::add
void add(int edgeid, double pos)
Definition:
NIVissimEdgePosMap.cpp:36
NIVissimEdgePosMap::NIVissimEdgePosMap
NIVissimEdgePosMap()
Definition:
NIVissimEdgePosMap.cpp:29
config.h
NIVissimEdgePosMap
Definition:
NIVissimEdgePosMap.h:35
NIVissimEdgePosMap.h
src
netimport
vissim
tempstructs
NIVissimEdgePosMap.cpp
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16