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.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 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
#include <fx3d.h>
41
#include <
utils/foxtools/MFXMutex.h
>
42
#include <
utils/geom/Boundary.h
>
43
#include <
utils/geom/Position.h
>
44
#include <
utils/common/RGBColor.h
>
45
#include <
utils/common/SUMOTime.h
>
46
#include <
utils/shapes/Polygon.h
>
47
#include <
utils/gui/globjects/GUIGlObjectTypes.h
>
48
#include <
foreign/rtree/SUMORTree.h
>
49
50
51
// ===========================================================================
52
// class declarations
53
// ===========================================================================
54
class
GUIGlChildWindow
;
55
class
GUIVehicle
;
56
class
GUIPerspectiveChanger
;
57
class
GUIMainWindow
;
58
class
GUIGLObjectPopupMenu
;
59
class
GUIGlObject
;
60
class
GUIDialog_EditViewport
;
61
class
GUIDialog_ViewSettings
;
62
class
GUIVisualizationSettings
;
63
64
65
// ===========================================================================
66
// class definitions
67
// ===========================================================================
74
class
GUISUMOAbstractView
:
public
FXGLCanvas
{
75
FXDECLARE(
GUISUMOAbstractView
)
76
public
:
78
GUISUMOAbstractView
(FXComposite* p,
GUIMainWindow
& app,
79
GUIGlChildWindow
* parent,
const
SUMORTree
& grid,
80
FXGLVisual* glVis,
FXGLCanvas
* share);
81
83
virtual
~GUISUMOAbstractView
();
84
86
virtual
void
buildViewToolBars
(
GUIGlChildWindow
&) { }
87
89
void
recenterView
();
90
97
void
centerTo
(
GUIGlID
id
,
bool
applyZoom,
SUMOReal
zoomDist = 20);
98
100
void
centerTo
(
const
Boundary
& bound);
101
103
virtual
void
setViewport
(
SUMOReal
zoom,
SUMOReal
xPos,
SUMOReal
yPos);
104
106
SUMOReal
m2p
(
SUMOReal
meter)
const
;
107
109
SUMOReal
p2m
(
SUMOReal
pixel)
const
;
110
112
// bool allowRotation() const;
113
115
void
setWindowCursorPosition
(FXint x, FXint y);
116
118
FXbool
makeCurrent
();
119
121
bool
isInEditMode
();
122
123
GUIPerspectiveChanger
&
getChanger
()
const
{
124
return
*
myChanger
;
125
}
126
127
Boundary
getVisibleBoundary
()
const
;
128
129
virtual
long
onConfigure
(
FXObject
*, FXSelector,
void
*);
130
virtual
long
onPaint
(
FXObject
*, FXSelector,
void
*);
131
virtual
long
onLeftBtnPress
(
FXObject
*, FXSelector,
void
*);
132
virtual
long
onLeftBtnRelease
(
FXObject
*, FXSelector,
void
*);
133
virtual
long
onRightBtnPress
(
FXObject
*, FXSelector,
void
*);
134
virtual
long
onRightBtnRelease
(
FXObject
*, FXSelector,
void
*);
135
virtual
long
onMouseWheel
(
FXObject
*, FXSelector,
void
*);
136
virtual
long
onMouseMove
(
FXObject
*, FXSelector,
void
*);
137
virtual
long
onMouseLeft
(
FXObject
*, FXSelector,
void
*);
138
139
virtual
long
onKeyPress
(
FXObject
* o, FXSelector sel,
void
* data);
140
virtual
long
onKeyRelease
(
FXObject
* o, FXSelector sel,
void
* data);
141
142
143
virtual
void
openObjectDialog
();
144
146
void
updateToolTip
();
147
148
151
155
void
setSnapshots
(std::map<SUMOTime, std::string> snaps);
156
157
164
std::string
makeSnapshot
(
const
std::string& destFile);
165
166
169
void
checkSnapshots
();
170
172
virtual
SUMOTime
getCurrentTimeStep
()
const
{
173
return
0;
174
}
176
177
178
179
void
showViewportEditor
();
180
virtual
void
showViewschemeEditor
() = 0;
181
void
showToolTips
(
bool
val);
182
virtual
bool
setColorScheme
(
const
std::string&) {
183
return
true
;
184
}
185
186
void
remove
(
GUIDialog_EditViewport
*) {
187
myViewportChooser
= 0;
188
}
189
190
void
remove
(
GUIDialog_ViewSettings
*) {
191
myVisualizationChanger
= 0;
192
}
193
194
195
// @todo: check why this is here
196
SUMOReal
getGridWidth
()
const
;
197
// @todo: check why this is here
198
SUMOReal
getGridHeight
()
const
;
199
200
virtual
void
startTrack
(
int
/*id*/
) { }
201
virtual
void
stopTrack
() { }
202
virtual
int
getTrackedID
()
const
{
203
return
-1;
204
}
205
206
virtual
void
onGamingClick
(
Position
/*pos*/
) { }
207
210
216
bool
addAdditionalGLVisualisation
(
GUIGlObject
*
const
which);
217
218
224
bool
removeAdditionalGLVisualisation
(
GUIGlObject
*
const
which);
226
227
229
void
destroyPopup
();
230
231
232
public
:
237
enum
JunctionColoringScheme
{
239
VCS_BY_TYPE
= 0
240
};
241
242
246
struct
Decal
{
248
Decal
()
249
:
filename
(),
centerX
(0),
centerY
(0),
250
width
(1000),
height
(1000),
rot
(0),
251
initialised
(false),
glID
(-1) { }
252
254
std::string
filename
;
256
SUMOReal
centerX
;
258
SUMOReal
centerY
;
260
SUMOReal
width
;
262
SUMOReal
height
;
264
SUMOReal
rot
;
266
bool
initialised
;
268
int
glID
;
269
};
270
271
272
public
:
273
FXComboBox&
getColoringSchemesCombo
();
274
275
279
Position
getPositionInformation
()
const
;
280
281
void
addDecals
(
const
std::vector<Decal> &decals) {
282
myDecals
.insert(
myDecals
.end(), decals.begin(), decals.end());
283
}
284
285
286
const
GUIVisualizationSettings
*
getVisualisationSettings
() {
287
return
myVisualizationSettings
;
288
}
289
290
291
protected
:
293
void
paintGL
();
294
295
void
updatePositionInformation
()
const
;
296
297
298
virtual
int
doPaintGL
(
int
/*mode*/
,
const
Boundary
&
/*boundary*/
) {
299
return
0;
300
}
301
302
virtual
void
doInit
() { }
303
305
void
paintGLGrid
();
306
311
void
displayLegend
();
312
313
315
GUIGlID
getObjectUnderCursor
();
316
318
GUIGlID
getObjectAtPosition
(
Position
pos);
319
321
std::vector<GUIGlID>
getObjectsInBoundary
(
const
Boundary
& bound);
322
324
void
showToolTipFor
(
unsigned
int
id
);
325
326
327
protected
:
330
void
drawDecals
();
331
332
// applies gl-transformations to fit the Boundary given by myChanger onto
333
// the canvas. If fixRatio is true, this boundary will be enlarged to
334
// prevent anisotropic stretching. (this should be set to false when doing
335
// selections)
336
void
applyGLTransform
(
bool
fixRatio =
true
);
337
338
protected
:
340
GUIMainWindow
*
myApp
;
341
343
GUIGlChildWindow
*
myParent
;
344
346
SUMORTree
*
myGrid
;
347
349
GUIPerspectiveChanger
*
myChanger
;
350
352
bool
myInEditMode
;
353
355
FXint
myWindowCursorPositionX
,
myWindowCursorPositionY
;
356
358
int
myMouseHotspotX
,
myMouseHotspotY
;
359
361
GUIGLObjectPopupMenu
*
myPopup
;
362
363
GUIVisualizationSettings
*
myVisualizationSettings
;
364
365
bool
myUseToolTips
;
366
368
bool
myAmInitialised
;
369
370
371
GUIDialog_EditViewport
*
myViewportChooser
;
372
GUIDialog_ViewSettings
*
myVisualizationChanger
;
373
374
377
379
std::vector<Decal>
myDecals
;
380
382
MFXMutex
myDecalsLock
;
384
385
386
std::map<SUMOTime, std::string>
mySnapshots
;
387
388
mutable
MFXMutex
myPolyDrawLock
;
389
391
std::map<GUIGlObject*, int>
myAdditionallyDrawn
;
392
393
394
protected
:
395
GUISUMOAbstractView
() { }
396
397
};
398
399
400
#endif
401
402
/****************************************************************************/
403
build
buildd
sumo-0.15.0~dfsg
src
utils
gui
windows
GUISUMOAbstractView.h
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1