Stellarium  0.20.3
Data Structures | Public Types | Public Slots | Signals | Public Member Functions | Properties
StelMovementMgr Class Reference

Manages the head movements and zoom operations. More...

#include <StelMovementMgr.hpp>

Public Types

enum  MountMode { MountAltAzimuthal, MountEquinoxEquatorial, MountGalactic, MountSupergalactic }
 Possible mount modes defining the reference frame in which head movements occur. More...
 
enum  ZoomingMode { ZoomOut =-1, ZoomNone =0, ZoomIn =1 }
 Named constants for zoom operations.
 
- Public Types inherited from StelModule
enum  StelModuleSelectAction { AddToSelection, ReplaceSelection, RemoveFromSelection }
 Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More...
 
enum  StelModuleActionName {
  ActionDraw, ActionUpdate, ActionHandleMouseClicks, ActionHandleMouseMoves,
  ActionHandleKeys
}
 Define the possible action for which an order is defined. More...
 

Public Slots

void toggleMountMode ()
 Toggle current mount mode between equatorial and altazimuthal.
 
void setEquatorialMount (bool b)
 Define whether we should use equatorial mount or altazimuthal.
 
void setFlagTracking (bool b=true)
 Set object tracking on/off and go to selected object.
 
bool getFlagTracking (void) const
 Get current object tracking status.
 
void setFlagLockEquPos (bool b)
 Set whether sky position is to be locked.
 
bool getFlagLockEquPos (void) const
 Get whether sky position is locked.
 
void panView (const double deltaAz, const double deltaAlt)
 Move view in alt/az (or equatorial if in that mode) coordinates. More...
 
void setAutoMoveDuration (float f)
 Set automove duration in seconds. More...
 
float getAutoMoveDuration (void) const
 Get automove duration in seconds. More...
 
void setFlagAutoZoomOutResetsDirection (bool b)
 Set whether auto zoom out will reset the viewing direction to the inital value.
 
bool getFlagAutoZoomOutResetsDirection (void) const
 Get whether auto zoom out will reset the viewing direction to the inital value.
 
bool getFlagEnableZoomKeys () const
 Get whether keys can control zoom.
 
void setFlagEnableZoomKeys (bool b)
 Set whether keys can control zoom.
 
bool getFlagEnableMoveKeys () const
 Get whether keys can control movement.
 
void setFlagEnableMoveKeys (bool b)
 Set whether keys can control movement.
 
bool getFlagEnableMoveAtScreenEdge () const
 Get whether being at the edge of the screen activates movement.
 
void setFlagEnableMoveAtScreenEdge (bool b)
 Set whether being at the edge of the screen activates movement.
 
bool getFlagEnableMouseNavigation () const
 Get whether mouse can control movement.
 
void setFlagEnableMouseNavigation (bool b)
 Set whether mouse can control movement.
 
bool getFlagIndicationMountMode () const
 Get the state of flag for indication of mount mode.
 
void setFlagIndicationMountMode (bool b)
 Set the state of flag for indication of mount mode.
 
void moveToJ2000 (const Vec3d &aim, const Vec3d &aimUp, float moveDuration=1., ZoomingMode zooming=ZoomNone)
 Move the view to a specified J2000 position. More...
 
void moveToAltAzi (const Vec3d &aim, const Vec3d &aimUp, float moveDuration=1., ZoomingMode zooming=ZoomNone)
 Move the view to a specified AltAzimuthal position. More...
 
void zoomTo (double aimFov, float zoomDuration=1.)
 Change the zoom level. More...
 
double getCurrentFov () const
 Get the current Field Of View in degrees.
 
double getInitFov () const
 Return the initial default FOV in degree.
 
void setInitFov (double fov)
 Set the initial Field Of View in degree.
 
const Vec3d getInitViewingDirection () const
 Return the initial viewing direction in altazimuthal coordinates. More...
 
void setInitViewDirectionToCurrent ()
 Sets the initial direction of view to the current altitude and azimuth. More...
 
