Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIVissimNodeDef.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-2024 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
19
// -------------------
20
/****************************************************************************/
21
#include <config.h>
22
23
24
#include <iostream>
// !!! debug
25
#include <cassert>
26
#include "
NIVissimNodeDef.h
"
27
#include "
NIVissimConnection.h
"
28
#include "
NIVissimDisturbance.h
"
29
#include "
NIVissimTL.h
"
30
31
32
// ===========================================================================
33
// static member variables
34
// ===========================================================================
35
NIVissimNodeDef::DictType
NIVissimNodeDef::myDict
;
36
int
NIVissimNodeDef::myMaxID
= 0;
37
38
39
// ===========================================================================
40
// method definitions
41
// ===========================================================================
42
NIVissimNodeDef::NIVissimNodeDef
(
int
id
,
const
std::string& name)
43
: myID(id), myName(name) {}
44
45
46
NIVissimNodeDef::~NIVissimNodeDef
() {}
47
48
49
bool
50
NIVissimNodeDef::dictionary
(
int
id
,
NIVissimNodeDef
* o) {
51
DictType::iterator i =
myDict
.find(
id
);
52
if
(i ==
myDict
.end()) {
53
myDict
[id] = o;
54
myMaxID
=
myMaxID
>
id
55
?
myMaxID
56
: id;
57
// o->computeBounding();
58
return
true
;
59
}
60
return
false
;
61
}
62
63
64
NIVissimNodeDef
*
65
NIVissimNodeDef::dictionary
(
int
id
) {
66
DictType::iterator i =
myDict
.find(
id
);
67
if
(i ==
myDict
.end()) {
68
return
nullptr
;
69
}
70
return
(*i).second;
71
}
72
73
/*
74
void
75
NIVissimNodeDef::buildNodeClusters()
76
{
77
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
78
int cluster = (*i).second->buildNodeCluster();
79
}
80
}
81
*/
82
83
84
/*
85
86
std::vector<int>
87
NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)
88
{
89
std::vector<int> ret;
90
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
91
NIVissimNodeDef *d = (*i).second;
92
if(d->partialWithin(p, off)) {
93
ret.push_back((*i).first);
94
}
95
}
96
return ret;
97
}
98
99
bool
100
NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const
101
{
102
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
103
return myBoundary->partialWithin(p, off);
104
}
105
106
107
void
108
NIVissimNodeDef::dict_assignConnectionsToNodes() {
109
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
110
(*i).second->searchAndSetConnections();
111
}
112
}
113
*/
114
115
116
void
117
NIVissimNodeDef::clearDict
() {
118
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
119
delete
(*i).second;
120
}
121
myDict
.clear();
122
}
123
124
125
int
126
NIVissimNodeDef::getMaxID
() {
127
return
myMaxID
;
128
}
129
130
131
/****************************************************************************/
NIVissimConnection.h
NIVissimDisturbance.h
NIVissimNodeDef.h
NIVissimTL.h
NIVissimNodeDef
Definition
NIVissimNodeDef.h:31
NIVissimNodeDef::clearDict
static void clearDict()
Definition
NIVissimNodeDef.cpp:117
NIVissimNodeDef::myDict
static DictType myDict
Definition
NIVissimNodeDef.h:55
NIVissimNodeDef::~NIVissimNodeDef
virtual ~NIVissimNodeDef()
Definition
NIVissimNodeDef.cpp:46
NIVissimNodeDef::myMaxID
static int myMaxID
Definition
NIVissimNodeDef.h:56
NIVissimNodeDef::NIVissimNodeDef
NIVissimNodeDef(int id, const std::string &name)
Definition
NIVissimNodeDef.cpp:42
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition
NIVissimNodeDef.cpp:50
NIVissimNodeDef::getMaxID
static int getMaxID()
Definition
NIVissimNodeDef.cpp:126
NIVissimNodeDef::DictType
std::map< int, NIVissimNodeDef * > DictType
Definition
NIVissimNodeDef.h:54
src
netimport
vissim
tempstructs
NIVissimNodeDef.cpp
Generated on Fri Nov 22 2024 00:15:36 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8