MovementMgr.hpp   StelMovementMgr.hpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _MOVEMENTMGR_HPP_ #ifndef _STELMOVEMENTMGR_HPP_
#define _MOVEMENTMGR_HPP_ #define _STELMOVEMENTMGR_HPP_
#include "StelModule.hpp" #include "StelModule.hpp"
#include "Projector.hpp" #include "StelProjector.hpp"
//! @class MovementMgr //! @class StelMovementMgr
//! Manages the movement and zoomer operations. //! Manages the head movements and zoom operations.
class MovementMgr : public StelModule class StelMovementMgr : public StelModule
{ {
Q_OBJECT Q_OBJECT
public: public:
MovementMgr(StelCore* core); StelMovementMgr(StelCore* core);
virtual ~MovementMgr(); virtual ~StelMovementMgr();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
//! Initializes the object based on the application settings //! Initializes the object based on the application settings
//! Includes: //! Includes:
//! - Enabling/disabling the movement keys //! - Enabling/disabling the movement keys
//! - Enabling/disabling the zoom keys //! - Enabling/disabling the zoom keys
//! - Enabling/disabling the mouse zoom //! - Enabling/disabling the mouse zoom
//! - Enabling/disabling the mouse movement //! - Enabling/disabling the mouse movement
//! - Sets the zoom and movement speeds //! - Sets the zoom and movement speeds
skipping to change at line 64 skipping to change at line 64
//! Handle mouse movement events. //! Handle mouse movement events.
virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b); virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
//! Handle mouse wheel events. //! Handle mouse wheel events.
virtual void handleMouseWheel(class QWheelEvent* event); virtual void handleMouseWheel(class QWheelEvent* event);
//! Handle mouse click events. //! Handle mouse click events.
virtual void handleMouseClicks(class QMouseEvent* event); virtual void handleMouseClicks(class QMouseEvent* event);
//! Called then the selected object changes. //! Called then the selected object changes.
virtual void selectedObjectChangeCallBack(StelModuleSelectAction act ion=StelModule::ReplaceSelection); virtual void selectedObjectChangeCallBack(StelModuleSelectAction act ion=StelModule::ReplaceSelection);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods specific to MovementMgr // Methods specific to StelMovementMgr
//! Increment/decrement smoothly the vision field and position. //! Increment/decrement smoothly the vision field and position.
void updateMotion(double deltaTime); void updateMotion(double deltaTime);
// These are hopefully temporary. // These are hopefully temporary.
bool getHasDragged() const {return hasDragged;} bool getHasDragged() const {return hasDragged;}
//! Get the zoom speed //! Get the zoom speed
// TODO: what are the units? // TODO: what are the units?
double getZoomSpeed() {return keyZoomSpeed;} double getZoomSpeed() {return keyZoomSpeed;}
skipping to change at line 88 skipping to change at line 88
void setFlagTracking(bool b=true); void setFlagTracking(bool b=true);
//! Get current object tracking status. //! Get current object tracking status.
bool getFlagTracking(void) const {return flagTracking;} bool getFlagTracking(void) const {return flagTracking;}
//! Set whether sky position is to be locked. //! Set whether sky position is to be locked.
void setFlagLockEquPos(bool b) {flagLockEquPos=b;} void setFlagLockEquPos(bool b) {flagLockEquPos=b;}
//! Get whether sky position is locked. //! Get whether sky position is locked.
bool getFlagLockEquPos(void) const {return flagLockEquPos;} bool getFlagLockEquPos(void) const {return flagLockEquPos;}
//! Move view in alt/az (or equatorial if in that mode) coordinates. //! Move view in alt/az (or equatorial if in that mode) coordinates.
//! Changes to viewing direction are instantaneous.
//! @param deltaAz change in azimuth angle in radians
//! @param deltaAlt change in altitude angle in radians
void panView(double deltaAz, double deltaAlt); void panView(double deltaAz, double deltaAlt);
//! Set automove duration in seconds //! Set automove duration in seconds
//! @param f the number of seconds it takes for an auto-move operati on to complete. //! @param f the number of seconds it takes for an auto-move operati on to complete.
void setAutoMoveDuration(float f) {autoMoveDuration = f;} void setAutoMoveDuration(float f) {autoMoveDuration = f;}
//! Get automove duration in seconds //! Get automove duration in seconds
//! @return the number of seconds it takes for an auto-move operatio n to complete. //! @return the number of seconds it takes for an auto-move operatio n to complete.
float getAutoMoveDuration(void) const {return autoMoveDuration;} float getAutoMoveDuration(void) const {return autoMoveDuration;}
//! Set whether auto zoom out will reset the viewing direction to th e inital value //! Set whether auto zoom out will reset the viewing direction to th e inital value
skipping to change at line 134 skipping to change at line 137
//! @param aim The position to move to expressed as a vector. //! @param aim The position to move to expressed as a vector.
//! @param moveDuration The time it takes for the move to complete. //! @param moveDuration The time it takes for the move to complete.
//! @param localPos If false, use equatorial position, else use loca l. //! @param localPos If false, use equatorial position, else use loca l.
//! @param zooming ??? //! @param zooming ???
void moveTo(const Vec3d& aim, float moveDuration = 1., bool localPos = false, int zooming = 0); void moveTo(const Vec3d& aim, float moveDuration = 1., bool localPos = false, int zooming = 0);
//! Change the zoom level. //! Change the zoom level.
//! @param aimFov The desired field of view in degrees. //! @param aimFov The desired field of view in degrees.
//! @param moveDuration The time that the operation should take to c omplete. //! @param moveDuration The time that the operation should take to c omplete.
void zoomTo(double aimFov, float moveDuration = 1.); void zoomTo(double aimFov, float moveDuration = 1.);
//! Get the current Field Of View in degrees
double getCurrentFov() const {return currentFov;}
//! Return the initial default FOV in degree.
double getInitFov() const {return initFov;}
//! Set the initial Field Of View in degree.
void setInitFov(double fov) {initFov=fov;}
//! Set the maximum field of View in degrees.
void setMaxFov(double max);
//! Get the maximum field of View in degrees.
double getMaxFov(void) const {return maxFov;}
//! Go and zoom to the selected object. A later call to autoZoomOut will come back to the previous zoom level. //! Go and zoom to the selected object. A later call to autoZoomOut will come back to the previous zoom level.
void autoZoomIn(float moveDuration = 1.f, bool allowManualZoom = 1); void autoZoomIn(float moveDuration = 1.f, bool allowManualZoom = 1);
//! Unzoom to the previous position. //! Unzoom to the previous position.
void autoZoomOut(float moveDuration = 1.f, bool full = 0); void autoZoomOut(float moveDuration = 1.f, bool full = 0);
//! If currently zooming, return the target FOV, otherwise return cu rrent FOV in degree. //! If currently zooming, return the target FOV, otherwise return cu rrent FOV in degree.
double getAimFov(void) const; double getAimFov(void) const;
//! Viewing direction function : true move, false stop. //! Viewing direction function : true move, false stop.
void turnRight(bool); void turnRight(bool);
void turnLeft(bool); void turnLeft(bool);
void turnUp(bool); void turnUp(bool);
void turnDown(bool); void turnDown(bool);
void moveSlow(bool b) {flagMoveSlow=b;}
void zoomIn(bool); void zoomIn(bool);
void zoomOut(bool); void zoomOut(bool);
private: private:
double currentFov; // The current FOV in degree
double initFov; // The FOV at startup
double minFov; // Minimum FOV in degree
double maxFov; // Maximum FOV in degree
void setFov(double f)
{
currentFov = f;
if (f>maxFov)
currentFov = maxFov;
if (f<minFov)
currentFov = minFov;
}
void changeFov(double deltaFov); void changeFov(double deltaFov);
void updateVisionVector(double deltaTime); void updateVisionVector(double deltaTime);
void updateAutoZoom(double deltaTime); // Update autoZoom if activat ed void updateAutoZoom(double deltaTime); // Update autoZoom if activat ed
//! Make the first screen position correspond to the second (useful for mouse dragging) //! Make the first screen position correspond to the second (useful for mouse dragging)
void dragView(int x1, int y1, int x2, int y2); void dragView(int x1, int y1, int x2, int y2);
StelCore* core; // The core on which the movement are appli ed StelCore* core; // The core on which the movement are appli ed
bool flagLockEquPos; // Define if the equatorial position is loc ked bool flagLockEquPos; // Define if the equatorial position is loc ked
bool flagTracking; // Define if the selected object is followe d bool flagTracking; // Define if the selected object is followe d
// Flags for mouse movements // Flags for mouse movements
bool isMouseMovingHoriz; bool isMouseMovingHoriz;
bool isMouseMovingVert; bool isMouseMovingVert;
bool flagEnableMoveAtScreenEdge; // allow mouse at edge of screen to move view bool flagEnableMoveAtScreenEdge; // allow mouse at edge of screen to move view
bool flagEnableMouseNavigation; bool flagEnableMouseNavigation;
float mouseZoomSpeed; float mouseZoomSpeed;
bool flagEnableZoomKeys; bool flagEnableZoomKeys;
bool flagEnableMoveKeys; bool flagEnableMoveKeys;
float keyMoveSpeed; // Speed of keys movement float keyMoveSpeed; // Speed of keys movement
float keyZoomSpeed; // Speed of keys zoom float keyZoomSpeed; // Speed of keys zoom
bool flagMoveSlow;
// Automove
// Struct used to store data for auto mov //! @internal
typedef struct //! Store data for auto-move
struct AutoMove
{ {
Vec3d start; Vec3d start;
Vec3d aim; Vec3d aim;
float speed; float speed;
float coef; float coef;
bool localPos; // Define if the position are in equatorial bool localPos; // Define if the position are in equatorial
or altazimutal or altazimuthal
} autoMove; };
autoMove move; // Current auto movement AutoMove move; // Current auto movement
int flagAutoMove; // Define if automove is on or off int flagAutoMove; // Define if automove is on or off
int zoomingMode; // 0 : undefined, 1 zooming, -1 unzooming int zoomingMode; // 0 : undefined, 1 zooming, -1 unzooming
double deltaFov,deltaAlt,deltaAz; // View movement double deltaFov,deltaAlt,deltaAz; // View movement
bool flagManualZoom; // Define whether auto zoom can go further bool flagManualZoom; // Define whether auto zoom can go further
float autoMoveDuration; // Duration of movement for the auto move to a selected objectin seconds float autoMoveDuration; // Duration of movement for the auto move to a selected objectin seconds
// Mouse control options // Mouse control options
bool isDragging, hasDragged; bool isDragging, hasDragged;
int previousX, previousY; int previousX, previousY;
// Struct used to store data for auto zoom //! @internal
typedef struct //! Store data for auto-zoom.
struct AutoZoom
{ {
double start; double start;
double aim; double aim;
float speed; float speed;
float coef; float coef;
} autoZoom; };
// Automove // Automove
autoZoom zoomMove; // Current auto movement AutoZoom zoomMove; // Current auto movement
bool flagAutoZoom; // Define if autozoom is on or off bool flagAutoZoom; // Define if autozoom is on or off
bool flagAutoZoomOutResetsDirection; bool flagAutoZoomOutResetsDirection;
}; };
#endif // _MOVEMENTMGR_HPP_ #endif // _STELMOVEMENTMGR_HPP_
 End of changes. 19 change blocks. 
25 lines changed or deleted 53 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/