 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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:
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.