SUMO - Simulation of Urban MObility
NIVissimNodeDef.cpp
Go to the documentation of this file.
1
/****************************************************************************/
8
// -------------------
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11
// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
22
23
// ===========================================================================
24
// included modules
25
// ===========================================================================
26
#ifdef _MSC_VER
27
#include <
windows_config.h
>
28
#else
29
#include <
config.h
>
30
#endif
31
32
33
#include <iostream>
// !!! debug
34
#include <cassert>
35
#include "
NIVissimNodeDef.h
"
36
#include "
NIVissimConnection.h
"
37
#include "
NIVissimDisturbance.h
"
38
#include "
NIVissimTL.h
"
39
40
41
// ===========================================================================
42
// static member variables
43
// ===========================================================================
44
NIVissimNodeDef::DictType
NIVissimNodeDef::myDict
;
45
int
NIVissimNodeDef::myMaxID
= 0;
46
47
48
// ===========================================================================
49
// method definitions
50
// ===========================================================================
51
NIVissimNodeDef::NIVissimNodeDef
(
int
id
,
const
std::string& name)
52
: myID(id), myName(name) {}
53
54
55
NIVissimNodeDef::~NIVissimNodeDef
() {}
56
57
58
bool
59
NIVissimNodeDef::dictionary
(
int
id
,
NIVissimNodeDef
* o) {
60
DictType::iterator i =
myDict
.find(
id
);
61
if
(i ==
myDict
.end()) {
62
myDict
[id] = o;
63
myMaxID
=
myMaxID
>
id
64
?
myMaxID
65
: id;
66
// o->computeBounding();
67
return
true
;
68
}
69
return
false
;
70
}
71
72
73
NIVissimNodeDef
*
74
NIVissimNodeDef::dictionary
(
int
id
) {
75
DictType::iterator i =
myDict
.find(
id
);
76
if
(i ==
myDict
.end()) {
77
return
0;
78
}
79
return
(*i).second;
80
}
81
82
/*
83
void
84
NIVissimNodeDef::buildNodeClusters()
85
{
86
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
87
int cluster = (*i).second->buildNodeCluster();
88
}
89
}
90
*/
91
92
93
/*
94
95
std::vector<int>
96
NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)
97
{
98
std::vector<int> ret;
99
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
100
NIVissimNodeDef *d = (*i).second;
101
if(d->partialWithin(p, off)) {
102
ret.push_back((*i).first);
103
}
104
}
105
return ret;
106
}
107
108
bool
109
NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const
110
{
111
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
112
return myBoundary->partialWithin(p, off);
113
}
114
115
116
void
117
NIVissimNodeDef::dict_assignConnectionsToNodes() {
118
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
119
(*i).second->searchAndSetConnections();
120
}
121
}
122
*/
123
124
125
int
126
NIVissimNodeDef::dictSize
() {
127
return
(
int
)
myDict
.size();
128
}
129
130
131
132
void
133
NIVissimNodeDef::clearDict
() {
134
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
135
delete
(*i).second;
136
}
137
myDict
.clear();
138
}
139
140
141
int
142
NIVissimNodeDef::getMaxID
() {
143
return
myMaxID
;
144
}
145
146
147
148
/****************************************************************************/
149
NIVissimNodeDef::clearDict
static void clearDict()
Definition:
NIVissimNodeDef.cpp:133
NIVissimConnection.h
NIVissimNodeDef::~NIVissimNodeDef
virtual ~NIVissimNodeDef()
Definition:
NIVissimNodeDef.cpp:55
windows_config.h
config.h
NIVissimNodeDef::myMaxID
static int myMaxID
Definition:
NIVissimNodeDef.h:67
NIVissimNodeDef.h
NIVissimTL.h
NIVissimNodeDef::getMaxID
static int getMaxID()
Definition:
NIVissimNodeDef.cpp:142
NIVissimNodeDef
Definition:
NIVissimNodeDef.h:41
NIVissimDisturbance.h
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition:
NIVissimNodeDef.cpp:59
NIVissimNodeDef::DictType
std::map< int, NIVissimNodeDef * > DictType
Definition:
NIVissimNodeDef.h:65
NIVissimNodeDef::myDict
static DictType myDict
Definition:
NIVissimNodeDef.h:66
NIVissimNodeDef::dictSize
static int dictSize()
Definition:
NIVissimNodeDef.cpp:126
NIVissimNodeDef::NIVissimNodeDef
NIVissimNodeDef(int id, const std::string &name)
Definition:
NIVissimNodeDef.cpp:51
src
netimport
vissim
tempstructs
NIVissimNodeDef.cpp
Generated on Fri Nov 3 2017 20:31:28 for SUMO - Simulation of Urban MObility by
1.8.13