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
GUIVehicle.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// A MSVehicle extended by some values for usage within the gui
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13
// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
14
/****************************************************************************/
15
//
16
// This file is part of SUMO.
17
// SUMO is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
/****************************************************************************/
23
#ifndef GUIVehicle_h
24
#define GUIVehicle_h
25
26
27
// ===========================================================================
28
// included modules
29
// ===========================================================================
30
#ifdef _MSC_VER
31
#include <
windows_config.h
>
32
#else
33
#include <
config.h
>
34
#endif
35
36
#include <vector>
37
#include <set>
38
#include <string>
39
#include <
utils/gui/globjects/GUIGlObject.h
>
40
#include <
utils/common/RGBColor.h
>
41
#include <
utils/geom/PositionVector.h
>
42
#include <
microsim/MSVehicle.h
>
43
#include <
utils/gui/globjects/GUIGLObjectPopupMenu.h
>
44
#include <
utils/foxtools/MFXMutex.h
>
45
#include <
utils/gui/settings/GUIColorer.h
>
46
47
48
// ===========================================================================
49
// class declarations
50
// ===========================================================================
51
class
GUISUMOAbstractView
;
52
class
GUIGLObjectPopupMenu
;
53
class
MSDevice_Vehroutes
;
54
55
56
// ===========================================================================
57
// class definitions
58
// ===========================================================================
68
class
GUIVehicle
:
public
MSVehicle
,
public
GUIGlObject
{
69
public
:
78
GUIVehicle
(
SUMOVehicleParameter
* pars,
const
MSRoute
* route,
79
const
MSVehicleType
* type,
SUMOReal
speedFactor);
80
81
83
~GUIVehicle
();
84
85
87
88
96
GUIGLObjectPopupMenu
*
getPopUpMenu
(
GUIMainWindow
& app,
GUISUMOAbstractView
& parent);
97
98
106
GUIParameterTableWindow
*
getParameterWindow
(
GUIMainWindow
& app,
GUISUMOAbstractView
& parent);
107
108
114
Boundary
getCenteringBoundary
()
const
;
115
116
121
void
drawGL
(
const
GUIVisualizationSettings
& s)
const
;
122
123
124
129
virtual
void
drawGLAdditional
(
GUISUMOAbstractView
*
const
parent,
const
GUIVisualizationSettings
& s)
const
;
131
132
133
136
142
bool
hasActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which)
const
;
143
144
150
void
addActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which);
151
152
158
void
removeActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which);
160
161
162
167
SUMOReal
getLastLaneChangeOffset
()
const
;
168
169
176
class
GUIVehiclePopupMenu
:
public
GUIGLObjectPopupMenu
{
177
FXDECLARE(
GUIVehiclePopupMenu
)
178
public
:
185
GUIVehiclePopupMenu
(
GUIMainWindow
& app,
186
GUISUMOAbstractView
& parent,
GUIGlObject
& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
187
189
~GUIVehiclePopupMenu
();
190
192
long
onCmdShowAllRoutes
(
FXObject
*, FXSelector,
void
*);
194
long
onCmdHideAllRoutes
(
FXObject
*, FXSelector,
void
*);
196
long
onCmdShowCurrentRoute
(
FXObject
*, FXSelector,
void
*);
198
long
onCmdHideCurrentRoute
(
FXObject
*, FXSelector,
void
*);
200
long
onCmdShowBestLanes
(
FXObject
*, FXSelector,
void
*);
202
long
onCmdHideBestLanes
(
FXObject
*, FXSelector,
void
*);
204
long
onCmdStartTrack
(
FXObject
*, FXSelector,
void
*);
206
long
onCmdStopTrack
(
FXObject
*, FXSelector,
void
*);
208
long
onCmdShowLFLinkItems
(
FXObject
*, FXSelector,
void
*);
210
long
onCmdHideLFLinkItems
(
FXObject
*, FXSelector,
void
*);
212
long
onCmdShowFoes
(
FXObject
*, FXSelector,
void
*);
213
214
protected
:
216
std::map<GUISUMOAbstractView*, int>&
myVehiclesAdditionalVisualizations
;
218
std::map<GUISUMOAbstractView*, int>
dummy
;
219
220
protected
:
222
GUIVehiclePopupMenu
() :
myVehiclesAdditionalVisualizations
(
dummy
) { }
223
224
};
225
226
229
232
enum
VisualisationFeatures
{
234
VO_SHOW_BEST_LANES
= 1,
236
VO_SHOW_ROUTE
= 2,
238
VO_SHOW_ALL_ROUTES
= 4,
240
VO_TRACKED
= 8,
242
VO_SHOW_LFLINKITEMS
= 16
243
};
244
246
std::map<GUISUMOAbstractView*, int>
myAdditionalVisualizations
;
247
248
252
void
drawRouteHelper
(
const
MSRoute
& r,
SUMOReal
exaggeration)
const
;
253
254
260
void
drawRoute
(
const
GUIVisualizationSettings
& s,
int
routeNo,
SUMOReal
darken)
const
;
261
262
265
void
drawBestLanes
()
const
;
267
269
void
selectBlockingFoes
()
const
;
270
272
SUMOReal
getColorValue
(
size_t
activeScheme)
const
;
273
274
275
private
:
277
void
setColor
(
const
GUIVisualizationSettings
& s)
const
;
278
280
bool
setFunctionalColor
(
size_t
activeScheme)
const
;
281
284
static
void
drawPoly
(
double
* poses,
SUMOReal
offset);
285
286
void
drawAction_drawVehicleAsBoxPlus
()
const
;
287
void
drawAction_drawVehicleAsTrianglePlus
()
const
;
288
void
drawAction_drawVehicleAsPoly
(
const
GUIVisualizationSettings
& s)
const
;
289
290
/* @brief try to draw vehicle as raster image and return true if sucessful
291
* @param[in] length The custom length of the vehicle
292
* (defaults to the * length specified in the vehicle type if -1 is passed)
293
*/
294
bool
drawAction_drawVehicleAsImage
(
const
GUIVisualizationSettings
& s,
SUMOReal
length = -1)
const
;
295
296
/* @brief draw train with individual carriages. The number of carriages is
297
* determined from defaultLength of carriages and vehicle length
298
* passengerSeats are computed beginning at firstPassengerCarriage */
299
void
drawAction_drawRailCarriages
(
const
GUIVisualizationSettings
& s,
SUMOReal
defaultLength,
SUMOReal
carriageGap,
300
int
firstPassengerCarriage,
bool
asImage)
const
;
302
304
bool
drawAction_drawCarriageClass
(
const
GUIVisualizationSettings
& s,
SUMOVehicleShape
guiShape,
bool
asImage)
const
;
305
306
/* @brief return the previous lane in this vehicles route including internal lanes
307
* @param[in] current The lane of which the predecessor should be returned
308
* @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
309
*/
310
MSLane
*
getPreviousLane
(
MSLane
* current,
int
& furtherIndex)
const
;
311
313
const
Position
&
getSeatPosition
(
size_t
personIndex)
const
;
314
316
int
getNumPassengers
()
const
;
317
319
void
computeSeats
(
const
Position
& front,
const
Position
& back,
int
& requiredSeats)
const
;
320
322
std::string
getStopInfo
()
const
;
323
324
static
void
drawLinkItem
(
const
Position
& pos,
SUMOTime
arrivalTime,
SUMOTime
leaveTime,
SUMOReal
exagerate);
325
326
private
:
328
mutable
MFXMutex
myLock
;
329
331
mutable
SUMOReal
myCarriageLength
;
332
333
MSDevice_Vehroutes
*
myRoutes
;
334
336
mutable
PositionVector
mySeatPositions
;
337
338
};
339
340
341
#endif
342
343
/****************************************************************************/
344
tmp
buildd
sumo-0.21.0+dfsg
src
guisim
GUIVehicle.h
Generated on Thu Nov 20 2014 19:49:54 for SUMO - Simulation of Urban MObility by
1.8.1.2