Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIPerspectiveChanger.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// A virtual class that allows to steer the visual output in dependence to
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
26#include <utils/geom/Boundary.h>
27#include <utils/geom/Position.h>
28#include "GUISUMOAbstractView.h"
29
30
31// ===========================================================================
32// class declarations
33// ===========================================================================
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
51public:
59
61 GUIPerspectiveChanger(GUISUMOAbstractView& callBack, const Boundary& viewPort);
62
64 virtual ~GUIPerspectiveChanger();
65
67
68
69 virtual void onLeftBtnPress(void* data);
70
72 virtual bool onLeftBtnRelease(void* data);
73
75 virtual void onMiddleBtnPress(void* data);
76
78 virtual bool onMiddleBtnRelease(void* data);
79
81 virtual void onRightBtnPress(void* data);
82
84 virtual bool onRightBtnRelease(void* data);
85
87 virtual void onDoubleClicked(void* data);
88
90 virtual void onMouseWheel(void* data);
91
93 virtual void onMouseMove(void* data);
94
96 virtual long onKeyPress(void* data);
97
99 virtual long onKeyRelease(void* data);
101
103 virtual double getRotation() const = 0;
104
106 virtual double getXPos() const = 0;
107
109 virtual double getYPos() const = 0;
110
112 virtual double getZoom() const = 0;
113
115 virtual double getZPos() const = 0;
116
118 virtual double zoom2ZPos(double zoom) const = 0;
119
121 virtual double zPos2Zoom(double zPos) const = 0;
122
124 virtual void centerTo(const Position& pos, double radius, bool applyZoom = true) = 0;
125
127 virtual void setViewport(double zoom, double xPos, double yPos) = 0;
128
130 virtual void setViewportFrom(double xPos, double yPos, double zPos) = 0;
131
133 virtual void setRotation(double rotation) = 0;
134
136 FXint getMouseXPosition() const;
137
139 FXint getMouseYPosition() const;
140
141 /* @brief Adapts the viewport so that a change in canvass size keeps most of the
142 * view intact (by showing more / less instead of zooming)
143 * The canvass is clipped/enlarged on the left side of the screen
144 *
145 * @param[in] change The horizontal change in canvas size in pixels
146 */
147 virtual void changeCanvasSizeLeft(int change) = 0;
148
150 Boundary getViewport(bool fixRatio = true);
151
153 virtual void setViewport(const Boundary& viewPort);
154
155protected:
158
161
164
165
166private:
169
170
171private:
174
177};
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
virtual double zoom2ZPos(double zoom) const =0
Returns the camera height at which the given zoom level is reached.
GUISUMOAbstractView & myCallback
The parent window (canvas to scale)
virtual void setViewportFrom(double xPos, double yPos, double zPos)=0
Alternative method for setting the viewport.
virtual long onKeyPress(void *data)
called when user press a key
virtual void setRotation(double rotation)=0
Sets the rotation.
virtual double zPos2Zoom(double zPos) const =0
Returns the zoom level that is achieved at a given camera height.
virtual void onRightBtnPress(void *data)
called when user press right button
virtual void centerTo(const Position &pos, double radius, bool applyZoom=true)=0
Centers the view to the given position, setting it to a size that covers the radius....
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
virtual ~GUIPerspectiveChanger()
Destructor.
virtual bool onLeftBtnRelease(void *data)
called when user releases left button
Boundary myViewPort
the intended viewport
virtual double getZoom() const =0
Returns the zoom factor computed stored in this changer.
virtual void onLeftBtnPress(void *data)
mouse functions
FXint getMouseXPosition() const
Returns the last mouse x-position an event occurred at.
virtual bool onMiddleBtnRelease(void *data)
called when user releases middle button
GUIPerspectiveChanger(const GUIPerspectiveChanger &)
Invalidated copy constructor.
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual void onDoubleClicked(void *data)
called when user click two times
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual void onMiddleBtnPress(void *data)
called when user press middle button
FXint getMouseYPosition() const
Returns the last mouse y-position an event occurred at.
GUIPerspectiveChanger & operator=(const GUIPerspectiveChanger &)
Invalidated assignment operator.
virtual long onKeyRelease(void *data)
called when user releases a key
Boundary patchedViewPort()
patched viewPort with the same aspect ratio as the canvas
virtual void changeCanvasSizeLeft(int change)=0
FXint myMouseXPosition
the current mouse position
virtual void onMouseMove(void *data)
called when user moves mouse
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
virtual void onMouseWheel(void *data)
called when user changes mouse wheel
virtual bool onRightBtnRelease(void *data)
called when user releases right button
Boundary getViewport(bool fixRatio=true)
get viewport
virtual void setViewport(double zoom, double xPos, double yPos)=0
Sets the viewport Used for: Adapting a new viewport.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37