![]() |
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. More... | |
void | changeCanvassLeft (int change) |
FXint | getMouseXPosition () const |
Returns the last mouse x-position an event occured at. More... | |
FXint | getMouseYPosition () const |
Returns the last mouse y-position an event occured at. More... | |
virtual SUMOReal | getRotation () const |
Returns the rotation of the canvas stored in this changer. More... | |
Boundary | getViewport (bool fixRatio=true) |
virtual SUMOReal | getXPos () const |
Returns the x-offset of the field to show stored in this changer. More... | |
virtual SUMOReal | getYPos () const |
Returns the y-offset of the field to show stored in this changer. More... | |
virtual SUMOReal | getZoom () const |
Returns the zoom factor computed stored in this changer. More... | |
GUIDanielPerspectiveChanger (GUISUMOAbstractView &callBack, const Boundary &viewPort) | |
long | onKeyPress (void *data) |
virtual long | onKeyRelease (void *data) |
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. More... | |
void | setViewport (const Boundary &viewPort) |
~GUIDanielPerspectiveChanger () | |
Destructor. More... | |
Protected Attributes | |
GUISUMOAbstractView & | myCallback |
The parent window (canvas to scale) More... | |
FXint | myMouseXPosition |
the current mouse position More... | |
FXint | myMouseYPosition |
Boundary | myViewPort |
the intended viewport More... | |
Private Member Functions | |
GUIDanielPerspectiveChanger (const GUIDanielPerspectiveChanger &) | |
Invalidated copy constructor. More... | |
void | move (int xdiff, int ydiff) |
GUIDanielPerspectiveChanger & | operator= (const GUIDanielPerspectiveChanger &) |
Invalidated assignment operator. More... | |
void | rotate (int diff) |
Performs the rotation of the view. More... | |
void | zoom (SUMOReal factor) |
Performs the zooming of the view. More... | |
Private Attributes | |
FXTime | myDragDelay |
avoid flicker More... | |
int | myMouseButtonState |
the current mouse state More... | |
FXTime | myMouseDownTime |
bool | myMoveOnClick |
Information whether the user has moved the cursor while pressing a mouse button. More... | |
SUMOReal | myOrigHeight |
SUMOReal | myOrigWidth |
the original viewport dimensions in m which serve as the reference point for 100% zoom More... | |
SUMOReal | myRotation |
the current rotation More... | |
Position | myZoomBase |
the network location on which to zoom using right click+drag More... | |
This changer has the following behaviour:
Definition at line 58 of file GUIDanielPerspectiveChanger.h.
|
inherited |
Enumerator | |
---|---|
MOUSEBTN_NONE | |
MOUSEBTN_LEFT | |
MOUSEBTN_RIGHT | |
MOUSEBTN_MIDDLE |
Definition at line 62 of file GUIPerspectiveChanger.h.
GUIDanielPerspectiveChanger::GUIDanielPerspectiveChanger | ( | GUISUMOAbstractView & | callBack, |
const Boundary & | viewPort | ||
) |
Definition at line 48 of file GUIDanielPerspectiveChanger.cpp.
GUIDanielPerspectiveChanger::~GUIDanielPerspectiveChanger | ( | ) |
Destructor.
Definition at line 61 of file GUIDanielPerspectiveChanger.cpp.
|
private |
Invalidated copy constructor.
|
virtual |
Centers the view to the given position, setting it to a size that covers the radius.
Implements GUIPerspectiveChanger.
Definition at line 123 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::add(), getXPos(), getYPos(), Boundary::grow(), Boundary::moveby(), GUIPerspectiveChanger::myViewPort, Position::x(), and Position::y().
|
virtual |
Implements GUIPerspectiveChanger.
Definition at line 248 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, GUISUMOAbstractView::p2m(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
|
inherited |
Returns the last mouse x-position an event occured at.
Definition at line 92 of file GUIPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myMouseXPosition.
|
inherited |
Returns the last mouse y-position an event occured at.
Definition at line 98 of file GUIPerspectiveChanger.cpp.
References GUIPerspectiveChanger::myMouseYPosition.
|
virtual |
Returns the rotation of the canvas stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 99 of file GUIDanielPerspectiveChanger.cpp.
References myRotation, and SUMOReal.
|
inlineinherited |
Definition at line 120 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().
|
virtual |
Returns the x-offset of the field to show stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 105 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getCenter(), GUIPerspectiveChanger::myViewPort, SUMOReal, and Position::x().
Referenced by centerTo().
|
virtual |
Returns the y-offset of the field to show stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 111 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getCenter(), GUIPerspectiveChanger::myViewPort, SUMOReal, and Position::y().
Referenced by centerTo().
|
virtual |
Returns the zoom factor computed stored in this changer.
Implements GUIPerspectiveChanger.
Definition at line 117 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getWidth(), myOrigWidth, and GUIPerspectiveChanger::myViewPort.
|
private |
Definition at line 65 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::moveby(), GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, and GUISUMOAbstractView::p2m().
Referenced by onMouseMove(), and setDragDelay().
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 258 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::getHeight(), GUISUMOAbstractView::getPositionInformation(), Boundary::getWidth(), Boundary::moveby(), GUIPerspectiveChanger::myCallback, GUIPerspectiveChanger::myViewPort, myZoomBase, GUISUMOAbstractView::recenterView(), GUISUMOAbstractView::showViewschemeEditor(), SUMOReal, GUISUMOAbstractView::updateToolTip(), and zoom().
|
virtualinherited |
Definition at line 87 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onKeyRelease().
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 136 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_LEFT, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 147 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_LEFT, myMouseButtonState, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 199 of file GUIDanielPerspectiveChanger.cpp.
References GUIVisualizationSettings::gaming, GUICompleteSchemeStorage::getDefault(), gSchemeStorage, GUIPerspectiveChanger::MOUSEBTN_LEFT, GUIPerspectiveChanger::MOUSEBTN_RIGHT, move(), GUIPerspectiveChanger::myCallback, myDragDelay, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, myMoveOnClick, rotate(), GUISUMOAbstractView::setWindowCursorPosition(), GUISUMOAbstractView::updateToolTip(), and zoom().
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 181 of file GUIDanielPerspectiveChanger.cpp.
References GUISUMOAbstractView::getPositionInformation(), GUIPerspectiveChanger::myCallback, myZoomBase, SUMOReal, GUISUMOAbstractView::updateToolTip(), and zoom().
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 157 of file GUIDanielPerspectiveChanger.cpp.
References GUISUMOAbstractView::getPositionInformation(), GUIPerspectiveChanger::MOUSEBTN_RIGHT, GUIPerspectiveChanger::myCallback, myMouseButtonState, myMouseDownTime, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, myMoveOnClick, and myZoomBase.
|
virtual |
Reimplemented from GUIPerspectiveChanger.
Definition at line 169 of file GUIDanielPerspectiveChanger.cpp.
References GUIPerspectiveChanger::MOUSEBTN_RIGHT, myMouseButtonState, GUIPerspectiveChanger::myMouseXPosition, GUIPerspectiveChanger::myMouseYPosition, and myMoveOnClick.
|
private |
Invalidated assignment operator.
|
private |
Performs the rotation of the view.
Definition at line 88 of file GUIDanielPerspectiveChanger.cpp.
References SUMOReal.
Referenced by onMouseMove(), and setDragDelay().
|
inline |
Definition at line 107 of file GUIDanielPerspectiveChanger.h.
References move(), myDragDelay, rotate(), SUMOReal, and zoom().
|
virtual |
Sets the viewport.
Implements GUIPerspectiveChanger.
Definition at line 236 of file GUIDanielPerspectiveChanger.cpp.
References Boundary::add(), Boundary::growHeight(), Boundary::growWidth(), GUIPerspectiveChanger::myCallback, myOrigHeight, myOrigWidth, GUIPerspectiveChanger::myViewPort, and SUMOReal.
|
inlineinherited |
Definition at line 129 of file GUIPerspectiveChanger.h.
References GUIPerspectiveChanger::myViewPort.
|
private |
Performs the zooming of the view.
Definition at line 72 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 onKeyPress(), onMouseMove(), onMouseWheel(), and setDragDelay().
|
protectedinherited |
The parent window (canvas to scale)
Definition at line 136 of file GUIPerspectiveChanger.h.
Referenced by changeCanvassLeft(), move(), onKeyPress(), onMouseMove(), onMouseWheel(), onRightBtnPress(), GUIPerspectiveChanger::patchedViewPort(), setViewport(), and zoom().
|
private |
avoid flicker
Definition at line 141 of file GUIDanielPerspectiveChanger.h.
Referenced by onMouseMove(), and setDragDelay().
|
private |
the current mouse state
Definition at line 132 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
|
private |
Definition at line 142 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onMouseMove(), and onRightBtnPress().
|
protectedinherited |
the current mouse position
Definition at line 139 of file GUIPerspectiveChanger.h.
Referenced by GUIPerspectiveChanger::getMouseXPosition(), onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
|
protectedinherited |
Definition at line 139 of file GUIPerspectiveChanger.h.
Referenced by GUIPerspectiveChanger::getMouseYPosition(), onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
|
private |
Information whether the user has moved the cursor while pressing a mouse button.
Definition at line 135 of file GUIDanielPerspectiveChanger.h.
Referenced by onLeftBtnPress(), onLeftBtnRelease(), onMouseMove(), onRightBtnPress(), and onRightBtnRelease().
|
private |
Definition at line 126 of file GUIDanielPerspectiveChanger.h.
Referenced by setViewport().
|
private |
the original viewport dimensions in m which serve as the reference point for 100% zoom
Definition at line 126 of file GUIDanielPerspectiveChanger.h.
Referenced by getZoom(), and setViewport().
|
private |
the current rotation
Definition at line 129 of file GUIDanielPerspectiveChanger.h.
Referenced by getRotation().
|
protectedinherited |
the intended viewport
Definition at line 142 of file GUIPerspectiveChanger.h.
Referenced by centerTo(), changeCanvassLeft(), GUIPerspectiveChanger::getViewport(), getXPos(), getYPos(), getZoom(), move(), onKeyPress(), GUIPerspectiveChanger::patchedViewPort(), setViewport(), GUIPerspectiveChanger::setViewport(), and zoom().
|
private |
the network location on which to zoom using right click+drag
Definition at line 138 of file GUIDanielPerspectiveChanger.h.
Referenced by onKeyPress(), onMouseWheel(), onRightBtnPress(), and zoom().