46 myOrigWidth(viewPort.getWidth()),
47 myOrigHeight(viewPort.getHeight()),
49 myMouseButtonState(MOUSEBTN_NONE),
51 myZoomBase(viewPort.getCenter()),
68 if (
myCallback.getApp()->reg().readIntEntry(
"gui",
"zoomAtCenter", 1)) {
151 FXEvent* e = (FXEvent*) data;
162 FXEvent* e = (FXEvent*) data;
172 FXEvent* e = (FXEvent*) data;
185 FXEvent* e = (FXEvent*) data;
195 FXEvent* e = (FXEvent*) data;
201 const double zScale_rDelta_norm = 0.1;
202 const double zScale_rDelta_inv = -zScale_rDelta_norm / (1. + zScale_rDelta_norm);
203 double zScale_rDelta = zScale_rDelta_norm ;
206 zScale_rDelta = zScale_rDelta_inv;
209 if ((e->state & CONTROLMASK) != 0) {
211 }
else if ((e->state & SHIFTMASK) != 0) {
215 zoom(1.0 + zScale_rDelta);
222 FXEvent* e = (FXEvent*) data;
226 const bool moved = xdiff != 0 || ydiff != 0;
259 double xPos,
double yPos) {
260 const double zoomFactor = zoom / 50;
291 FXEvent* e = (FXEvent*) data;
292 double zoomDiff = 0.1;
295 double moveFactor = 1;
296 bool pageVertical =
true;
298 if (e->state & CONTROLMASK) {
302 }
else if (e->state & SHIFTMASK) {
303 pageVertical =
false;
323 case FX::KEY_Page_Up:
330 case FX::KEY_Page_Down:
340 zoom(1.0 + zoomDiff);
344 case FX::KEY_KP_Subtract:
345 zoomDiff = -zoomDiff;
347 zoom(1.0 + zoomDiff);
351 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 ...
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)
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 information whether rotation is allowd.
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 showViewschemeEditor()
show viewsscheme editor
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.