Vec3d getViewDirectionJ2000 () const
 Return the current viewing direction in the equatorial J2000 frame. More...
 
void setViewDirectionJ2000 (const Vec3d &v)
 Set the current viewing direction in the equatorial J2000 frame.
 
void setMaxFov (double max)
 Set the maximum field of View in degrees.
 
double getMaxFov (void) const
 Get the maximum field of View in degrees.
 
double getMinFov (void) const
 Get the minimum field of View in degrees.
 
void autoZoomIn (float moveDuration=1.f, bool allowManualZoom=1)
 Go and zoom to the selected object. A later call to autoZoomOut will come back to the previous zoom level.
 
void autoZoomOut (float moveDuration=1.f, bool full=0)
 Unzoom to the previous position.
 
void deselection (void)
 Deselect the selected object.
 
double getAimFov (void) const
 If currently zooming, return the target FOV, otherwise return current FOV in degree.
 
void turnRight (bool s)
 With true, starts turning the direction of view to the right, with an unspecified speed, according to the current mount mode (i.e., increasing azimuth, decreasing rectascension). More...
 
void turnLeft (bool s)
 With true, starts turning the direction of view to the left, with an unspecified speed, and according to the current mount mode (i.e., decreasing azimuth, increasing rectascension). More...
 
void turnUp (bool s)
 With true, starts moving the direction of the view up, with an unspecified speed, and according to the current mount mode (i.e., towards the zenith or the celestial north pole). More...
 
void turnDown (bool s)
 With true, starts moving the direction of the view down, with an unspecified speed, and according to the current mount mode (i.e., towards the nadir or the celestial south pole). More...
 
void moveSlow (bool b)
 
void zoomIn (bool s)
 With true, starts zooming in, with an unspecified ratio of degrees per second, either until zooming is stopped with a zoomIn call with false (or a zoomOut call). More...
 
void zoomOut (bool s)
 With true, starts zooming out, with an unspecified ratio of degrees per second, either until zooming is stopped with a zoomIn call with false (or a zoomOut call). More...
 
void lookEast (bool zero=false)
 Look immediately towards East. More...
 
void lookWest (bool zero=false)
 Look immediately towards West. More...
 
void lookNorth (bool zero=false)
 Look immediately towards North. More...
 
void lookSouth (bool zero=false)
 Look immediately towards South. More...
 
void lookZenith (void)
 Look immediately towards Zenith, turning southern horizon to screen bottom.
 
void lookNadir (void)
 Look immediately towards Nadir, turning southern horizon to screen top.
 
void lookTowardsNCP (void)
 Look immediately towards North Celestial pole.
 
void lookTowardsSCP (void)
 Look immediately towards South Celestial pole.
 
void moveViewport (double offsetX, double offsetY, const float duration=0.f)
 set or start animated move of the viewport offset. More...
 
void setMountMode (MountMode m)
 Set current mount type defining the reference frame in which head movements occur.
 
MountMode getMountMode (void) const
 Get current mount type defining the reference frame in which head movements occur.
 
bool getEquatorialMount (void) const
 
void setInhibitAllAutomoves (bool inhibit)
 Function designed only for scripting context. More...
 
Vec2d getViewportOffsetTarget () const
 Returns the targetted value of the viewport offset.
 
double getViewportHorizontalOffsetTarget () const
 
double getViewportVerticalOffsetTarget () const
 
void setViewportHorizontalOffsetTarget (double f)
 
void setViewportVerticalOffsetTarget (double f)
 

Signals

void flagTrackingChanged (bool b)
 Emitted when the tracking property changes.
 
void equatorialMountChanged (bool b)
 
void flagIndicationMountModeChanged (bool b)
 
void flagAutoZoomOutResetsDirectionChanged (bool b)
 
void viewportHorizontalOffsetTargetChanged (double f)
 
void viewportVerticalOffsetTargetChanged (double f)
 
