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
GUILane.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Representation of a lane in the micro simulation (gui-version)
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <string>
34
#include <utility>
35
#include <
utils/foxtools/MFXMutex.h
>
36
#include <
utils/geom/Position.h
>
37
#include <
utils/common/MsgHandler.h
>
38
#include <
microsim/MSLane.h
>
39
#include <
microsim/MSVehicleControl.h
>
40
#include <
microsim/MSVehicleTransfer.h
>
41
#include <
microsim/MSNet.h
>
42
#include "
GUILane.h
"
43
#include "
GUIVehicle.h
"
44
#include "
GUINet.h
"
45
46
#ifdef CHECK_MEMORY_LEAKS
47
#include <
foreign/nvwa/debug_new.h
>
48
#endif // CHECK_MEMORY_LEAKS
49
50
51
// ===========================================================================
52
// method definitions
53
// ===========================================================================
54
GUILane::GUILane
(
const
std::string&
id
,
SUMOReal
maxSpeed,
SUMOReal
length,
55
MSEdge
*
const
edge,
unsigned
int
numericalID,
56
const
PositionVector
& shape,
SUMOReal
width,
57
SVCPermissions
permissions) :
58
MSLane
(id, maxSpeed, length, edge, numericalID, shape, width, permissions) {}
59
60
61
GUILane::~GUILane
() {
62
// just to quit cleanly on a failure
63
if
(
myLock
.
locked
()) {
64
myLock
.
unlock
();
65
}
66
}
67
68
69
// ------ Vehicle insertion ------
70
void
71
GUILane::incorporateVehicle
(
MSVehicle
* veh,
SUMOReal
pos,
SUMOReal
speed,
72
const
MSLane::VehCont::iterator& at,
73
MSMoveReminder::Notification
notification) {
74
myLock
.
lock
();
75
try
{
76
MSLane::incorporateVehicle
(veh, pos, speed, at, notification);
77
myLock
.
unlock
();
78
}
catch
(
ProcessError
&) {
79
myLock
.
unlock
();
80
throw
;
81
}
82
}
83
84
85
// ------ Access to vehicles ------
86
const
MSLane::VehCont
&
87
GUILane::getVehiclesSecure
()
const
{
88
myLock
.
lock
();
89
return
myVehicles
;
90
}
91
92
93
void
94
GUILane::releaseVehicles
()
const
{
95
myLock
.
unlock
();
96
}
97
98
99
bool
100
GUILane::moveCritical
(
SUMOTime
t) {
101
myLock
.
lock
();
102
try
{
103
bool
ret =
MSLane::moveCritical
(t);
104
myLock
.
unlock
();
105
return
ret;
106
}
catch
(
ProcessError
&) {
107
myLock
.
unlock
();
108
throw
;
109
}
110
}
111
112
113
bool
114
GUILane::setCritical
(
SUMOTime
t, std::vector<MSLane*> &into) {
115
myLock
.
lock
();
116
try
{
117
bool
ret =
MSLane::setCritical
(t, into);
118
myLock
.
unlock
();
119
return
ret;
120
}
catch
(
ProcessError
&) {
121
myLock
.
unlock
();
122
throw
;
123
}
124
}
125
126
127
MSVehicle
*
128
GUILane::removeVehicle
(
MSVehicle
* remVehicle) {
129
myLock
.
lock
();
130
try
{
131
MSVehicle
* ret =
MSLane::removeVehicle
(remVehicle);
132
myLock
.
unlock
();
133
return
ret;
134
}
catch
(
ProcessError
&) {
135
myLock
.
unlock
();
136
throw
;
137
}
138
}
139
140
141
void
142
GUILane::swapAfterLaneChange
(
SUMOTime
t) {
143
myLock
.
lock
();
144
try
{
145
MSLane::swapAfterLaneChange
(t);
146
myLock
.
unlock
();
147
}
catch
(
ProcessError
&) {
148
myLock
.
unlock
();
149
throw
;
150
}
151
}
152
153
154
bool
155
GUILane::integrateNewVehicle
(
SUMOTime
t) {
156
myLock
.
lock
();
157
try
{
158
bool
ret =
MSLane::integrateNewVehicle
(t);
159
myLock
.
unlock
();
160
return
ret;
161
}
catch
(
ProcessError
&) {
162
myLock
.
unlock
();
163
throw
;
164
}
165
}
166
167
168
GUILaneWrapper
*
169
GUILane::buildLaneWrapper
(
unsigned
int
index) {
170
return
new
GUILaneWrapper
(*
this
,
myShape
, index);
171
}
172
173
174
void
175
GUILane::detectCollisions
(
SUMOTime
timestep) {
176
myLock
.
lock
();
177
try
{
178
MSLane::detectCollisions
(timestep);
179
myLock
.
unlock
();
180
}
catch
(
ProcessError
&) {
181
myLock
.
unlock
();
182
throw
;
183
}
184
}
185
186
187
188
/****************************************************************************/
189
tmp
buildd
sumo-0.15.0~dfsg
src
guisim
GUILane.cpp
Generated on Sun May 27 2012 14:52:04 for SUMO - Simulation of Urban MObility by
1.8.1