Eclipse SUMO - Simulation of Urban MObility
NIVissimNodeDef.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2002-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
/****************************************************************************/
16
// -------------------
17
/****************************************************************************/
18
19
20
// ===========================================================================
21
// included modules
22
// ===========================================================================
23
#include <
config.h
>
24
25
26
#include <iostream>
// !!! debug
27
#include <cassert>
28
#include "
NIVissimNodeDef.h
"
29
#include "
NIVissimConnection.h
"
30
#include "
NIVissimDisturbance.h
"
31
#include "
NIVissimTL.h
"
32
33
34
// ===========================================================================
35
// static member variables
36
// ===========================================================================
37
NIVissimNodeDef::DictType
NIVissimNodeDef::myDict
;
38
int
NIVissimNodeDef::myMaxID
= 0;
39
40
41
// ===========================================================================
42
// method definitions
43
// ===========================================================================
44
NIVissimNodeDef::NIVissimNodeDef
(
int
id
,
const
std::string& name)
45
: myID(id), myName(name) {}
46
47
48
NIVissimNodeDef::~NIVissimNodeDef
() {}
49
50
51
bool
52
NIVissimNodeDef::dictionary
(
int
id
,
NIVissimNodeDef
* o) {
53
DictType::iterator i =
myDict
.find(
id
);
54
if
(i ==
myDict
.end()) {
55
myDict
[id] = o;
56
myMaxID
=
myMaxID
>
id
57
?
myMaxID
58
: id;
59
// o->computeBounding();
60
return
true
;
61
}
62
return
false
;
63
}
64
65
66
NIVissimNodeDef
*
67
NIVissimNodeDef::dictionary
(
int
id
) {
68
DictType::iterator i =
myDict
.find(
id
);
69
if
(i ==
myDict
.end()) {
70
return
nullptr
;
71
}
72
return
(*i).second;
73
}
74
75
/*
76
void
77
NIVissimNodeDef::buildNodeClusters()
78
{
79
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
80
int cluster = (*i).second->buildNodeCluster();
81
}
82
}
83
*/
84
85
86
/*
87
88
std::vector<int>
89
NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)
90
{
91
std::vector<int> ret;
92
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
93
NIVissimNodeDef *d = (*i).second;
94
if(d->partialWithin(p, off)) {
95
ret.push_back((*i).first);
96
}
97
}
98
return ret;
99
}
100
101
bool
102
NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const
103
{
104
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
105
return myBoundary->partialWithin(p, off);
106
}
107
108
109
void
110
NIVissimNodeDef::dict_assignConnectionsToNodes() {
111
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
112
(*i).second->searchAndSetConnections();
113
}
114
}
115
*/
116
117
118
int
119
NIVissimNodeDef::dictSize
() {
120
return
(
int
)
myDict
.size();
121
}
122
123
124
125
void
126
NIVissimNodeDef::clearDict
() {
127
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
128
delete
(*i).second;
129
}
130
myDict
.clear();
131
}
132
133
134
int
135
NIVissimNodeDef::getMaxID
() {
136
return
myMaxID
;
137
}
138
139
140
141
/****************************************************************************/
142
NIVissimNodeDef::clearDict
static void clearDict()
Definition:
NIVissimNodeDef.cpp:126
NIVissimConnection.h
NIVissimNodeDef::~NIVissimNodeDef
virtual ~NIVissimNodeDef()
Definition:
NIVissimNodeDef.cpp:48
config.h
NIVissimNodeDef::myMaxID
static int myMaxID
Definition:
NIVissimNodeDef.h:60
NIVissimNodeDef.h
NIVissimTL.h
NIVissimNodeDef::getMaxID
static int getMaxID()
Definition:
NIVissimNodeDef.cpp:135
NIVissimNodeDef
Definition:
NIVissimNodeDef.h:34
NIVissimDisturbance.h
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition:
NIVissimNodeDef.cpp:52
NIVissimNodeDef::DictType
std::map< int, NIVissimNodeDef * > DictType
Definition:
NIVissimNodeDef.h:58
NIVissimNodeDef::myDict
static DictType myDict
Definition:
NIVissimNodeDef.h:59
NIVissimNodeDef::dictSize
static int dictSize()
Definition:
NIVissimNodeDef.cpp:119
NIVissimNodeDef::NIVissimNodeDef
NIVissimNodeDef(int id, const std::string &name)
Definition:
NIVissimNodeDef.cpp:44
src
netimport
vissim
tempstructs
NIVissimNodeDef.cpp
Generated on Wed Oct 2 2019 20:56:52 for Eclipse SUMO - Simulation of Urban MObility by
1.8.13