void flagEnableMouseNavigationChanged (bool b)
 

Public Member Functions

 StelMovementMgr (StelCore *core)
 
virtual void init ()
 Initializes the object based on the application settings Includes: More...
 
virtual void update (double)
 Update time-dependent things (triggers a time dragging record if required)
 
virtual void draw (StelCore *)
 Implement required draw function. Does nothing.
 
virtual void handleKeys (QKeyEvent *event)
 Handle keyboard events.
 
virtual bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse movement events.
 
virtual void handleMouseWheel (class QWheelEvent *event)
 Handle mouse wheel events.
 
virtual void handleMouseClicks (class QMouseEvent *event)
 Handle mouse click events.
 
virtual double getCallOrder (StelModuleActionName actionName) const
 Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations. More...
 
virtual bool handlePinch (qreal scale, bool started)
 Handle pinch gesture.
 
void updateMotion (double deltaTime)
 Increment/decrement smoothly the vision field and position. Called in StelCore.update().
 
double getZoomSpeed () const
 Get the zoom speed.
 
Vec3d getViewUpVectorJ2000 () const
 Return the current up view vector in J2000 coordinates.
 
void setViewUpVectorJ2000 (const Vec3d &up)
 
void setViewUpVector (const Vec3d &up)
 
void setMovementSpeedFactor (float s)
 
float getMovementSpeedFactor () const
 
void setDragTriggerDistance (float d)
 
Vec3d j2000ToMountFrame (const Vec3d &v) const
 
Vec3d mountFrameToJ2000 (const Vec3d &v) const
 
void moveToObject (const StelObjectP &target, float moveDuration=1., ZoomingMode zooming=ZoomNone)
 
- Public Member Functions inherited from StelModule
virtual void deinit ()
 Called before the module will be delete, and before the openGL context is suppressed. More...
 
virtual QSettings * getSettings ()
 Return module-specific settings. More...
 
virtual QString getModuleVersion () const
 Get the version of the module, default is stellarium main version.
 
virtual QString getAuthorName () const
 Get the name of the module author.
 
virtual QString getAuthorEmail () const
 Get the email adress of the module author.
 
virtual bool configureGui (bool show=true)
 Detect or show the configuration GUI elements for the module. More...
 

Properties

bool equatorialMount
 
bool tracking
 
bool flagIndicationMountMode
 
double viewportHorizontalOffsetTarget
 
double viewportVerticalOffsetTarget
 
bool flagAutoZoomOutResetsDirection
 
bool flagEnableMouseNavigation
 

Additional Inherited Members

- Protected Member Functions inherited from StelModule
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to slot) to the StelActionMgr object. More...
 
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to own slot) to the StelActionMgr object. More...
 
StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *contextObject, std::function< void()> lambda, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to Lambda functor) to the StelActionMgr object. More...
 

Detailed Description

Member Enumeration Documentation

◆ MountMode

MountGalactic and MountSupergalactic is currently only available via scripting API: core.clear("galactic") and core.clear("supergalactic")

Member Function Documentation

◆ getAutoMoveDuration

float StelMovementMgr::getAutoMoveDuration ( void  ) const
inlineslot
Returns
the number of seconds it takes for an auto-move operation to complete.

◆ getCallOrder()

virtual double StelMovementMgr::getCallOrder ( StelModuleActionName  actionName) const
virtual
Parameters
actionNamethe name of the action for which we want the call order
Returns
the value defining the order. The closer to 0 the earlier the module's action will be called

Reimplemented from StelModule.

◆ getInitViewingDirection

const Vec3d StelMovementMgr::getInitViewingDirection ( ) const
inlineslot

See StelMovementMgr::moveToAltAzi for an explanation of the return value.

◆ getViewDirectionJ2000

Vec3d StelMovementMgr::getViewDirectionJ2000 ( ) const
inlineslot

See StelMovementMgr::moveToJ2000 for an explanation of the return value.

◆ init()

