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
GUISUMOAbstractView.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// The base class for a view
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13
// Copyright (C) 2001-2013 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 GUISUMOAbstractView_h
24
#define GUISUMOAbstractView_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 <string>
37
#include <vector>
38
#include <map>
39
#include <fx.h>
40
// fx3d includes windows.h so we need to guard against macro pollution
41
#ifdef WIN32
42
#define NOMINMAX
43
#endif
44
#include <fx3d.h>
45
#ifdef WIN32
46
#undef NOMINMAX
47
#endif
48
49
#include <
utils/foxtools/MFXMutex.h
>
50
#include <
utils/geom/Boundary.h
>
51
#include <
utils/geom/Position.h
>
52
#include <
utils/common/RGBColor.h
>
53
#include <
utils/common/SUMOTime.h
>
54
#include <
utils/shapes/Polygon.h
>
55
#include <
utils/gui/globjects/GUIGlObjectTypes.h
>
56
#include <
foreign/rtree/SUMORTree.h
>
57
58
59
// ===========================================================================
60
// class declarations
61
// ===========================================================================
62
class
GUIGlChildWindow
;
63
class
GUIVehicle
;
64
class
GUIPerspectiveChanger
;
65
class
GUIMainWindow
;
66
class
GUIGLObjectPopupMenu
;
67
class
GUIGlObject
;
68
class
GUIDialog_EditViewport
;
69
class
GUIDialog_ViewSettings
;
70
class
GUIVisualizationSettings
;
71
72
73
// ===========================================================================
74
// class definitions
75
// ===========================================================================
82
class
GUISUMOAbstractView
:
public
FXGLCanvas
{
83
FXDECLARE(
GUISUMOAbstractView
)
84
public
:
86
GUISUMOAbstractView
(FXComposite* p,
GUIMainWindow
& app,
87
GUIGlChildWindow
* parent,
const
SUMORTree
& grid,
88
FXGLVisual* glVis,
FXGLCanvas
* share);
89
91
virtual
~GUISUMOAbstractView
();
92
94
virtual
void
buildViewToolBars
(
GUIGlChildWindow
&) { }
95
97
virtual
void
recenterView
();
98
105
virtual
void
centerTo
(
GUIGlID
id
,
bool
applyZoom,
SUMOReal
zoomDist = 20);
106
108
void
centerTo
(
const
Boundary
& bound);
109
111
virtual
void
setViewport
(
const
Position
& lookFrom,
const
Position
& lookAt);
112
114
SUMOReal
m2p
(
SUMOReal
meter)
const
;
115
117
SUMOReal
p2m
(
SUMOReal
pixel)
const
;
118
120
// bool allowRotation() const;
121
123
void
setWindowCursorPosition
(FXint x, FXint y);
124
126
FXbool
makeCurrent
();
127
129
bool
isInEditMode
();
130
131
GUIPerspectiveChanger
&
getChanger
()
const
{
132
return
*
myChanger
;
133
}
134
135
Boundary
getVisibleBoundary
()
const
;
136
137
virtual
long
onConfigure
(
FXObject
*, FXSelector,
void
*);
138
virtual
long
onPaint
(
FXObject
*, FXSelector,
void
*);
139
virtual
long
onLeftBtnPress
(
FXObject
*, FXSelector,
void
*);
140
virtual
long
onLeftBtnRelease
(
FXObject
*, FXSelector,
void
*);
141
virtual
long
onMiddleBtnPress
(
FXObject
*, FXSelector,
void
*) {
142
return
1;
143
}
144
virtual
long
onMiddleBtnRelease
(
FXObject
*, FXSelector,
void
*) {
145
return
1;
146
}
147
virtual
long
onRightBtnPress
(
FXObject
*, FXSelector,
void
*);
148
virtual
long
onRightBtnRelease
(
FXObject
*, FXSelector,
void
*);
149
virtual
long
onMouseWheel
(
FXObject
*, FXSelector,
void
*);
150
virtual
long
onMouseMove
(
FXObject
*, FXSelector,
void
*);
151
virtual
long
onMouseLeft
(
FXObject
*, FXSelector,
void
*);
152
153
virtual
long
onKeyPress
(
FXObject
* o, FXSelector sel,
void
* data);
154
virtual
long
onKeyRelease
(
FXObject
* o, FXSelector sel,
void
* data);
155
156
157
virtual
void
openObjectDialog
();
158
160
void
updateToolTip
();
161
162
165
169
void
setSnapshots
(std::map<SUMOTime, std::string> snaps);
170
171
178
std::string
makeSnapshot
(
const
std::string& destFile);
179
180
183
void
checkSnapshots
();
184
186
virtual
SUMOTime
getCurrentTimeStep
()
const
{
187
return
0;
188
}
190
191
192
193
virtual
void
showViewportEditor
();
194
void
showViewschemeEditor
();
195
void
showToolTips
(
bool
val);
196
virtual
bool
setColorScheme
(
const
std::string&) {
197
return
true
;
198
}
199
200
void
remove
(
GUIDialog_EditViewport
*) {
201
myViewportChooser
= 0;
202
}
203
204
void
remove
(
GUIDialog_ViewSettings
*) {
205
myVisualizationChanger
= 0;
206
}
207
208
209
// @todo: check why this is here
210
SUMOReal
getGridWidth
()
const
;
211
// @todo: check why this is here
212
SUMOReal
getGridHeight
()
const
;
213
214
virtual
void
startTrack
(
int
/*id*/
) { }
215
virtual
void
stopTrack
() { }
216
virtual
int
getTrackedID
()
const
{
217
return
-1;
218
}
219
220
virtual
void
onGamingClick
(
Position
/*pos*/
) { }
221
224
230
bool
addAdditionalGLVisualisation
(
GUIGlObject
*
const
which);
231
232
238
bool
removeAdditionalGLVisualisation
(
GUIGlObject
*
const
which);
240
241
243
void
destroyPopup
();
244
245
246
public
:
247
251
struct
Decal
{
253
Decal
()
254
:
filename
(),
centerX
(0),
centerY
(0),
centerZ
(0),
255
width
(0),
height
(0),
altitude
(0),
rot
(0),
tilt
(0),
roll
(0),
layer
(0),
256
initialised
(false),
skip2D
(false),
glID
(-1),
image
(0) { }
257
259
std::string
filename
;
261
SUMOReal
centerX
;
263
SUMOReal
centerY
;
265
SUMOReal
centerZ
;
267
SUMOReal
width
;
269
SUMOReal
height
;
271
SUMOReal
altitude
;
273
SUMOReal
rot
;
275
SUMOReal
tilt
;
277
SUMOReal
roll
;
279
SUMOReal
layer
;
281
bool
initialised
;
283
bool
skip2D
;
285
int
glID
;
287
FXImage*
image
;
288
};
289
290
291
public
:
292
FXComboBox&
getColoringSchemesCombo
();
293
294
298
Position
getPositionInformation
()
const
;
299
300
void
addDecals
(
const
std::vector<Decal>& decals) {
301
myDecals
.insert(
myDecals
.end(), decals.begin(), decals.end());
302
}
303
304
305
const
GUIVisualizationSettings
*
getVisualisationSettings
() {
306
return
myVisualizationSettings
;
307
}
308
309
310
protected
:
312
void
paintGL
();
313
314
void
updatePositionInformation
()
const
;
315
316
317
virtual
int
doPaintGL
(
int
/*mode*/
,
const
Boundary
&
/*boundary*/
) {
318
return
0;
319
}
320
321
virtual
void
doInit
() { }
322
324
void
paintGLGrid
();
325
330
void
displayLegend
();
331
332
334
GUIGlID
getObjectUnderCursor
();
335
337
GUIGlID
getObjectAtPosition
(
Position
pos);
338
340
std::vector<GUIGlID>
getObjectsInBoundary
(
const
Boundary
& bound);
341
343
void
showToolTipFor
(
unsigned
int
id
);
344
345
346
protected
:
349
FXImage*
checkGDALImage
(Decal& d);
350
353
void
drawDecals
();
354
355
// applies gl-transformations to fit the Boundary given by myChanger onto
356
// the canvas. If fixRatio is true, this boundary will be enlarged to
357
// prevent anisotropic stretching. (this should be set to false when doing
358
// selections)
359
void
applyGLTransform
(
bool
fixRatio =
true
);
360
361
protected
:
363
GUIMainWindow
*
myApp
;
364
366
GUIGlChildWindow
*
myParent
;
367
369
SUMORTree
*
myGrid
;
370
372
GUIPerspectiveChanger
*
myChanger
;
373
375
bool
myInEditMode
;
376
378
FXint
myWindowCursorPositionX
,
myWindowCursorPositionY
;
379
381
int
myMouseHotspotX
,
myMouseHotspotY
;
382
384
GUIGLObjectPopupMenu
*
myPopup
;
385
386
GUIVisualizationSettings
*
myVisualizationSettings
;
387
388
bool
myUseToolTips
;
389
391
bool
myAmInitialised
;
392
393
394
GUIDialog_EditViewport
*
myViewportChooser
;
395
GUIDialog_ViewSettings
*
myVisualizationChanger
;
396
397
400
402
std::vector<Decal>
myDecals
;
403
405
MFXMutex
myDecalsLock
;
407
408
409
std::map<SUMOTime, std::string>
mySnapshots
;
410
411
mutable
MFXMutex
myPolyDrawLock
;
412
414
std::map<GUIGlObject*, int>
myAdditionallyDrawn
;
415
416
417
protected
:
418
GUISUMOAbstractView
() { }
419
420
};
421
422
423
#endif
424
425
/****************************************************************************/
426
build
buildd
sumo-0.18~dfsg
src
utils
gui
windows
GUISUMOAbstractView.h
Generated on Wed Oct 23 2013 01:15:08 for SUMO - Simulation of Urban MObility by
1.8.4