SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NIVissimNodeDef_Poly.cpp
Go to the documentation of this file.
1
/****************************************************************************/
8
// -------------------
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11
// Copyright (C) 2001-2014 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 <string>
34
#include <map>
35
#include <cassert>
36
#include <algorithm>
37
#include <
utils/geom/PositionVector.h
>
38
#include "
NIVissimEdge.h
"
39
#include "
NIVissimNodeDef.h
"
40
#include "
NIVissimNodeDef_Poly.h
"
41
#include "
NIVissimConnection.h
"
42
#include "
NIVissimAbstractEdge.h
"
43
#include <
utils/geom/Boundary.h
>
44
45
#ifdef CHECK_MEMORY_LEAKS
46
#include <
foreign/nvwa/debug_new.h
>
47
#endif // CHECK_MEMORY_LEAKS
48
49
50
// ===========================================================================
51
// method definitions
52
// ===========================================================================
53
NIVissimNodeDef_Poly::NIVissimNodeDef_Poly
(
int
id
,
const
std::string& name,
54
const
PositionVector
& poly)
55
:
NIVissimNodeDef_Edges
(id, name,
NIVissimNodeParticipatingEdgeVector
()),
56
myPoly(poly) {}
57
58
59
NIVissimNodeDef_Poly::~NIVissimNodeDef_Poly
() {}
60
61
62
bool
63
NIVissimNodeDef_Poly::dictionary
(
int
id
,
const
std::string& name,
64
const
PositionVector
& poly) {
65
NIVissimNodeDef_Poly
* o =
new
NIVissimNodeDef_Poly
(
id
, name, poly);
66
if
(!
NIVissimNodeDef::dictionary
(
id
, o)) {
67
delete
o;
68
assert(
false
);
69
return
false
;
70
}
71
return
true
;
72
}
73
74
75
/*
76
void
77
NIVissimNodeDef_Poly::computeBounding()
78
{
79
// !!! compute participating edges
80
// !!! call this method after loading!
81
myBoundary = new Boundary(myPoly.getBoxBoundary());
82
assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
83
}
84
85
SUMOReal
86
NIVissimNodeDef_Poly::getEdgePosition(int edgeid) const
87
{
88
NIVissimEdge *edge = NIVissimEdge::dictionary(edgeid);
89
return edge->crossesAtPoint(
90
Position(myBoundary->xmin(), myBoundary->ymin()),
91
Position(myBoundary->xmax(), myBoundary->ymax()));
92
}
93
*/
94
95
96
void
97
NIVissimNodeDef_Poly::searchAndSetConnections
(
SUMOReal
offset) {
98
std::vector<int> within =
NIVissimAbstractEdge::getWithin
(
myPoly
, offset);
99
std::vector<int> connections;
100
std::vector<int> edges;
101
Boundary
boundary(
myPoly
.
getBoxBoundary
());
102
for
(std::vector<int>::const_iterator i = within.begin(); i != within.end(); i++) {
103
NIVissimConnection
* c =
104
NIVissimConnection::dictionary
(*i);
105
NIVissimEdge
* e =
106
NIVissimEdge::dictionary
(*i);
107
if
(c != 0) {
108
connections.push_back(*i);
109
c->
setNodeCluster
(
myID
);
110
}
111
if
(e != 0) {
112
edges.push_back(*i);
113
}
114
}
115
NIVissimConnectionCluster
* c =
116
new
NIVissimConnectionCluster
(connections, boundary,
myID
, edges);
117
for
(std::vector<int>::iterator j = edges.begin(); j != edges.end(); j++) {
118
NIVissimEdge
* edge =
NIVissimEdge::dictionary
(*j);
119
edge->
myConnectionClusters
.push_back(c);
120
}
121
}
122
123
124
125
/****************************************************************************/
126
tmp
buildd
sumo-0.21.0+dfsg
src
netimport
vissim
tempstructs
NIVissimNodeDef_Poly.cpp
Generated on Thu Nov 20 2014 19:49:57 for SUMO - Simulation of Urban MObility by
1.8.1.2