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.sourceforge.net/
13
// Copyright (C) 2001-2012 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
GUILaneWrapper
;
54
class
MSDevice_Vehroutes
;
55
56
57
// ===========================================================================
58
// class definitions
59
// ===========================================================================
69
class
GUIVehicle
:
public
MSVehicle
,
public
GUIGlObject
{
70
public
:
79
GUIVehicle
(
SUMOVehicleParameter
* pars,
const
MSRoute
* route,
80
const
MSVehicleType
* type,
SUMOReal
speedFactor,
int
vehicleIndex);
81
82
84
~GUIVehicle
();
85
86
88
89
97
GUIGLObjectPopupMenu
*
getPopUpMenu
(
GUIMainWindow
& app,
GUISUMOAbstractView
& parent);
98
99
107
GUIParameterTableWindow
*
getParameterWindow
(
GUIMainWindow
& app,
GUISUMOAbstractView
& parent);
108
109
115
Boundary
getCenteringBoundary
()
const
;
116
117
122
void
drawGL
(
const
GUIVisualizationSettings
& s)
const
;
123
124
125
130
virtual
void
drawGLAdditional
(
GUISUMOAbstractView
*
const
parent,
const
GUIVisualizationSettings
& s)
const
;
132
133
134
137
143
bool
hasActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which)
const
;
144
145
152
bool
addActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which);
153
154
161
bool
removeActiveAddVisualisation
(
GUISUMOAbstractView
*
const
parent,
int
which);
163
164
165
170
SUMOReal
getLastLaneChangeOffset
()
const
{
171
return
STEPS2TIME
(
myLastLaneChangeOffset
);
172
}
173
174
182
const
std::vector<LaneQ>&
getBestLanes
()
const
;
183
184
191
class
GUIVehiclePopupMenu
:
public
GUIGLObjectPopupMenu
{
192
FXDECLARE(
GUIVehiclePopupMenu
)
193
public
:
200
GUIVehiclePopupMenu
(
GUIMainWindow
& app,
201
GUISUMOAbstractView
& parent,
GUIGlObject
& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
202
204
~GUIVehiclePopupMenu
();
205
207
long
onCmdShowAllRoutes
(
FXObject
*, FXSelector,
void
*);
209
long
onCmdHideAllRoutes
(
FXObject
*, FXSelector,
void
*);
211
long
onCmdShowCurrentRoute
(
FXObject
*, FXSelector,
void
*);
213
long
onCmdHideCurrentRoute
(
FXObject
*, FXSelector,
void
*);
215
long
onCmdShowBestLanes
(
FXObject
*, FXSelector,
void
*);
217
long
onCmdHideBestLanes
(
FXObject
*, FXSelector,
void
*);
219
long
onCmdStartTrack
(
FXObject
*, FXSelector,
void
*);
221
long
onCmdStopTrack
(
FXObject
*, FXSelector,
void
*);
223
long
onCmdShowLFLinkItems
(
FXObject
*, FXSelector,
void
*);
225
long
onCmdHideLFLinkItems
(
FXObject
*, FXSelector,
void
*);
226
227
protected
:
229
std::map<GUISUMOAbstractView*, int>&
myVehiclesAdditionalVisualizations
;
231
std::map<GUISUMOAbstractView*, int>
dummy
;
232
233
protected
:
235
GUIVehiclePopupMenu
() :
myVehiclesAdditionalVisualizations
(
dummy
) { }
236
237
};
238
239
242
245
enum
VisualisationFeatures
{
247
VO_SHOW_BEST_LANES
= 1,
249
VO_SHOW_ROUTE
= 2,
251
VO_SHOW_ALL_ROUTES
= 4,
253
VO_TRACKED
= 8,
255
VO_SHOW_LFLINKITEMS
= 16
256
};
257
259
std::map<GUISUMOAbstractView*, int>
myAdditionalVisualizations
;
260
261
265
void
draw
(
const
MSRoute
& r)
const
;
266
267
273
void
drawRoute
(
const
GUIVisualizationSettings
& s,
int
routeNo,
SUMOReal
darken)
const
;
274
275
278
void
drawBestLanes
()
const
;
280
281
282
private
:
283
285
mutable
MFXMutex
myLock
;
286
287
MSDevice_Vehroutes
*
myRoutes
;
288
289
private
:
290
292
void
setColor
(
const
GUIVisualizationSettings
& s)
const
;
293
295
SUMOReal
getColorValue
(
size_t
activeScheme)
const
;
296
298
bool
setFunctionalColor
(
size_t
activeScheme)
const
;
299
301
GUILaneWrapper
&
getLaneWrapper
()
const
;
302
305
static
void
drawPoly
(
double
* poses,
SUMOReal
offset);
306
307
void
drawAction_drawVehicleAsBoxPlus
()
const
;
308
void
drawAction_drawVehicleAsTrianglePlus
()
const
;
309
void
drawAction_drawVehicleAsPoly
(
const
GUIVisualizationSettings
& s)
const
;
310
311
/* @brief try to draw vehicle as raster image and return true if sucessful
312
* @param[in] length The custom length of the vehicle
313
* (defaults to the * length specified in the vehicle type if -1 is passed)
314
*/
315
bool
drawAction_drawVehicleAsImage
(
const
GUIVisualizationSettings
& s,
SUMOReal
length = -1)
const
;
316
317
/* @brief draw train with individual carriages. The number of carriages is
318
* determined from defaultLength of carriages and vehicle length
319
* passengerSeats are computed beginning at firstPassengerCarriage */
320
void
drawAction_drawRailCarriages
(
const
GUIVisualizationSettings
& s,
SUMOReal
defaultLength,
int
firstPassengerCarriage = 0,
bool
asImage =
false
)
const
;
322
323
/* @brief return the previous lane in this vehicles route including internal lanes
324
* @param[in] current The lane of which the predecessor should be returned
325
* @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
326
*/
327
MSLane
*
getPreviousLane
(
MSLane
* current,
int
& routeIndex)
const
;
328
330
const
Position
&
getSeatPosition
(
size_t
personIndex)
const
;
331
333
mutable
PositionVector
mySeatPositions
;
334
336
int
getNumPassengers
()
const
;
337
339
void
computeSeats
(
const
Position
& front,
const
Position
& back,
int
& requiredSeats)
const
;
340
};
341
342
343
#endif
344
345
/****************************************************************************/
346
build
buildd
sumo-0.16.0~dfsg
src
guisim
GUIVehicle.h
Generated on Tue Apr 16 2013 01:32:17 for SUMO - Simulation of Urban MObility by
1.8.3.1