Stellarium  0.19.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 moveToObject (const StelObjectP &target, float moveDuration=1., ZoomingMode zooming=ZoomNone)
 
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 inital viewing direction in altazimuthal coordinates.
 
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.
 
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)
 Viewing direction function : true move, false stop.
 
void turnLeft (bool)
 
void turnUp (bool)
 
void turnDown (bool)
 
void moveSlow (bool b)
 
void zoomIn (bool)
 
void zoomOut (bool)
 
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
 
- 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 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...
 

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.

◆ 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
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());

◆ 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.

◆ 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]