47 myOrigWidth(viewPort.getWidth()),
48 myOrigHeight(viewPort.getHeight()),
50 myMouseButtonState(MOUSEBTN_NONE),
52 myZoomBase(viewPort.getCenter()),
69 if (
myCallback.getApp()->reg().readIntEntry(
"gui",
"zoomAtCenter", 1)) {
152 FXEvent* e = (FXEvent*) data;
163 FXEvent* e = (FXEvent*) data;
173 FXEvent* e = (FXEvent*) data;
186 FXEvent* e = (FXEvent*) data;
196 FXEvent* e = (FXEvent*) data;
202 const double zScale_rDelta_norm = 0.1;
203 const double zScale_rDelta_inv = -zScale_rDelta_norm / (1. + zScale_rDelta_norm);
204 double zScale_rDelta = zScale_rDelta_norm ;
207 zScale_rDelta = zScale_rDelta_inv;
210 if ((e->state & CONTROLMASK) != 0) {
212 }
else if ((e->state & SHIFTMASK) != 0) {
216 zoom(1.0 + zScale_rDelta);
223 FXEvent* e = (FXEvent*) data;
227 const bool moved = xdiff != 0 || ydiff != 0;
260 double xPos,
double yPos) {
261 const double zoomFactor = zoom / 50;
292 FXEvent* e = (FXEvent*) data;
293 double zoomDiff = 0.1;
296 double moveFactor = 1;
297 bool pageVertical =
true;
299 if (e->state & CONTROLMASK) {
303 }
else if (e->state & SHIFTMASK) {
304 pageVertical =
false;
324 case FX::KEY_Page_Up:
331 case FX::KEY_Page_Down:
341 zoom(1.0 + zoomDiff);
345 case FX::KEY_KP_Subtract:
346 zoomDiff = -zoomDiff;
348 zoom(1.0 + zoomDiff);
352 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.