SUMO - Simulation of Urban MObility
|
#include <GUIDanielPerspectiveChanger.h>
Public Types | |
enum | MouseState { MOUSEBTN_NONE = 0, MOUSEBTN_LEFT = 1, MOUSEBTN_RIGHT = 2, MOUSEBTN_MIDDLE = 4 } |
Public Member Functions | |
void | centerTo (const Position &pos, SUMOReal radius, bool applyZoom=true) |
Centers the view to the given position, setting it to a size that covers the radius. | |
void | changeCanvassLeft (int change) |
FXint | getMouseXPosition () const |
Returns the last mouse x-position an event occured at. | |
FXint | getMouseYPosition () const |
Returns the last mouse y-position an event occured at. | |
virtual SUMOReal | getRotation () const |
Returns the rotation of the canvas stored in this changer. | |
Boundary | getViewport (bool fixRatio=true) |
virtual SUMOReal | getXPos () const |
Returns the x-offset of the field to show stored in this changer. | |
virtual SUMOReal | getYPos () const |
Returns the y-offset of the field to show stored in this changer. | |
virtual SUMOReal | getZoom () const |
Returns the zoom factor computed stored in this changer. | |
GUIDanielPerspectiveChanger (GUISUMOAbstractView &callBack, const Boundary &viewPort) | |
void | onLeftBtnPress (void *data) |
bool | onLeftBtnRelease (void *data) |
void | onMouseMove (void *data) |
void | onMouseWheel (void *data) |
void | onRightBtnPress (void *data) |
bool | onRightBtnRelease (void *data) |
void | setDragDelay (FXTime delay) |
void | setViewport (SUMOReal zoom, SUMOReal xPos, SUMOReal yPos) |
Sets the viewport. | |
void | setViewport (const Boundary &viewPort) |
~GUIDanielPerspectiveChanger () | |
Destructor. | |
Protected Attributes | |
GUISUMOAbstractView & | myCallback |
The parent window (canvas to scale) | |
FXint | myMouseXPosition |
the current mouse position | |
FXint | myMouseYPosition |
Boundary | myViewPort |
the intended viewport | |
Private Member Functions | |
void | move (int xdiff, int ydiff) |
void | rotate (int diff) |
Performs the rotation of the view. | |
void | zoom (SUMOReal factor) |
Performs the zooming of the view. | |
Private Attributes | |
FXTime | myDragDelay |
avoid flicker | |
int | myMouseButtonState |
the current mouse state | |
FXTime | myMouseDownTime |
bool | myMoveOnClick |
Information whether the user has moved the cursor while pressing a mouse button. | |
SUMOReal | myOrigHeight |
SUMOReal | myOrigWidth |
the original viewport dimensions in m which serve as the reference point for 100% zoom | |
SUMOReal | myRotation |
the current rotation | |
Position | myZoomBase |
the network location on which to zoom using right click+drag |
This changer has the following behaviour:
Definition at line 58 of file GUIDanielPerspectiveChanger.h.
enum GUIPerspectiveChanger::MouseState [inherited] |
Definition at line 62 of file GUIPerspectiveChanger.h.
GUIDanielPerspectiveChanger::GUIDanielPerspectiveChanger | ( | GUISUMOAbstractView & | callBack, |
const Boundary & | viewPort | ||
) |
Definition at line 47 of file GUIDanielPerspectiveChanger.cpp.
Destructor.
Definition at line 58 of file GUIDanielPerspectiveChanger.cpp.
void GUIDanielPerspectiveChanger::centerTo | ( | const Position & | pos, |
SUMOReal | radius, | ||
bool | applyZoom = true |
||
) | [virtual] |
Centers the view to the given position, setting it to a size that covers the radius.
Implements GUIPerspectiveChanger.
Definition at line 118 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::add(), getXPos(), getYPos(), Boundary::grow(), Boundary::moveby(), GUIPerspectiveChanger::myViewPort, Position::x(), and Position::y().
void GUIDanielPerspectiveChanger::changeCanvassLeft | ( | int | change | ) | [virtual] |
Implements GUIPerspectiveChanger.
Definition at line 243 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, GUISUMOAbstractView::p2m(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
FXint GUIPerspectiveChanger::getMouseXPosition | ( | ) | const [inherited] |
Returns the last mouse x-position an event occured at.
Definition at line 83 of file GUIPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myMouseXPosition.
FXint GUIPerspectiveChanger::getMouseYPosition | ( | ) | const [inherited] |
Returns the last mouse y-position an event occured at.
Definition at line 89 of file GUIPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myMouseYPosition.
SUMOReal GUIDanielPerspectiveChanger::getRotation | ( | ) | const [virtual] |
Returns the rotation of the canvas stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 94 of file GUIDanielPerspectiveChanger.cpp.
References myRotation.
Boundary GUIPerspectiveChanger::getViewport | ( | bool | fixRatio = true | ) | [inline, inherited] |
Definition at line 118 of file GUIPerspectiveChanger.h.
References GUIPerspectiveChanger::myViewPort, and GUIPerspectiveChanger::patchedViewPort().
Referenced by GUISUMOAbstractView::applyGLTransform(), GUISUMOAbstractView::getObjectsInBoundary(), GUISUMOAbstractView::getPositionInformation(), GUISUMOAbstractView::getVisibleBoundary(), GUISUMOAbstractView::m2p(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::p2m(), and GUISUMOAbstractView::paintGL().
SUMOReal GUIDanielPerspectiveChanger::getXPos | ( | ) | const [virtual] |
Returns the x-offset of the field to show stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 100 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getCenter(), GUIPerspectiveChanger::myViewPort, and Position::x().
Referenced by centerTo().
SUMOReal GUIDanielPerspectiveChanger::getYPos | ( | ) | const [virtual] |
Returns the y-offset of the field to show stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 106 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getCenter(), GUIPerspectiveChanger::myViewPort, and Position::y().
Referenced by centerTo().
SUMOReal GUIDanielPerspectiveChanger::getZoom | ( | ) | const [virtual] |
Returns the zoom factor computed stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 112 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getWidth(), myOrigWidth, and GUIPerspectiveChanger::myViewPort.
void GUIDanielPerspectiveChanger::move | ( | int | xdiff, |
int | ydiff | ||
) | [private] |
Definition at line 62 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::moveby(), GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, and GUISUMOAbstractView::p2m().
Referenced by onMouseMove().
void GUIDanielPerspectiveChanger::onLeftBtnPress | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 131 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_LEFT, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
bool GUIDanielPerspectiveChanger::onLeftBtnRelease | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 142 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_LEFT, myMouseButtonState, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
void GUIDanielPerspectiveChanger::onMouseMove | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 194 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_LEFT, GUIPerspectiveChanger::MOUSEBTN_RIGHT, move(), GUIPerspectiveChanger::myCallback, myDragDelay, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, myMoveOnClick, rotate(), GUISUMOAbstractView::setWindowCursorPosition(), GUISUMOAbstractView::updateToolTip(), and zoom().
void GUIDanielPerspectiveChanger::onMouseWheel | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 176 of file GUIDanielPerspectiveChanger.cpp.
References GUISUMOAbstractView::getPositionInformation(), GUIPerspectiveChanger::myCallback, myZoomBase, SUMOReal, GUISUMOAbstractView::updateToolTip(), and zoom().
void GUIDanielPerspectiveChanger::onRightBtnPress | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 152 of file GUIDanielPerspectiveChanger.cpp.
References GUISUMOAbstractView::getPositionInformation(), GUIPerspectiveChanger::MOUSEBTN_RIGHT, GUIPerspectiveChanger::myCallback, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, myMoveOnClick, and myZoomBase.
bool GUIDanielPerspectiveChanger::onRightBtnRelease | ( | void * | data | ) | [virtual] |
Reimplemented from GUIPerspectiveChanger.
Definition at line 164 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_RIGHT, myMouseButtonState, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
void GUIDanielPerspectiveChanger::rotate | ( | int | diff | ) | [private] |
Performs the rotation of the view.
Definition at line 85 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myCallback, myRotation, and SUMOReal.
Referenced by onMouseMove().
void GUIDanielPerspectiveChanger::setDragDelay | ( | FXTime | delay | ) | [inline] |
Definition at line 106 of file GUIDanielPerspectiveChanger.h.
References myDragDelay.
void GUIDanielPerspectiveChanger::setViewport | ( | SUMOReal | zoom, |
SUMOReal | xPos, | ||
SUMOReal | yPos | ||
) | [virtual] |
Sets the viewport.
Implements GUIPerspectiveChanger.
Definition at line 231 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::add(), Boundary::growHeight(), Boundary::growWidth(), GUIPerspectiveChanger::myCallback, myOrigHeight, myOrigWidth, GUIPerspectiveChanger::myViewPort, and SUMOReal.
void GUIPerspectiveChanger::setViewport | ( | const Boundary & | viewPort | ) | [inline, inherited] |
Definition at line 127 of file GUIPerspectiveChanger.h.
References GUIPerspectiveChanger::myViewPort.
void GUIDanielPerspectiveChanger::zoom | ( | SUMOReal | factor | ) | [private] |
Performs the zooming of the view.
Definition at line 69 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getCenter(), GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, myZoomBase, Position::x(), Boundary::xmax(), Boundary::xmin(), Position::y(), Boundary::ymax(), and Boundary::ymin().
Referenced by onMouseMove(), and onMouseWheel().
GUISUMOAbstractView& GUIPerspectiveChanger::myCallback [protected, inherited] |
The parent window (canvas to scale)
Definition at line 134 of file GUIPerspectiveChanger.h.
Referenced by changeCanvassLeft(), move(), onMouseMove(), onMouseWheel(), onRightBtnPress(), GUIPerspectiveChanger::patchedViewPort(), rotate(), setViewport(), and zoom().
FXTime GUIDanielPerspectiveChanger::myDragDelay [private] |
avoid flicker
Definition at line 140 of file GUIDanielPerspectiveChanger.h.
Referenced by onMouseMove(), and setDragDelay().
the current mouse state
Definition at line 131 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
FXTime GUIDanielPerspectiveChanger::myMouseDownTime [private] |
Definition at line 141 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onMouseMove(), and onRightBtnPress().
FXint GUIPerspectiveChanger::myMouseXPosition [protected, inherited] |
the current mouse position
Definition at line 137 of file GUIPerspectiveChanger.h.
Referenced by GUIPerspectiveChanger::getMouseXPosition(), onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
FXint GUIPerspectiveChanger::myMouseYPosition [protected, inherited] |
Definition at line 137 of file GUIPerspectiveChanger.h.
Referenced by GUIPerspectiveChanger::getMouseYPosition(), onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
Information whether the user has moved the cursor while pressing a mouse button.
Definition at line 134 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
Definition at line 125 of file GUIDanielPerspectiveChanger.h.
Referenced by setViewport().
the original viewport dimensions in m which serve as the reference point for 100% zoom
Definition at line 125 of file GUIDanielPerspectiveChanger.h.
Referenced by getZoom(), and setViewport().
the current rotation
Definition at line 128 of file GUIDanielPerspectiveChanger.h.
Referenced by getRotation(), and rotate().
Boundary GUIPerspectiveChanger::myViewPort [protected, inherited] |
the intended viewport
Definition at line 140 of file GUIPerspectiveChanger.h.
Referenced by centerTo(), changeCanvassLeft(), GUIPerspectiveChanger::getViewport(), getXPos(), getYPos(), getZoom(), move(), GUIPerspectiveChanger::patchedViewPort(), setViewport(), GUIPerspectiveChanger::setViewport(), and zoom().
the network location on which to zoom using right click+drag
Definition at line 137 of file GUIDanielPerspectiveChanger.h.
Referenced by onMouseWheel(), onRightBtnPress(), and zoom().