SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIDanielPerspectiveChanger Class Reference

#include <GUIDanielPerspectiveChanger.h>

Inheritance diagram for GUIDanielPerspectiveChanger:
GUIPerspectiveChanger

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)
 
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

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

 GUIDanielPerspectiveChanger (const GUIDanielPerspectiveChanger &)
 Invalidated copy constructor. More...
 
void move (int xdiff, int ydiff)
 
GUIDanielPerspectiveChangeroperator= (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...
 

Detailed Description

This changer has the following behaviour:

  • zooming by pressing the right mouse button and moving the mouse vertically
  • rotation by pressing the right mouse button and moving the mouse horizontally
  • network movement by pressing the left mouse button and moving the mouse

Definition at line 58 of file GUIDanielPerspectiveChanger.h.

Member Enumeration Documentation

Enumerator
MOUSEBTN_NONE 
MOUSEBTN_LEFT 
MOUSEBTN_RIGHT 
MOUSEBTN_MIDDLE 

Definition at line 62 of file GUIPerspectiveChanger.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file GUIDanielPerspectiveChanger.cpp.

GUIDanielPerspectiveChanger::~GUIDanielPerspectiveChanger ( )

Destructor.

Definition at line 58 of file GUIDanielPerspectiveChanger.cpp.

GUIDanielPerspectiveChanger::GUIDanielPerspectiveChanger ( const GUIDanielPerspectiveChanger )
private

Invalidated copy constructor.

Member Function Documentation

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 120 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
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 96 of file GUIDanielPerspectiveChanger.cpp.

References myRotation.

SUMOReal GUIDanielPerspectiveChanger::getXPos ( ) const
virtual

Returns the x-offset of the field to show stored in this changer.

Implements GUIPerspectiveChanger.

Definition at line 102 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 108 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 114 of file GUIDanielPerspectiveChanger.cpp.

References Boundary::getWidth(), myOrigWidth, and GUIPerspectiveChanger::myViewPort.

void GUIDanielPerspectiveChanger::move ( int  xdiff,
int  ydiff 
)
private
void GUIDanielPerspectiveChanger::onLeftBtnPress ( void *  data)
virtual
bool GUIDanielPerspectiveChanger::onLeftBtnRelease ( void *  data)
virtual
void GUIDanielPerspectiveChanger::onMouseWheel ( void *  data)
virtual
bool GUIDanielPerspectiveChanger::onRightBtnRelease ( void *  data)
virtual
GUIDanielPerspectiveChanger& GUIDanielPerspectiveChanger::operator= ( const GUIDanielPerspectiveChanger )
private

Invalidated assignment operator.

void GUIDanielPerspectiveChanger::rotate ( int  diff)
private

Performs the rotation of the view.

Definition at line 85 of file GUIDanielPerspectiveChanger.cpp.

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
void GUIPerspectiveChanger::setViewport ( const Boundary viewPort)
inlineinherited

Definition at line 127 of file GUIPerspectiveChanger.h.

References GUIPerspectiveChanger::myViewPort.

void GUIDanielPerspectiveChanger::zoom ( SUMOReal  factor)
private

Field Documentation

GUISUMOAbstractView& GUIPerspectiveChanger::myCallback
protectedinherited
FXTime GUIDanielPerspectiveChanger::myDragDelay
private

avoid flicker

Definition at line 140 of file GUIDanielPerspectiveChanger.h.

Referenced by onMouseMove(), and setDragDelay().

int GUIDanielPerspectiveChanger::myMouseButtonState
private

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
protectedinherited
FXint GUIPerspectiveChanger::myMouseYPosition
protectedinherited
bool GUIDanielPerspectiveChanger::myMoveOnClick
private

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().

SUMOReal GUIDanielPerspectiveChanger::myOrigHeight
private

Definition at line 125 of file GUIDanielPerspectiveChanger.h.

Referenced by setViewport().

SUMOReal GUIDanielPerspectiveChanger::myOrigWidth
private

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().

SUMOReal GUIDanielPerspectiveChanger::myRotation
private

the current rotation

Definition at line 128 of file GUIDanielPerspectiveChanger.h.

Referenced by getRotation().

Position GUIDanielPerspectiveChanger::myZoomBase
private

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().


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