39 myOrigWidth(viewPort.getWidth()),
40 myOrigHeight(viewPort.getHeight()),
42 myMouseButtonState(MOUSEBTN_NONE),
44 myZoomBase(viewPort.getCenter()),
61 if (
myCallback.getApp()->reg().readIntEntry(
"gui",
"zoomAtCenter", 0)) {
144 FXEvent* e = (FXEvent*) data;
155 FXEvent* e = (FXEvent*) data;
165 FXEvent* e = (FXEvent*) data;
177 FXEvent* e = (FXEvent*) data;
187 FXEvent* e = (FXEvent*) data;
199 if (data !=
nullptr) {
200 FXEvent* e = (FXEvent*) data;
210 FXEvent* e = (FXEvent*) data;
216 const double zScale_rDelta_norm = 0.1;
217 const double zScale_rDelta_inv = -zScale_rDelta_norm / (1. + zScale_rDelta_norm);
218 double zScale_rDelta = zScale_rDelta_norm ;
221 zScale_rDelta = zScale_rDelta_inv;
224 if ((e->state & CONTROLMASK) != 0) {
226 }
else if ((e->state & SHIFTMASK) != 0) {
230 zoom(1.0 + zScale_rDelta);
237 FXEvent* e = (FXEvent*) data;
241 const bool moved = xdiff != 0 || ydiff != 0;
250 move((
int)diffRot.
x(), (
int)diffRot.
y());
281 double xPos,
double yPos) {
282 const double zoomFactor =
zoom / 50;
318 FXEvent* e = (FXEvent*) data;
319 double zoomDiff = 0.1;
322 double moveFactor = 1;
323 if (e->state & CONTROLMASK) {
326 }
else if (e->state & SHIFTMASK) {
328 }
else if (e->state & ALTMASK) {
351 zoom(1.0 + zoomDiff);
355 case FX::KEY_KP_Subtract:
356 zoomDiff = -zoomDiff;
358 zoom(1.0 + zoomDiff);
362 case FX::KEY_KP_Home:
GUICompleteSchemeStorage gSchemeStorage
A class that stores a 2D geometrical boundary.
Position getCenter() const
Returns the center of the boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void moveby(double x, double y, double z=0)
Moves the boundary by the given amount.
void growHeight(double by)
Increases the height of the boundary (y-axis)
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
double getHeight() const
Returns the height of the boundary (y-axis)
double getWidth() const
Returns the width of the boudary (x-axis)
void growWidth(double by)
Increases the width of the boundary (x-axis)
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
GUIVisualizationSettings & getDefault()
Returns the default scheme.
bool myMoveOnClick
Information whether the user has moved the cursor while pressing a mouse button.
virtual double getRotation() const
Returns the rotation of the canvas stored in this changer.
void changeCanvasSizeLeft(int change)
FXTime myDragDelay
avoid flicker
void onRightBtnPress(void *data)
called when user press right button
int myMouseButtonState
the current mouse state
void onMiddleBtnPress(void *data)
called when user press middle button
virtual double getYPos() const
Returns the y-offset of the field to show stored in this changer.
virtual double getZoom() const
Returns the zoom factor computed stored in this changer.
void onMouseWheel(void *data)
called when user changes mouse wheel
virtual double zoom2ZPos(double zoom) const
Returns the camera height at which the given zoom level is reached.
void onMouseMove(void *data)
called when user moves mouse
double myOrigWidth
the original viewport dimensions in m which serve as the reference point for 100% zoom
virtual double getZPos() const
Returns the camera height corresponding to the current zoom factor.
virtual double getXPos() const
Returns the x-offset of the field to show stored in this changer.
bool onMiddleBtnRelease(void *data)
called when user releases middle button
~GUIDanielPerspectiveChanger()
Destructor.
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.
void setRotation(double rotation)
Sets the rotation.
Position myZoomBase
the network location on which to zoom using right click+drag
double myRotation
the current rotation
void rotate(int diff)
Performs the rotation of the view.
void move(int xdiff, int ydiff)
bool onLeftBtnRelease(void *data)
called when user releases left button
bool onRightBtnRelease(void *data)
called when user releases right button
void onLeftBtnPress(void *data)
mouse functions
GUIDanielPerspectiveChanger(GUISUMOAbstractView &callBack, const Boundary &viewPort)
void zoom(double factor)
Performs the zooming of the view.
void setViewport(double zoom, double xPos, double yPos)
Sets the viewport.
long onKeyPress(void *data)
called when user press a key
virtual double zPos2Zoom(double zPos) const
Returns the zoom level that is achieved at a given camera height.
void setViewportFrom(double xPos, double yPos, double zPos)
Alternative method for setting the viewport.
GUISUMOAbstractView & myCallback
The parent window (canvas to scale)
Boundary myViewPort
the intended viewport
FXint myMouseXPosition
the current mouse position
void updateToolTip()
A method that updates the tooltip.
virtual void recenterView()
recenters the view
double p2m(double pixel) const
pixels-to-meters conversion method
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
bool gaming
whether the application is in gaming mode or not
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
double y() const
Returns the y-position.