SUMO - Simulation of Urban MObility
GUIPerspectiveChanger Class Referenceabstract

#include <GUIPerspectiveChanger.h>

Inheritance diagram for GUIPerspectiveChanger:
Inheritance graph
Collaboration diagram for GUIPerspectiveChanger:
Collaboration graph

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 */. More...
 
virtual void changeCanvasSizeLeft (int change)=0
 
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 double getRotation () const =0
 Returns the rotation of the canvas stored in this changer. More...
 
Boundary getViewport (bool fixRatio=true)
 get viewport More...
 
virtual double getXPos () const =0
 Returns the x-offset of the field to show stored in this changer. More...
 
virtual double getYPos () const =0
 Returns the y-offset of the field to show stored in this changer. More...
 
virtual double getZoom () const =0
 Returns the zoom factor computed stored in this changer. More...
 
virtual double getZPos () const =0
 Returns the camera height corresponding to the current zoom factor. More...
 
 GUIPerspectiveChanger (GUISUMOAbstractView &callBack, const Boundary &viewPort)
 Constructor. More...
 
virtual void setViewport (double zoom, double xPos, double yPos)=0
 Sets the viewport Used for: Adapting a new viewport. More...
 
void setViewport (const Boundary &viewPort)
 set viewport More...
 
virtual void setViewportFrom (double xPos, double yPos, double zPos)=0
 Alternative method for setting the viewport. More...
 
virtual double zoom2ZPos (double zoom) const =0
 Returns the camera height at which the given zoom level is reached. More...
 
virtual double zPos2Zoom (double zPos) const =0
 Returns the zoom level that is achieved at a given camera height. More...
 
virtual ~GUIPerspectiveChanger ()
 Destructor. More...
 
virtual void onLeftBtnPress (void *data)
 mouse functions More...
 
virtual bool onLeftBtnRelease (void *data)
 called when user releases left button More...
 
virtual void onRightBtnPress (void *data)
 called when user press right button More...
 
virtual bool onRightBtnRelease (void *data)
 called when user releases right button More...
 
virtual void onDoubleClicked (void *data)
 called when user click two times More...
 
virtual void onMouseWheel (void *data)
 called when user changes mouse wheel More...
 
virtual void onMouseMove (void *data)
 called when user moves mouse More...
 
virtual long onKeyPress (void *data)
 called when user press a key More...
 
virtual long onKeyRelease (void *data)
 called when user releases a key More...
 

Protected Attributes

GUISUMOAbstractViewmyCallback
 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

 GUIPerspectiveChanger (const GUIPerspectiveChanger &)
 Invalidated copy constructor. More...
 
GUIPerspectiveChangeroperator= (const GUIPerspectiveChanger &)
 Invalidated assignment operator. More...
 
Boundary patchedViewPort ()
 patched viewPort with the same aspect ratio as the canvas More...
 

Detailed Description

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 60 of file GUIPerspectiveChanger.h.

Member Enumeration Documentation

◆ MouseState

mouse states

Enumerator
MOUSEBTN_NONE 
MOUSEBTN_LEFT 
MOUSEBTN_RIGHT 
MOUSEBTN_MIDDLE 

Definition at line 63 of file GUIPerspectiveChanger.h.

Constructor & Destructor Documentation

◆ GUIPerspectiveChanger() [1/2]

GUIPerspectiveChanger::GUIPerspectiveChanger ( GUISUMOAbstractView callBack,
const Boundary viewPort 
)

Constructor.

Definition at line 40 of file GUIPerspectiveChanger.cpp.

◆ ~GUIPerspectiveChanger()

GUIPerspectiveChanger::~GUIPerspectiveChanger ( )
virtual

Destructor.

Definition at line 46 of file GUIPerspectiveChanger.cpp.

◆ GUIPerspectiveChanger() [2/2]

GUIPerspectiveChanger::GUIPerspectiveChanger ( const GUIPerspectiveChanger )
private

Invalidated copy constructor.

Member Function Documentation

◆ centerTo()

virtual void GUIPerspectiveChanger::centerTo ( const Position pos,
double  radius,
bool  applyZoom = true 
)
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 GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::centerTo().

◆ changeCanvasSizeLeft()

virtual void GUIPerspectiveChanger::changeCanvasSizeLeft ( int  change)
pure virtual

Implemented in GUIDanielPerspectiveChanger.

◆ getMouseXPosition()

FXint GUIPerspectiveChanger::getMouseXPosition ( ) const

Returns the last mouse x-position an event occured at.

Definition at line 99 of file GUIPerspectiveChanger.cpp.

References myMouseXPosition.

◆ getMouseYPosition()

