Eclipse SUMO - Simulation of Urban MObility
|
#include <GUIPerspectiveChanger.h>
Public Types | |
enum | MouseState { MOUSEBTN_NONE = 0 , MOUSEBTN_LEFT = 1 , MOUSEBTN_RIGHT = 2 , MOUSEBTN_MIDDLE = 4 } |
mouse states More... | |
Public Member Functions | |
virtual void | centerTo (const Position &pos, double radius, bool applyZoom=true)=0 |
Centers the view to the given position, setting it to a size that covers the radius. Used for: Centering of vehicles and junctions */. | |
virtual void | changeCanvasSizeLeft (int change)=0 |
FXint | getMouseXPosition () const |
Returns the last mouse x-position an event occurred at. | |
FXint | getMouseYPosition () const |
Returns the last mouse y-position an event occurred at. | |
virtual double | getRotation () const =0 |
Returns the rotation of the canvas stored in this changer. | |
Boundary | getViewport (bool fixRatio=true) |
get viewport | |
virtual double | getXPos () const =0 |
Returns the x-offset of the field to show stored in this changer. | |
virtual double | getYPos () const =0 |
Returns the y-offset of the field to show stored in this changer. | |
virtual double | getZoom () const =0 |
Returns the zoom factor computed stored in this changer. | |
virtual double | getZPos () const =0 |
Returns the camera height corresponding to the current zoom factor. | |
GUIPerspectiveChanger (GUISUMOAbstractView &callBack, const Boundary &viewPort) | |
Constructor. | |
virtual void | onDoubleClicked (void *data) |
called when user click two times | |
virtual long | onKeyPress (void *data) |
called when user press a key | |
virtual long | onKeyRelease (void *data) |
called when user releases a key | |
virtual void | onLeftBtnPress (void *data) |
mouse functions | |
virtual bool | onLeftBtnRelease (void *data) |
called when user releases left button | |
virtual void | onMiddleBtnPress (void *data) |
called when user press middle button | |
virtual bool | onMiddleBtnRelease (void *data) |
called when user releases middle button | |
virtual void | onMouseMove (void *data) |
called when user moves mouse | |
virtual void | onMouseWheel (void *data) |
called when user changes mouse wheel | |
virtual void | onRightBtnPress (void *data) |
called when user press right button | |
virtual bool | onRightBtnRelease (void *data) |
called when user releases right button | |
virtual void | setRotation (double rotation)=0 |
Sets the rotation. | |
virtual void | setViewport (const Boundary &viewPort) |
set viewport | |
virtual void | setViewport (double zoom, double xPos, double yPos)=0 |
Sets the viewport Used for: Adapting a new viewport. | |
virtual void | setViewportFrom (double xPos, double yPos, double zPos)=0 |
Alternative method for setting the viewport. | |
virtual double | zoom2ZPos (double zoom) const =0 |
Returns the camera height at which the given zoom level is reached. | |
virtual double | zPos2Zoom (double zPos) const =0 |
Returns the zoom level that is achieved at a given camera height. | |
virtual | ~GUIPerspectiveChanger () |
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 | |
GUIPerspectiveChanger (const GUIPerspectiveChanger &) | |
Invalidated copy constructor. | |
GUIPerspectiveChanger & | operator= (const GUIPerspectiveChanger &) |
Invalidated assignment operator. | |
Boundary | patchedViewPort () |
patched viewPort with the same aspect ratio as the canvas | |
This is the interface for implementation of own classes that handle the interaction between the user and a display field. While most of our (IVF) interfaces allow zooming by choosing the rectangle to show, other types of interaction are possible and have been implemented. To differ between the behaviours, all types of interaction between the user and the canvas are send to this class: mouse moving, mouse button pressing and releasing.
Definition at line 50 of file GUIPerspectiveChanger.h.
mouse states
Enumerator | |
---|---|
MOUSEBTN_NONE | |
MOUSEBTN_LEFT | |
MOUSEBTN_RIGHT | |
MOUSEBTN_MIDDLE |
Definition at line 53 of file GUIPerspectiveChanger.h.
GUIPerspectiveChanger::GUIPerspectiveChanger | ( | GUISUMOAbstractView & | callBack, |
const Boundary & | viewPort | ||
) |
Constructor.
Definition at line 31 of file GUIPerspectiveChanger.cpp.
|
virtual |
Destructor.
Definition at line 37 of file GUIPerspectiveChanger.cpp.
|
private |
Invalidated copy constructor.
|
pure virtual |
Centers the view to the given position, setting it to a size that covers the radius. Used for: Centering of vehicles and junctions */.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::centerTo(), and GUISUMOAbstractView::centerTo().
|
pure virtual |
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
FXint GUIPerspectiveChanger::getMouseXPosition | ( | ) | const |
Returns the last mouse x-position an event occurred at.
Definition at line 112 of file GUIPerspectiveChanger.cpp.
References myMouseXPosition.
FXint GUIPerspectiveChanger::getMouseYPosition | ( | ) | const |
Returns the last mouse y-position an event occurred at.
Definition at line 118 of file GUIPerspectiveChanger.cpp.
References myMouseYPosition.
|
pure virtual |
Returns the rotation of the canvas stored in this changer.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::applyGLTransform(), GUISUMOAbstractView::copyViewportTo(), GUIDialog_EditViewport::onCmdLoad(), GUISUMOAbstractView::onMouseMove(), GUISUMOAbstractView::onMouseWheel(), GNEViewNet::saveVisualizationSettings(), GUISUMOAbstractView::screenPos2NetPos(), GUISUMOAbstractView::showViewportEditor(), GUISUMOAbstractView::updateViewportValues(), and GUISUMOAbstractView::~GUISUMOAbstractView().
Boundary GUIPerspectiveChanger::getViewport | ( | bool | fixRatio = true | ) |
get viewport
Definition at line 124 of file GUIPerspectiveChanger.cpp.
References myViewPort, and patchedViewPort().
Referenced by GUISUMOAbstractView::applyGLTransform(), GUISUMOAbstractView::getObjectsInBoundary(), GUISUMOAbstractView::getVisibleBoundary(), GUISUMOAbstractView::m2p(), GUISUMOAbstractView::makeSnapshot(), GUISUMOAbstractView::p2m(), GUISUMOAbstractView::paintGLGrid(), and GUISUMOAbstractView::screenPos2NetPos().
|
pure virtual |
Returns the x-offset of the field to show stored in this changer.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::copyViewportTo(), GUIDialog_EditViewport::onCmdLoad(), GUIApplicationWindow::onCmdOpenInNetedit(), GNEApplicationWindow::onCmdOpenSUMOGUI(), GUISUMOAbstractView::onMouseMove(), GUISUMOAbstractView::onMouseWheel(), GNEViewNet::saveVisualizationSettings(), GUISUMOAbstractView::showViewportEditor(), GUISUMOAbstractView::updateViewportValues(), and GUISUMOAbstractView::~GUISUMOAbstractView().
|
pure virtual |
Returns the y-offset of the field to show stored in this changer.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::copyViewportTo(), GUIDialog_EditViewport::onCmdLoad(), GUIApplicationWindow::onCmdOpenInNetedit(), GNEApplicationWindow::onCmdOpenSUMOGUI(), GUISUMOAbstractView::onMouseMove(), GUISUMOAbstractView::onMouseWheel(), GNEViewNet::saveVisualizationSettings(), GUISUMOAbstractView::showViewportEditor(), GUISUMOAbstractView::updateViewportValues(), and GUISUMOAbstractView::~GUISUMOAbstractView().
|
pure virtual |
Returns the zoom factor computed stored in this changer.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUIDialog_EditViewport::onCmdLoad(), GUISUMOAbstractView::onMouseMove(), GUISUMOAbstractView::onMouseWheel(), GNEViewNet::saveVisualizationSettings(), and GUISUMOAbstractView::updateViewportValues().
|
pure virtual |
Returns the camera height corresponding to the current zoom factor.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::copyViewportTo(), GUIApplicationWindow::onCmdOpenInNetedit(), GNEApplicationWindow::onCmdOpenSUMOGUI(), GUISUMOAbstractView::showViewportEditor(), and GUISUMOAbstractView::~GUISUMOAbstractView().
|
virtual |
called when user click two times
Definition at line 80 of file GUIPerspectiveChanger.cpp.
|
virtual |
called when user press a key
Reimplemented in GUIDanielPerspectiveChanger.
Definition at line 98 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onKeyPress().
|
virtual |
called when user releases a key
Definition at line 105 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onKeyRelease().
|
virtual |
mouse functions
called when user press left button
Reimplemented in GUIDanielPerspectiveChanger.
Definition at line 42 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onLeftBtnPress(), and GNEViewNet::processClick().
|
virtual |
called when user releases left button
Reimplemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Definition at line 48 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onLeftBtnRelease().
|
virtual |
called when user press middle button
Reimplemented in GUIDanielPerspectiveChanger.
Definition at line 55 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onMiddleBtnPress().
|
virtual |
called when user releases middle button
Reimplemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Definition at line 61 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onMiddleBtnRelease().
|
virtual |
called when user moves mouse
Reimplemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Definition at line 92 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onMouseMove().
|
virtual |
called when user changes mouse wheel
Reimplemented in GUIDanielPerspectiveChanger.
Definition at line 86 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onMouseWheel().
|
virtual |
called when user press right button
Reimplemented in GUIDanielPerspectiveChanger.
Definition at line 68 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onRightBtnPress().
|
virtual |
called when user releases right button
Reimplemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Definition at line 74 of file GUIPerspectiveChanger.cpp.
Referenced by GUISUMOAbstractView::onRightBtnRelease(), GUISUMOAbstractView::openPopupDialog(), and GUISUMOAbstractView::replacePopup().
|
private |
Invalidated assignment operator.
|
private |
patched viewPort with the same aspect ratio as the canvas
Definition at line 140 of file GUIPerspectiveChanger.cpp.
References Boundary::getHeight(), Boundary::getWidth(), Boundary::growHeight(), Boundary::growWidth(), myCallback, and myViewPort.
Referenced by getViewport().
|
pure virtual |
Sets the rotation.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::setViewportFromToRot().
|
virtual |
set viewport
Reimplemented in GUIOSGPerspectiveChanger.
Definition at line 134 of file GUIPerspectiveChanger.cpp.
References myViewPort.
|
pure virtual |
Sets the viewport Used for: Adapting a new viewport.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::centerTo(), GUISUMOAbstractView::centerTo(), GUISUMOAbstractView::getObjectsInBoundary(), and GUISUMOAbstractView::recenterView().
|
pure virtual |
Alternative method for setting the viewport.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISUMOAbstractView::setViewportFromToRot().
|
pure virtual |
Returns the camera height at which the given zoom level is reached.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUISettingsHandler::applyViewport(), GUIDialog_EditViewport::onCmdChanged(), and GUIDialog_EditViewport::setValues().
|
pure virtual |
Returns the zoom level that is achieved at a given camera height.
Implemented in GUIOSGPerspectiveChanger, and GUIDanielPerspectiveChanger.
Referenced by GUIDialog_EditViewport::onCmdChanged(), and GUIDialog_EditViewport::setValues().
|
protected |
The parent window (canvas to scale)
Definition at line 157 of file GUIPerspectiveChanger.h.
Referenced by GUIOSGPerspectiveChanger::centerTo(), GUIDanielPerspectiveChanger::changeCanvasSizeLeft(), GUIOSGPerspectiveChanger::getPositionOnGround(), GUIDanielPerspectiveChanger::move(), GUIDanielPerspectiveChanger::onKeyPress(), GUIDanielPerspectiveChanger::onMiddleBtnPress(), GUIDanielPerspectiveChanger::onMouseMove(), GUIDanielPerspectiveChanger::onMouseWheel(), GUIDanielPerspectiveChanger::onRightBtnPress(), patchedViewPort(), GUIDanielPerspectiveChanger::setViewport(), and GUIDanielPerspectiveChanger::zoom().
|
protected |
the current mouse position
Definition at line 160 of file GUIPerspectiveChanger.h.
Referenced by getMouseXPosition(), GUIDanielPerspectiveChanger::onLeftBtnPress(), GUIDanielPerspectiveChanger::onLeftBtnRelease(), GUIDanielPerspectiveChanger::onMiddleBtnPress(), GUIDanielPerspectiveChanger::onMiddleBtnRelease(), GUIDanielPerspectiveChanger::onMouseMove(), GUIDanielPerspectiveChanger::onRightBtnPress(), and GUIDanielPerspectiveChanger::onRightBtnRelease().
|
protected |
Definition at line 160 of file GUIPerspectiveChanger.h.
Referenced by getMouseYPosition(), GUIDanielPerspectiveChanger::onLeftBtnPress(), GUIDanielPerspectiveChanger::onLeftBtnRelease(), GUIDanielPerspectiveChanger::onMiddleBtnPress(), GUIDanielPerspectiveChanger::onMiddleBtnRelease(), GUIDanielPerspectiveChanger::onMouseMove(), GUIDanielPerspectiveChanger::onRightBtnPress(), and GUIDanielPerspectiveChanger::onRightBtnRelease().
|
protected |
the intended viewport
Definition at line 163 of file GUIPerspectiveChanger.h.
Referenced by GUIDanielPerspectiveChanger::centerTo(), GUIDanielPerspectiveChanger::changeCanvasSizeLeft(), getViewport(), GUIDanielPerspectiveChanger::getXPos(), GUIDanielPerspectiveChanger::getYPos(), GUIDanielPerspectiveChanger::getZoom(), GUIDanielPerspectiveChanger::getZPos(), GUIDanielPerspectiveChanger::move(), GUIDanielPerspectiveChanger::onKeyPress(), patchedViewPort(), setViewport(), GUIDanielPerspectiveChanger::setViewport(), GUIOSGPerspectiveChanger::updateViewport(), and GUIDanielPerspectiveChanger::zoom().