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-2013 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
AbstractMutex::ScopedLocker
locker(
myLock
);
75
MSLane::incorporateVehicle
(veh, pos, speed, at, notification);
76
}
77
78
79
// ------ Access to vehicles ------
80
const
MSLane::VehCont
&
81
GUILane::getVehiclesSecure
()
const
{
82
myLock
.
lock
();
83
return
myVehicles
;
84
}
85
86
87
void
88
GUILane::releaseVehicles
()
const
{
89
myLock
.
unlock
();
90
}
91
92
93
bool
94
GUILane::planMovements
(
SUMOTime
t) {
95
AbstractMutex::ScopedLocker
locker(
myLock
);
96
return
MSLane::planMovements
(t);
97
}
98
99
100
bool
101
GUILane::executeMovements
(
SUMOTime
t, std::vector<MSLane*>& into) {
102
AbstractMutex::ScopedLocker
locker(
myLock
);
103
return
MSLane::executeMovements
(t, into);
104
}
105
106
107
MSVehicle
*
108
GUILane::removeVehicle
(
MSVehicle
* remVehicle) {
109
AbstractMutex::ScopedLocker
locker(
myLock
);
110
return
MSLane::removeVehicle
(remVehicle);
111
}
112
113
114
void
115
GUILane::swapAfterLaneChange
(
SUMOTime
t) {
116
AbstractMutex::ScopedLocker
locker(
myLock
);
117
MSLane::swapAfterLaneChange
(t);
118
}
119
120
121
bool
122
GUILane::integrateNewVehicle
(
SUMOTime
t) {
123
AbstractMutex::ScopedLocker
locker(
myLock
);
124
return
MSLane::integrateNewVehicle
(t);
125
}
126
127
128
GUILaneWrapper
*
129
GUILane::buildLaneWrapper
(
unsigned
int
index) {
130
return
new
GUILaneWrapper
(*
this
,
myShape
, index);
131
}
132
133
134
void
135
GUILane::detectCollisions
(
SUMOTime
timestep,
int
stage) {
136
AbstractMutex::ScopedLocker
locker(
myLock
);
137
MSLane::detectCollisions
(timestep, stage);
138
}
139
140
141
142
/****************************************************************************/
143
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
guisim
GUILane.cpp
Generated on Sun Jun 16 2013 07:07:15 for SUMO - Simulation of Urban MObility by
1.8.1.2