virtual void StelMovementMgr::init ( )
virtual
  • Enabling/disabling the movement keys
  • Enabling/disabling the zoom keys
  • Enabling/disabling the mouse zoom
  • Enabling/disabling the mouse movement
  • Sets the zoom and movement speeds
  • Sets the auto-zoom duration and mode.

Implements StelModule.

◆ lookEast

void StelMovementMgr::lookEast ( bool  zero = false)
slot
Parameters
zerotrue to center on horizon, false to keep altitude, or when looking to the zenith already, turn eastern horizon to screen bottom.

◆ lookNorth

void StelMovementMgr::lookNorth ( bool  zero = false)
slot
Parameters
zerotrue to center on horizon, false to keep altitude, or when looking to the zenith already, turn northern horizon to screen bottom.

◆ lookSouth

void StelMovementMgr::lookSouth ( bool  zero = false)
slot
Parameters
zerotrue to center on horizon, false to keep altitude, or when looking to the zenith already, turn southern horizon to screen bottom.

◆ lookWest

void StelMovementMgr::lookWest ( bool  zero = false)
slot
Parameters
zerotrue to center on horizon, false to keep altitude, or when looking to the zenith already, turn western horizon to screen bottom.

◆ moveToAltAzi

void StelMovementMgr::moveToAltAzi ( const Vec3d aim,
const Vec3d aimUp,
float  moveDuration = 1.,
ZoomingMode  zooming = ZoomNone 
)
slot
Parameters
aimThe position to move to expressed as a vector in AltAz frame.
aimUpUp vector in AltAz coordinates. Can be usually (0/0/1) but may have to be exact for looking into the zenith/pole
moveDurationThe time it takes for the move to complete.
zoomingyou want to zoom in, out or not (just center).
// You can use the following code most of the times to find a valid aimUp vector:
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
mvmgr->moveToAltAzi(pos, Vec3d(0., 0., 1.), mvmgr->getAutoMoveDuration());
Note
core::moveToAltAzi provides a simpler signature for the same function.
Objects of class Vec3d are 3-dimensional vectors in a right-handed (!) rectangular coordinate system. For positions in the horizontal coordinate system, the axes point south, east and to the zenith, irrespective of the setting of the "Azimuth from south" option in the "Tools" tab of the "Configuration" window. You may use a constructor defining three components (x,y,z) or the format with just two angles, e.g., Vec3d("0d","0d") points south, Vec3d("90d","0d") points east, with azimuth angles running counter-clockwise, i.e., against the usual orientation.
Panic function made March 2016. It turned out that using moveToJ2000 for alt-az-based moves behaves odd for long moves during fast timelapse: end vector is linked to the sky! As of March 2016: This call does nothing when mount frame is not AltAzi!

◆ moveToJ2000

void StelMovementMgr::moveToJ2000 ( const Vec3d aim,
const Vec3d aimUp,
float  moveDuration = 1.,
ZoomingMode  zooming = ZoomNone 
)
slot
Parameters
aimThe position to move to expressed as a vector.
aimUpUp vector. Can be usually (0/0/1) but may have to be exact for looking into the zenith/pole
moveDurationThe time it takes for the move to complete.
zoomingyou want to zoom in, out or not (just center).
// You can use the following code most of the times to find a valid aimUp vector:
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
mvmgr->moveToJ2000(pos, mvmgr->mountFrameToJ2000(Vec3d(0., 0., 1.)), mvmgr->getAutoMoveDuration());
Note
core::moveToRaDecJ2000 provides a simpler signature for the same function.
Objects of class Vec3d are 3-dimensional vectors in a rectangular coordinate system. For J2000 positions, the x-axis points to 0h,0°, the y-axis to 6h,0° and the z-axis points to the celestial pole. You may use a constructor defining three components (x,y,z) or the format with just two angles, e.g., Vec3d("0h","0d").

◆ moveViewport

void StelMovementMgr::moveViewport ( double  offsetX,
double  offsetY,
const float  duration = 0.f 
)
slot

