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
GUIPerspectiveChanger.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// A virtual class that allows to steer the visual output in dependence to
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2012 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
#ifndef GUIPerspectiveChanger_h
23
#define GUIPerspectiveChanger_h
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#include <fx.h>
36
#include <
utils/geom/Boundary.h
>
37
#include <
utils/geom/Position.h
>
38
#include "
GUISUMOAbstractView.h
"
39
40
41
// ===========================================================================
42
// class declarations
43
// ===========================================================================
44
class
GUISUMOAbstractView
;
45
46
47
// ===========================================================================
48
// class definitions
49
// ===========================================================================
60
class
GUIPerspectiveChanger
{
61
public
:
62
enum
MouseState
{
63
MOUSEBTN_NONE
= 0,
64
MOUSEBTN_LEFT
= 1,
65
MOUSEBTN_RIGHT
= 2,
66
MOUSEBTN_MIDDLE
= 4
67
};
68
70
GUIPerspectiveChanger
(
GUISUMOAbstractView
& callBack,
const
Boundary
& viewPort);
71
73
virtual
~GUIPerspectiveChanger
();
74
75
virtual
void
onLeftBtnPress
(
void
* data);
76
virtual
bool
onLeftBtnRelease
(
void
* data);
77
virtual
void
onRightBtnPress
(
void
* data);
78
virtual
bool
onRightBtnRelease
(
void
* data);
79
virtual
void
onMouseWheel
(
void
* data);
80
virtual
void
onMouseMove
(
void
* data);
81
83
virtual
SUMOReal
getRotation
()
const
= 0;
84
86
virtual
SUMOReal
getXPos
()
const
= 0;
87
89
virtual
SUMOReal
getYPos
()
const
= 0;
90
92
virtual
SUMOReal
getZoom
()
const
= 0;
93
97
virtual
void
centerTo
(
const
Position
& pos,
SUMOReal
radius,
bool
applyZoom =
true
) = 0;
98
101
virtual
void
setViewport
(
SUMOReal
zoom,
SUMOReal
xPos,
SUMOReal
yPos) = 0;
102
104
FXint
getMouseXPosition
()
const
;
105
107
FXint
getMouseYPosition
()
const
;
108
109
/* @brief Adapts the viewport so that a change in canvass size keeps most of the
110
* view intact (by showing more / less instead of zooming)
111
* The canvass is clipped/enlarged on the left side of the screen
112
*
113
* @param[in] change The horizontal change in canvas size in pixels
114
*/
115
virtual
void
changeCanvassLeft
(
int
change) = 0;
116
117
118
Boundary
getViewport
(
bool
fixRatio =
true
) {
119
if
(fixRatio) {
120
return
patchedViewPort
();
121
}
else
{
122
return
myViewPort
;
123
}
124
}
125
126
127
void
setViewport
(
const
Boundary
& viewPort) {
128
myViewPort
= viewPort;
129
}
130
131
132
protected
:
134
GUISUMOAbstractView
&
myCallback
;
135
137
FXint
myMouseXPosition
,
myMouseYPosition
;
138
140
Boundary
myViewPort
;
141
142
private
:
143
// patched viewPort with the same aspect ratio as the canvas
144
Boundary
patchedViewPort
();
145
};
146
147
148
#endif
149
150
/****************************************************************************/
151
build
buildd
sumo-0.15.0~dfsg
src
utils
gui
windows
GUIPerspectiveChanger.h
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1