GUIDanielPerspectiveChanger.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A class that allows to steer the visual output in dependence to
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GUIDanielPerspectiveChanger_h
00020 #define GUIDanielPerspectiveChanger_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <utils/geom/Position2D.h>
00033 #include "GUIPerspectiveChanger.h"
00034 
00035 
00036 // ===========================================================================
00037 // class declarations
00038 // ===========================================================================
00039 class Boundary;
00040 
00041 
00042 // ===========================================================================
00043 // class definitions
00044 // ===========================================================================
00055 class GUIDanielPerspectiveChanger :
00056             public GUIPerspectiveChanger {
00057 public:
00059     GUIDanielPerspectiveChanger(GUISUMOAbstractView &callBack);
00060 
00062     ~GUIDanielPerspectiveChanger();
00063 
00064     void onLeftBtnPress(void *data);
00065     bool onLeftBtnRelease(void *data);
00066     void onRightBtnPress(void *data);
00067     bool onRightBtnRelease(void *data);
00068     void onMouseWheel(void *data);
00069     void onMouseMove(void *data);
00070 
00072     virtual SUMOReal getRotation() const;
00073 
00075     virtual SUMOReal getXPos() const;
00076 
00078     virtual SUMOReal getYPos() const;
00079 
00081     virtual SUMOReal getZoom() const;
00082 
00084     void recenterView();
00085 
00087     void centerTo(const Boundary &netBoundary,
00088                   const Position2D &pos, SUMOReal radius, bool applyZoom=true);
00089 
00091     void centerTo(const Boundary &netBoundary,
00092                   Boundary bound, bool applyZoom=true);
00093 
00095     void setViewport(SUMOReal zoom, SUMOReal xPos, SUMOReal yPos);
00096 
00097 private:
00099     void move(int xdiff, int ydiff);
00100 
00102     void zoom(int diff);
00103 
00105     void rotate(int diff);
00106 
00107 private:
00109     Position2D myViewCenter;
00110 
00112     int myWidthInPixels, myHeightInPixels;
00113 
00115     SUMOReal myNetScale;
00116 
00118     SUMOReal myRotation;
00119 
00121     SUMOReal myZoom;
00122 
00124     int myMouseButtonState;
00125 
00127     bool myMoveOnClick;
00128 
00129 };
00130 
00131 
00132 #endif
00133 
00134 /****************************************************************************/
00135 

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