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-2017 German Aerospace Center (DLR) and others.
4
/****************************************************************************/
5
//
6
// This program and the accompanying materials
7
// are made available under the terms of the Eclipse Public License v2.0
8
// which accompanies this distribution, and is available at
9
// http://www.eclipse.org/legal/epl-v20.html
10
//
11
/****************************************************************************/
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
32
#include <iostream>
// !!! debug
33
#include <cassert>
34
#include "
NIVissimNodeDef.h
"
35
#include "
NIVissimConnection.h
"
36
#include "
NIVissimDisturbance.h
"
37
#include "
NIVissimTL.h
"
38
39
40
// ===========================================================================
41
// static member variables
42
// ===========================================================================
43
NIVissimNodeDef::DictType
NIVissimNodeDef::myDict
;
44
int
NIVissimNodeDef::myMaxID
= 0;
45
46
47
// ===========================================================================
48
// method definitions
49
// ===========================================================================
50
NIVissimNodeDef::NIVissimNodeDef
(
int
id
,
const
std::string& name)
51
: myID(id), myName(name) {}
52
53
54
NIVissimNodeDef::~NIVissimNodeDef
() {}
55
56
57
bool
58
NIVissimNodeDef::dictionary
(
int
id
,
NIVissimNodeDef
* o) {
59
DictType::iterator i =
myDict
.find(
id
);
60
if
(i ==
myDict
.end()) {
61
myDict
[id] = o;
62
myMaxID
=
myMaxID
>
id
63
?
myMaxID
64
: id;
65
// o->computeBounding();
66
return
true
;
67
}
68
return
false
;
69
}
70
71
72
NIVissimNodeDef
*
73
NIVissimNodeDef::dictionary
(
int
id
) {
74
DictType::iterator i =
myDict
.find(
id
);
75
if
(i ==
myDict
.end()) {
76
return
0;
77
}
78
return
(*i).second;
79
}
80
81
/*
82
void
83
NIVissimNodeDef::buildNodeClusters()
84
{
85
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
86
int cluster = (*i).second->buildNodeCluster();
87
}
88
}
89
*/
90
91
92
/*
93
94
std::vector<int>
95
NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)
96
{
97
std::vector<int> ret;
98
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
99
NIVissimNodeDef *d = (*i).second;
100
if(d->partialWithin(p, off)) {
101
ret.push_back((*i).first);
102
}
103
}
104
return ret;
105
}
106
107
bool
108
NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const
109
{
110
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
111
return myBoundary->partialWithin(p, off);
112
}
113
114
115
void
116
NIVissimNodeDef::dict_assignConnectionsToNodes() {
117
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
118
(*i).second->searchAndSetConnections();
119
}
120
}
121
*/
122
123
124
int
125
NIVissimNodeDef::dictSize
() {
126
return
(
int
)
myDict
.size();
127
}
128
129
130
131
void
132
NIVissimNodeDef::clearDict
() {
133
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
134
delete
(*i).second;
135
}
136
myDict
.clear();
137
}
138
139
140
int
141
NIVissimNodeDef::getMaxID
() {
142
return
myMaxID
;
143
}
144
145
146
147
/****************************************************************************/
148
NIVissimNodeDef::clearDict
static void clearDict()
Definition:
NIVissimNodeDef.cpp:132
NIVissimConnection.h
NIVissimNodeDef::~NIVissimNodeDef
virtual ~NIVissimNodeDef()
Definition:
NIVissimNodeDef.cpp:54
windows_config.h
config.h
NIVissimNodeDef::myMaxID
static int myMaxID
Definition:
NIVissimNodeDef.h:66
NIVissimNodeDef.h
NIVissimTL.h
NIVissimNodeDef::getMaxID
static int getMaxID()
Definition:
NIVissimNodeDef.cpp:141
NIVissimNodeDef
Definition:
NIVissimNodeDef.h:40
NIVissimDisturbance.h
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition:
NIVissimNodeDef.cpp:58
NIVissimNodeDef::DictType
std::map< int, NIVissimNodeDef * > DictType
Definition:
NIVissimNodeDef.h:64
NIVissimNodeDef::myDict
static DictType myDict
Definition:
NIVissimNodeDef.h:65
NIVissimNodeDef::dictSize
static int dictSize()
Definition:
NIVissimNodeDef.cpp:125
NIVissimNodeDef::NIVissimNodeDef
NIVissimNodeDef(int id, const std::string &name)
Definition:
NIVissimNodeDef.cpp:50
src
netimport
vissim
tempstructs
NIVissimNodeDef.cpp
Generated on Mon Aug 27 2018 10:28:23 for SUMO - Simulation of Urban MObility by
1.8.13