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