 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
40 myOrigWidth(viewPort.getWidth()),
41 myOrigHeight(viewPort.getHeight()),
43 myMouseButtonState(MOUSEBTN_NONE),
45 myZoomBase(viewPort.getCenter()),
62 if (
myCallback.getApp()->reg().readIntEntry(
"gui",
"zoomAtCenter", 0)) {
145 FXEvent* e = (FXEvent*) data;
156 FXEvent* e = (FXEvent*) data;
166 FXEvent* e = (FXEvent*) data;
178 if (data !=
nullptr) {
179 FXEvent* e = (FXEvent*) data;
189 FXEvent* e = (FXEvent*) data;
195 const double zScale_rDelta_norm = 0.1;
196 const double zScale_rDelta_inv = -zScale_rDelta_norm / (1. + zScale_rDelta_norm);
197 double zScale_rDelta = zScale_rDelta_norm ;
200 zScale_rDelta = zScale_rDelta_inv;
203 if ((e->state & CONTROLMASK) != 0) {
205 }
else if ((e->state & SHIFTMASK) != 0) {
209 zoom(1.0 + zScale_rDelta);
216 FXEvent* e = (FXEvent*) data;
220 const bool moved = xdiff != 0 || ydiff != 0;
228 move((
int)diffRot.
x(), (
int)diffRot.
y());
259 double xPos,
double yPos) {
260 const double zoomFactor =
zoom / 50;
296 FXEvent* e = (FXEvent*) data;
297 double zoomDiff = 0.1;
300 double moveFactor = 1;
301 bool pageVertical =
true;
302 if (e->state & CONTROLMASK) {
305 }
else if (e->state & SHIFTMASK) {
306 pageVertical =
false;
326 case FX::KEY_Page_Up:
333 case FX::KEY_Page_Down:
343 zoom(1.0 + zoomDiff);
347 case FX::KEY_KP_Subtract:
348 zoomDiff = -zoomDiff;
350 zoom(1.0 + zoomDiff);
354 case FX::KEY_KP_Home:
void onLeftBtnPress(void *data)
mouse functions
Boundary myViewPort
the intended viewport
void moveby(double x, double y, double z=0)
Moves the boundary by the given amount.
~GUIDanielPerspectiveChanger()
Destructor.
GUIVisualizationSettings & getDefault()
Returns the default scheme.
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
virtual double zPos2Zoom(double zPos) const
Returns the zoom level that is achieved at a given camera height.
double ymin() const
Returns minimum y-coordinate.
virtual double getRotation() const
Returns the rotation of the canvas stored in this changer.
FXTime myDragDelay
avoid flicker
bool onRightBtnRelease(void *data)
called when user releases right button
double xmax() const
Returns maximum x-coordinate.
bool onLeftBtnRelease(void *data)
called when user releases left button
double getHeight() const
Returns the height of the boundary (y-axis)
virtual double getYPos() const
Returns the y-offset of the field to show stored in this changer.
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
void zoom(double factor)
Performs the zooming of the view.
void updateToolTip()
A method that updates the tooltip.
Position myZoomBase
the network location on which to zoom using right click+drag
void onRightBtnPress(void *data)
called when user press right button
void setViewportFrom(double xPos, double yPos, double zPos)
Alternative method for setting the viewport.
double xmin() const
Returns minimum x-coordinate.
int myMouseButtonState
the current mouse state
A class that stores a 2D geometrical boundary.
double getWidth() const
Returns the width of the boudary (x-axis)
A point in 2D or 3D with translation and scaling methods.
GUICompleteSchemeStorage gSchemeStorage
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void move(int xdiff, int ydiff)
void setRotation(double rotation)
Sets the rotation.
void rotate(int diff)
Performs the rotation of the view.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
void growWidth(double by)
Increases the width of the boundary (x-axis)
double y() const
Returns the y-position.
Position getCenter() const
Returns the center of the boundary.
double p2m(double pixel) const
pixels-to-meters conversion method
virtual double zoom2ZPos(double zoom) const
Returns the camera height at which the given zoom level is reached.
FXint myMouseXPosition
the current mouse position
virtual double getZoom() const
Returns the zoom factor computed stored in this changer.
void changeCanvasSizeLeft(int change)
Boundary & grow(double by)
extends the boundary by the given amount
virtual double getZPos() const
Returns the camera height corresponding to the current zoom factor.
virtual void recenterView()
recenters the view
double myRotation
the current rotation
void setViewport(double zoom, double xPos, double yPos)
Sets the viewport.
GUISUMOAbstractView & myCallback
The parent window (canvas to scale)
void onMouseMove(void *data)
called when user moves mouse
bool gaming
whether the application is in gaming mode or not
long onKeyPress(void *data)
called when user press a key
double myOrigWidth
the original viewport dimensions in m which serve as the reference point for 100% zoom
void onMouseWheel(void *data)
called when user changes mouse wheel
void centerTo(const Position &pos, double radius, bool applyZoom=true)
Centers the view to the given position, setting it to a size that covers the radius.
virtual double getXPos() const
Returns the x-offset of the field to show stored in this changer.
bool myMoveOnClick
Information whether the user has moved the cursor while pressing a mouse button.
void growHeight(double by)
Increases the height of the boundary (y-axis)
GUIDanielPerspectiveChanger(GUISUMOAbstractView &callBack, const Boundary &viewPort)
double ymax() const
Returns maximum y-coordinate.