GUIPerspectiveChanger Class Reference

#include <GUIPerspectiveChanger.h>

Inheritance diagram for GUIPerspectiveChanger:

GUIDanielPerspectiveChanger

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


Public Types

enum  MouseState { MOUSEBTN_NONE = 0, MOUSEBTN_LEFT = 1, MOUSEBTN_RIGHT = 2, MOUSEBTN_MIDDLE = 4 }

Public Member Functions

void applyCanvasSize (size_t width, size_t height)
 Informs the changer aboud the size of the canvas.
virtual void centerTo (const Boundary &netBoundary, Boundary bound, bool applyZoom=true)=0
 Centers the view to show the given boundary Used for: Centering of lanes.
virtual void centerTo (const Boundary &netBoundary, const Position2D &pos, SUMOReal 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.
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 =0
 Returns the rotation of the canvas stored in this changer.
virtual SUMOReal getXPos () const =0
 Returns the x-offset of the field to show stored in this changer.
virtual SUMOReal getYPos () const =0
 Returns the y-offset of the field to show stored in this changer.
virtual SUMOReal getZoom () const =0
 Returns the zoom factor computed stored in this changer.
 GUIPerspectiveChanger (GUISUMOAbstractView &callBack)
 Constructor.
virtual void onLeftBtnPress (void *data)
virtual bool onLeftBtnRelease (void *data)
virtual void onMouseMove (void *data)
virtual void onMouseWheel (void *data)
virtual void onRightBtnPress (void *data)
virtual bool onRightBtnRelease (void *data)
virtual void recenterView ()=0
 recenters the view to display the whole network
void setNetSizes (size_t width, size_t height)
 Sets the sizes of the network.
virtual void setViewport (SUMOReal zoom, SUMOReal xPos, SUMOReal yPos)=0
 Sets the viewport Used for: Adapting a new viewport.
virtual ~GUIPerspectiveChanger ()
 Destructor.

Protected Attributes

GUISUMOAbstractViewmyCallback
 The parent window (canvas to scale).
size_t myCanvasHeight
size_t myCanvasWidth
 The sizes of the canvas.
FXint myMouseXPosition
 the current mouse position
FXint myMouseYPosition
size_t myNetHeight
size_t myNetWidth
 The sizes of the network.

Member Enumeration Documentation

Enumerator:
MOUSEBTN_NONE 
MOUSEBTN_LEFT 
MOUSEBTN_RIGHT 
MOUSEBTN_MIDDLE 

Definition at line 59 of file GUIPerspectiveChanger.h.

00059                     {
00060         MOUSEBTN_NONE = 0,
00061         MOUSEBTN_LEFT = 1,
00062         MOUSEBTN_RIGHT = 2,
00063         MOUSEBTN_MIDDLE = 4
00064     };


Constructor & Destructor Documentation

GUIPerspectiveChanger::GUIPerspectiveChanger ( GUISUMOAbstractView callBack  ) 

Constructor.

Definition at line 41 of file GUIPerspectiveChanger.cpp.

00042         : myCallback(callBack) {}

GUIPerspectiveChanger::~GUIPerspectiveChanger (  )  [virtual]

Destructor.

Definition at line 45 of file GUIPerspectiveChanger.cpp.

00045 {}


Member Function Documentation

void GUIPerspectiveChanger::applyCanvasSize ( size_t  width,
size_t  height 
)

Informs the changer aboud the size of the canvas.

Definition at line 56 of file GUIPerspectiveChanger.cpp.

References myCanvasHeight, and myCanvasWidth.

Referenced by GUISUMOAbstractView::onConfigure().

00056                                                                   {
00057     myCanvasWidth = width;
00058     myCanvasHeight = height;
00059 }

virtual void GUIPerspectiveChanger::centerTo ( const Boundary netBoundary,
Boundary  bound,
bool  applyZoom = true 
) [pure virtual]

Centers the view to show the given boundary Used for: Centering of lanes.

Implemented in GUIDanielPerspectiveChanger.

virtual void GUIPerspectiveChanger::centerTo ( const Boundary netBoundary,
const Position2D pos,
SUMOReal  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(), and GUISUMOAbstractView::paintGL().

FXint GUIPerspectiveChanger::getMouseXPosition (  )  const

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

Definition at line 91 of file GUIPerspectiveChanger.cpp.

References myMouseXPosition.

00091                                                {
00092     return myMouseXPosition;
00093 }

FXint GUIPerspectiveChanger::getMouseYPosition (  )  const

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

Definition at line 97 of file GUIPerspectiveChanger.cpp.

References myMouseYPosition.

00097                                                {
00098     return myMouseYPosition;
00099 }

virtual SUMOReal GUIPerspectiveChanger::getRotation (  )  const [pure virtual]

Returns the rotation of the canvas stored in this changer.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::applyChanges().

virtual SUMOReal GUIPerspectiveChanger::getXPos (  )  const [pure virtual]

virtual SUMOReal GUIPerspectiveChanger::getYPos (  )  const [pure virtual]

virtual SUMOReal GUIPerspectiveChanger::getZoom (  )  const [pure virtual]

void GUIPerspectiveChanger::onLeftBtnPress ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 63 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onLeftBtnPress().

00063 {}

bool GUIPerspectiveChanger::onLeftBtnRelease ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 67 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onLeftBtnRelease().

00067                                              {
00068     return false;
00069 }

void GUIPerspectiveChanger::onMouseMove ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 87 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onMouseMove().

00087 {}

void GUIPerspectiveChanger::onMouseWheel ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 83 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onMouseWheel().

00083 {}

void GUIPerspectiveChanger::onRightBtnPress ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 73 of file GUIPerspectiveChanger.cpp.

Referenced by GUISUMOAbstractView::onRightBtnPress().

00073 {}

bool GUIPerspectiveChanger::onRightBtnRelease ( void *  data  )  [virtual]

Reimplemented in GUIDanielPerspectiveChanger.

Definition at line 77 of file GUIPerspectiveChanger.cpp.

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

00077                                               {
00078     return false;
00079 }

virtual void GUIPerspectiveChanger::recenterView (  )  [pure virtual]

recenters the view to display the whole network

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::recenterView().

void GUIPerspectiveChanger::setNetSizes ( size_t  width,
size_t  height 
)

Sets the sizes of the network.

Definition at line 49 of file GUIPerspectiveChanger.cpp.

References myNetHeight, and myNetWidth.

00049                                                               {
00050     myNetWidth = width;
00051     myNetHeight = height;
00052 }

virtual void GUIPerspectiveChanger::setViewport ( SUMOReal  zoom,
SUMOReal  xPos,
SUMOReal  yPos 
) [pure virtual]

Sets the viewport Used for: Adapting a new viewport.

Implemented in GUIDanielPerspectiveChanger.

Referenced by GUISUMOAbstractView::setViewport().


Field Documentation

Definition at line 129 of file GUIPerspectiveChanger.h.

Referenced by applyCanvasSize().

The sizes of the canvas.

Definition at line 129 of file GUIPerspectiveChanger.h.

Referenced by applyCanvasSize().

Definition at line 126 of file GUIPerspectiveChanger.h.

Referenced by setNetSizes().

The sizes of the network.

Definition at line 126 of file GUIPerspectiveChanger.h.

Referenced by setNetSizes().


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

Generated on Wed May 5 00:06:44 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6