This can be used e.g. in wide cylindrical panorama screens to push the horizon down and see more of the sky. Also helpful in stereographic projection to push the horizon down and see more of the sky.

Parameters
offsetXnew horizontal viewport offset, percent. clamped to [-50...50]. Probably not very useful.
offsetYnew horizontal viewport offset, percent. clamped to [-50...50]. This is also available in the GUI.
durationanimation duration, seconds. Optional.
Note
Only vertical viewport is really meaningful.

◆ panView

void StelMovementMgr::panView ( const double  deltaAz,
const double  deltaAlt 
)
slot

Changes to viewing direction are instantaneous.

Parameters
deltaAzchange in azimuth angle in radians
deltaAltchange in altitude angle in radians

◆ setAutoMoveDuration

void StelMovementMgr::setAutoMoveDuration ( float  f)
inlineslot
Parameters
fthe number of seconds it takes for an auto-move operation to complete.

◆ setInhibitAllAutomoves

void StelMovementMgr::setInhibitAllAutomoves ( bool  inhibit)
inlineslot

Put the function into the startup.ssc of your planetarium setup, this will avoid any unwanted tracking.

◆ setInitViewDirectionToCurrent

void StelMovementMgr::setInitViewDirectionToCurrent ( )
slot

Note: Updates the configuration file.

◆ turnDown

void StelMovementMgr::turnDown ( bool  s)
slot

Movement halts when the goal is reached, but the command remains active until turnDown is called with false, or turnUp with any value. While this command is active, other movement commands or mouse or keyboard operations will be countermanded by the still pending turnDown command.

Parameters
s- true move, false stop
Note
Use StelMovementMgr.panView for precise control of view movements.

◆ turnLeft

void StelMovementMgr::turnLeft ( bool  s)
slot

Turning stops only due to a call to turnLeft with false (or to turnRight with any value); it does not stop when the script is terminated.

Parameters
s- true move, false stop
// You can use the following code to turn the direction of the view
// "a little" to the left, by an unpredictable amount.
core.wait(0.42);
Note
Use StelMovementMgr.panView for precise control of view movements.

◆ turnRight

void StelMovementMgr::turnRight ( bool  s)
slot

Turning stops only due to a call to turnRight with false (or to turnLeft with any value) ; it does not stop when the script is terminated.

Parameters
s- true move, false stop
// You can use the following code to turn the direction of the view
// "a little" to the right, by an un predictable amount.
core.wait(0.42);
Note
Use StelMovementMgr.panView for precise control of view movements.

◆ turnUp

void StelMovementMgr::turnUp ( bool  s)
slot

Movement halts when the goal is reached, but the command remains active until turnUp is called with false, or turnDown with any value. While this command is active, other movement commands or mouse or keyboard operations will be countermanded by the still pending turnUp command.

Parameters
s- true move, false stop
Note
Use StelMovementMgr.panView for precise control of view movements.

◆ zoomIn

void StelMovementMgr::zoomIn ( bool  s)
slot

Zooming pauses when the field of view limit (5 arc seconds) is reached, but the command remains active until zoomIn is called with false, or zoomOut with any value. While this command is active, other movement commands or mouse or keyboard operations will be countermanded by the still pending zoomIn command.

Parameters
s- true zoom, false stop

◆ zoomOut

void StelMovementMgr::zoomOut ( bool  s)
slot

Zooming pauses when the field of view limit (235 degrees) is reached, but the command remains active until zoomOut is called with false, or zoomIn with any value. While this command is active, other movement commands or mouse or keyboard operations will be countermanded by the still pending zoomOut command.

Parameters
s- true zoom, false stop

◆ zoomTo

void StelMovementMgr::zoomTo ( double  aimFov,
float  zoomDuration = 1. 
)
slot
Parameters
aimFovThe desired field of view in degrees.
zoomDurationThe time that the operation should take to complete. [seconds]