FXint GUIPerspectiveChanger::getMouseYPosition ( ) const

Returns the last mouse y-position an event occured at.

Definition at line 105 of file GUIPerspectiveChanger.cpp.

References myMouseYPosition.

◆ getRotation()

virtual double GUIPerspectiveChanger::getRotation ( ) const
pure virtual

Returns the rotation of the canvas stored in this changer.

Implemented in GUIDanielPerspectiveChanger.

◆ getViewport()

◆ getXPos()

◆ getYPos()

◆ getZoom()

virtual double GUIPerspectiveChanger::getZoom ( ) const
pure virtual

◆ getZPos()

virtual double GUIPerspectiveChanger::getZPos ( ) const
pure virtual

◆ onDoubleClicked()

void GUIPerspectiveChanger::onDoubleClicked ( void *  data)
virtual

called when user click two times

Definition at line 72 of file GUIPerspectiveChanger.cpp.

◆ onKeyPress()

long GUIPerspectiveChanger::onKeyPress ( void *  data)
virtual

called when user press a key

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 87 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onKeyPress().

◆ onKeyRelease()

long GUIPerspectiveChanger::onKeyRelease ( void *  data)
virtual

called when user releases a key

Definition at line 93 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onKeyRelease().

◆ onLeftBtnPress()

void GUIPerspectiveChanger::onLeftBtnPress ( void *  data)
virtual

mouse functions

called when user press left button

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 51 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onLeftBtnPress(), and GNEViewNet::processClick().

◆ onLeftBtnRelease()

bool GUIPerspectiveChanger::onLeftBtnRelease ( void *  data)
virtual

called when user releases left button

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 56 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onLeftBtnRelease().

◆ onMouseMove()

void GUIPerspectiveChanger::onMouseMove ( void *  data)
virtual

called when user moves mouse

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 82 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onMouseMove().

◆ onMouseWheel()

void GUIPerspectiveChanger::onMouseWheel ( void *  data)
virtual

called when user changes mouse wheel

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 77 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onMouseWheel().

◆ onRightBtnPress()

void GUIPerspectiveChanger::onRightBtnPress ( void *  data)
virtual

called when user press right button

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 62 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onRightBtnPress().

◆ onRightBtnRelease()

bool GUIPerspectiveChanger::onRightBtnRelease ( void *  data)
virtual

called when user releases right button

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 67 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onRightBtnRelease(), and GUISUMOAbstractView::openObjectDialog().

◆ operator=()

GUIPerspectiveChanger& GUIPerspectiveChanger::operator= ( const GUIPerspectiveChanger )
private

Invalidated assignment operator.

◆ patchedViewPort()

Boundary GUIPerspectiveChanger::patchedViewPort ( )
private

patched viewPort with the same aspect ratio as the canvas

Definition at line 127 of file GUIPerspectiveChanger.cpp.

References Boundary::getHeight(), Boundary::getWidth(), Boundary::growHeight(), Boundary::growWidth(), myCallback, and myViewPort.

Referenced by getViewport().

◆ setViewport() [1/2]

virtual void GUIPerspectiveChanger::setViewport ( double  zoom,
double  xPos,
double  yPos 
)
pure virtual

Sets the viewport Used for: Adapting a new viewport.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::centerTo(), GUISUMOAbstractView::getObjectsInBoundary(), and GUISUMOAbstractView::recenterView().

◆ setViewport() [2/2]

void GUIPerspectiveChanger::setViewport ( const Boundary viewPort)

set viewport

Definition at line 121 of file GUIPerspectiveChanger.cpp.

References myViewPort.

◆ setViewportFrom()

virtual void GUIPerspectiveChanger::setViewportFrom ( double  xPos,
double  yPos,
double  zPos 
)
pure virtual

Alternative method for setting the viewport.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::setViewportFromTo().

◆ zoom2ZPos()

virtual double GUIPerspectiveChanger::zoom2ZPos ( double  zoom) const
pure virtual

Returns the camera height at which the given zoom level is reached.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISettingsHandler::applyViewport(), GUIDialog_EditViewport::onCmdChanged(), TraCIServerAPI_GUI::processSet(), and GUIDialog_EditViewport::setValues().

◆ zPos2Zoom()

virtual double GUIPerspectiveChanger::zPos2Zoom ( double  zPos) const
pure virtual

Returns the zoom level that is achieved at a given camera height.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUIDialog_EditViewport::onCmdChanged(), and GUIDialog_EditViewport::setValues().

Field Documentation

◆ myCallback

◆ myMouseXPosition

◆ myMouseYPosition

◆ myViewPort


The documentation for this class was generated from the following files: