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-2016 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
#ifdef CHECK_MEMORY_LEAKS
41
#include <
foreign/nvwa/debug_new.h
>
42
#endif // CHECK_MEMORY_LEAKS
43
44
45
// ===========================================================================
46
// static member variables
47
// ===========================================================================
48
NIVissimNodeDef::DictType
NIVissimNodeDef::myDict
;
49
int
NIVissimNodeDef::myMaxID
= 0;
50
51
52
// ===========================================================================
53
// method definitions
54
// ===========================================================================
55
NIVissimNodeDef::NIVissimNodeDef
(
int
id
,
const
std::string& name)
56
: myID(id), myName(name) {}
57
58
59
NIVissimNodeDef::~NIVissimNodeDef
() {}
60
61
62
bool
63
NIVissimNodeDef::dictionary
(
int
id
,
NIVissimNodeDef
* o) {
64
DictType::iterator i =
myDict
.find(
id
);
65
if
(i ==
myDict
.end()) {
66
myDict
[id] = o;
67
myMaxID
=
myMaxID
>
id
68
?
myMaxID
69
: id;
70
// o->computeBounding();
71
return
true
;
72
}
73
return
false
;
74
}
75
76
77
NIVissimNodeDef
*
78
NIVissimNodeDef::dictionary
(
int
id
) {
79
DictType::iterator i =
myDict
.find(
id
);
80
if
(i ==
myDict
.end()) {
81
return
0;
82
}
83
return
(*i).second;
84
}
85
86
/*
87
void
88
NIVissimNodeDef::buildNodeClusters()
89
{
90
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
91
int cluster = (*i).second->buildNodeCluster();
92
}
93
}
94
*/
95
96
97
/*
98
99
std::vector<int>
100
NIVissimNodeDef::getWithin(const AbstractPoly &p, SUMOReal off)
101
{
102
std::vector<int> ret;
103
for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
104
NIVissimNodeDef *d = (*i).second;
105
if(d->partialWithin(p, off)) {
106
ret.push_back((*i).first);
107
}
108
}
109
return ret;
110
}
111
112
bool
113
NIVissimNodeDef::partialWithin(const AbstractPoly &p, SUMOReal off) const
114
{
115
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
116
return myBoundary->partialWithin(p, off);
117
}
118
119
120
void
121
NIVissimNodeDef::dict_assignConnectionsToNodes() {
122
for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
123
(*i).second->searchAndSetConnections();
124
}
125
}
126
*/
127
128
129
int
130
NIVissimNodeDef::dictSize
() {
131
return
(
int
)
myDict
.size();
132
}
133
134
135
136
void
137
NIVissimNodeDef::clearDict
() {
138
for
(DictType::iterator i =
myDict
.begin(); i !=
myDict
.end(); i++) {
139
delete
(*i).second;
140
}
141
myDict
.clear();
142
}
143
144
145
int
146
NIVissimNodeDef::getMaxID
() {
147
return
myMaxID
;
148
}
149
150
151
152
/****************************************************************************/
153
NIVissimNodeDef::clearDict
static void clearDict()
Definition:
NIVissimNodeDef.cpp:137
NIVissimConnection.h
NIVissimNodeDef::~NIVissimNodeDef
virtual ~NIVissimNodeDef()
Definition:
NIVissimNodeDef.cpp:59
windows_config.h
debug_new.h
config.h
NIVissimNodeDef::myMaxID
static int myMaxID
Definition:
NIVissimNodeDef.h:67
NIVissimNodeDef.h
NIVissimTL.h
NIVissimNodeDef::getMaxID
static int getMaxID()
Definition:
NIVissimNodeDef.cpp:146
NIVissimNodeDef
Definition:
NIVissimNodeDef.h:41
NIVissimDisturbance.h
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition:
NIVissimNodeDef.cpp:63
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:130
NIVissimNodeDef::NIVissimNodeDef
NIVissimNodeDef(int id, const std::string &name)
Definition:
NIVissimNodeDef.cpp:55
src
netimport
vissim
tempstructs
NIVissimNodeDef.cpp
Generated on Thu Nov 17 2016 13:44:40 for SUMO - Simulation of Urban MObility by
1.8.12