00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELMOVEMENTMGR_HPP_
00021 #define _STELMOVEMENTMGR_HPP_
00022
00023 #include "StelModule.hpp"
00024 #include "StelProjector.hpp"
00025
00028 class StelMovementMgr : public StelModule
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 StelMovementMgr(StelCore* core);
00034 virtual ~StelMovementMgr();
00035
00037
00046 virtual void init();
00047
00049 virtual void update(double deltaTime) {;}
00051 virtual void draw(StelCore* core) {;}
00053 virtual void handleKeys(QKeyEvent* event);
00055 virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
00057 virtual void handleMouseWheel(class QWheelEvent* event);
00059 virtual void handleMouseClicks(class QMouseEvent* event);
00061 virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=StelModule::ReplaceSelection);
00062
00064
00065
00067 void updateMotion(double deltaTime);
00068
00069
00070 bool getHasDragged() const {return hasDragged;}
00071
00073
00074 double getZoomSpeed() {return keyZoomSpeed;}
00075
00076 public slots:
00078 void setFlagTracking(bool b=true);
00080 bool getFlagTracking(void) const {return flagTracking;}
00081
00083 void setFlagLockEquPos(bool b) {flagLockEquPos=b;}
00085 bool getFlagLockEquPos(void) const {return flagLockEquPos;}
00086
00091 void panView(double deltaAz, double deltaAlt);
00092
00095 void setAutoMoveDuration(float f) {autoMoveDuration = f;}
00098 float getAutoMoveDuration(void) const {return autoMoveDuration;}
00099
00101 void setFlagAutoZoomOutResetsDirection(bool b) {flagAutoZoomOutResetsDirection = b;}
00103 bool getFlagAutoZoomOutResetsDirection(void) {return flagAutoZoomOutResetsDirection;}
00104
00106 bool getFlagEnableZoomKeys() const {return flagEnableZoomKeys;}
00108 void setFlagEnableZoomKeys(bool b) {flagEnableZoomKeys=b;}
00109
00111 bool getFlagEnableMoveKeys() const {return flagEnableMoveKeys;}
00113 void setFlagEnableMoveKeys(bool b) {flagEnableMoveKeys=b;}
00114
00116 bool getFlagEnableMoveAtScreenEdge() const {return flagEnableMoveAtScreenEdge;}
00118 void setFlagEnableMoveAtScreenEdge(bool b) {flagEnableMoveAtScreenEdge=b;}
00119
00121 bool getFlagEnableMouseNavigation() const {return flagEnableMouseNavigation;}
00123 void setFlagEnableMouseNavigation(bool b) {flagEnableMouseNavigation=b;}
00124
00131 void moveTo(const Vec3d& aim, float moveDuration = 1., bool localPos = false, int zooming = 0);
00132
00136 void zoomTo(double aimFov, float moveDuration = 1.);
00138 double getCurrentFov() const {return currentFov;}
00139
00141 double getInitFov() const {return initFov;}
00143 void setInitFov(double fov) {initFov=fov;}
00144
00146 void setMaxFov(double max);
00148 double getMaxFov(void) const {return maxFov;}
00149
00151 void autoZoomIn(float moveDuration = 1.f, bool allowManualZoom = 1);
00153 void autoZoomOut(float moveDuration = 1.f, bool full = 0);
00154
00156 double getAimFov(void) const;
00157
00159 void turnRight(bool);
00160 void turnLeft(bool);
00161 void turnUp(bool);
00162 void turnDown(bool);
00163 void moveSlow(bool b) {flagMoveSlow=b;}
00164 void zoomIn(bool);
00165 void zoomOut(bool);
00166
00167 private:
00168 double currentFov;
00169 double initFov;
00170 double minFov;
00171 double maxFov;
00172
00173 void setFov(double f)
00174 {
00175 currentFov = f;
00176 if (f>maxFov)
00177 currentFov = maxFov;
00178 if (f<minFov)
00179 currentFov = minFov;
00180 }
00181 void changeFov(double deltaFov);
00182
00183 void updateVisionVector(double deltaTime);
00184 void updateAutoZoom(double deltaTime);
00185
00187 void dragView(int x1, int y1, int x2, int y2);
00188
00189 StelCore* core;
00190 bool flagLockEquPos;
00191 bool flagTracking;
00192
00193
00194 bool isMouseMovingHoriz;
00195 bool isMouseMovingVert;
00196
00197 bool flagEnableMoveAtScreenEdge;
00198 bool flagEnableMouseNavigation;
00199 float mouseZoomSpeed;
00200
00201 bool flagEnableZoomKeys;
00202 bool flagEnableMoveKeys;
00203 float keyMoveSpeed;
00204 float keyZoomSpeed;
00205 bool flagMoveSlow;
00206
00209 struct AutoMove
00210 {
00211 Vec3d start;
00212 Vec3d aim;
00213 float speed;
00214 float coef;
00215 bool localPos;
00216 };
00217
00218 AutoMove move;
00219 int flagAutoMove;
00220 int zoomingMode;
00221
00222 double deltaFov,deltaAlt,deltaAz;
00223
00224 bool flagManualZoom;
00225 float autoMoveDuration;
00226
00227
00228 bool isDragging, hasDragged;
00229 int previousX, previousY;
00230
00233 struct AutoZoom
00234 {
00235 double start;
00236 double aim;
00237 float speed;
00238 float coef;
00239 };
00240
00241
00242 AutoZoom zoomMove;
00243 bool flagAutoZoom;
00244 bool flagAutoZoomOutResetsDirection;
00245 };
00246
00247 #endif // _STELMOVEMENTMGR_HPP_
00248