Stellarium  0.16.1
List of all members | Classes | Public Types | Public Slots | Signals | Public Member Functions | Properties
StelMovementMgr Class Reference

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

#include <StelMovementMgr.hpp>

+ Inheritance diagram for StelMovementMgr:
+ Collaboration diagram for StelMovementMgr:

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. More...
 
- 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. More...
 
void setEquatorialMount (bool b)
 Define whether we should use equatorial mount or altazimuthal. More...
 
void setFlagTracking (bool b=true)
 Set object tracking on/off and go to selected object. More...
 
bool getFlagTracking (void) const
 Get current object tracking status. More...
 
void setFlagLockEquPos (bool b)
 Set whether sky position is to be locked. More...
 
bool getFlagLockEquPos (void) const
 Get whether sky position is locked. More...
 
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. More...
 
bool getFlagAutoZoomOutResetsDirection (void)
 Get whether auto zoom out will reset the viewing direction to the inital value. More...
 
bool getFlagEnableZoomKeys () const
 Get whether keys can control zoom. More...
 
void setFlagEnableZoomKeys (bool b)
 Set whether keys can control zoom. More...
 
bool getFlagEnableMoveKeys () const
 Get whether keys can control movement. More...
 
void setFlagEnableMoveKeys (bool b)
 Set whether keys can control movement. More...
 
bool getFlagEnableMoveAtScreenEdge () const
 Get whether being at the edge of the screen activates movement. More...
 
void setFlagEnableMoveAtScreenEdge (bool b)
 Set whether being at the edge of the screen activates movement. More...
 
bool getFlagEnableMouseNavigation () const
 Get whether mouse can control movement. More...
 
void setFlagEnableMouseNavigation (bool b)
 Set whether mouse can control movement. More...
 
bool getFlagIndicationMountMode () const
 Get the state of flag for indication of mount mode. More...
 
void setFlagIndicationMountMode (bool b)
 Set the state of flag for indication of mount mode. More...
 
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 moveDuration=1.)
 Change the zoom level. More...
 
double getCurrentFov () const
 Get the current Field Of View in degrees. More...
 
double getInitFov () const
 Return the initial default FOV in degree. More...
 
void setInitFov (double fov)
 Set the initial Field Of View in degree. More...
 
const Vec3d getInitViewingDirection ()
 Return the inital 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. More...
 
void setMaxFov (double max)
 Set the maximum field of View in degrees. More...
 
double getMaxFov (void) const
 Get the maximum field of View in degrees. More...
 
double getMinFov (void) const
 Get the minimum field of View in degrees. More...
 
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. More...
 
void autoZoomOut (float moveDuration=1.f, bool full=0)
 Unzoom to the previous position. More...
 
double getAimFov (void) const
 If currently zooming, return the target FOV, otherwise return current FOV in degree. More...
 
void turnRight (bool)
 Viewing direction function : true move, false stop. More...
 
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. More...
 
void lookNadir (void)
 Look immediately towards Nadir, turning southern horizon to screen top. More...
 
void lookTowardsNCP (void)
 Look immediately towards North Celestial pole. More...
 
void lookTowardsSCP (void)
 Look immediately towards South Celestial pole. More...
 
void moveViewport (float offsetX, float offsetY, const float duration=0.f)
 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. More...
 
MountMode getMountMode (void) const
 Get current mount type defining the reference frame in which head movements occur. More...
 
bool getEquatorialMount (void) const
 
void setInhibitAllAutomoves (bool inhibit)
 Function designed only for scripting context. More...
 
Vec2f getViewportOffsetTarget () const
 Returns the targetted value of the viewport offset. More...
 
float getViewportHorizontalOffsetTarget () const
 
float getViewportVerticalOffsetTarget () const
 
void setViewportHorizontalOffsetTarget (float f)
 
void setViewportVerticalOffsetTarget (float f)
 

Signals

void flagTrackingChanged (bool b)
 Emitted when the tracking property changes. More...
 
void equatorialMountChanged (bool b)
 
void flagAutoZoomOutResetsDirectionChanged (bool b)
 
void viewportHorizontalOffsetTargetChanged (float f)
 
void viewportVerticalOffsetTargetChanged (float f)
 

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) More...
 
virtual void draw (StelCore *)
 Implement required draw function. Does nothing. More...
 
virtual void handleKeys (QKeyEvent *event)
 Handle keyboard events. More...
 
virtual bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse movement events. More...
 
virtual void handleMouseWheel (class QWheelEvent *event)
 Handle mouse wheel events. More...
 
virtual void handleMouseClicks (class QMouseEvent *event)
 Handle mouse click events. More...
 
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. More...
 
void updateMotion (double deltaTime)
 Increment/decrement smoothly the vision field and position. Called in StelCore.update(). More...
 
double getZoomSpeed ()
 Get the zoom speed. More...
 
Vec3d getViewUpVectorJ2000 () const
 Return the current up view vector in J2000 coordinates. More...
 
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. More...
 
virtual QString getAuthorName () const
 Get the name of the module author. More...
 
virtual QString getAuthorEmail () const
 Get the email adress of the module author. More...
 
virtual bool configureGui (bool show=true)
 Detect or show the configuration GUI elements for the module. More...
 

Properties

bool equatorialMount
 
bool tracking
 
float viewportHorizontalOffsetTarget
 
float viewportVerticalOffsetTarget
 
bool flagAutoZoomOutResetsDirection
 

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

Manages the head movements and zoom operations.

Definition at line 33 of file StelMovementMgr.hpp.

Member Enumeration Documentation

Possible mount modes defining the reference frame in which head movements occur.

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

Definition at line 64 of file StelMovementMgr.hpp.

Named constants for zoom operations.

Definition at line 67 of file StelMovementMgr.hpp.

Member Function Documentation

void StelMovementMgr::autoZoomIn ( float  moveDuration = 1.f,
bool  allowManualZoom = 1 
)
slot

Go and zoom to the selected object. A later call to autoZoomOut will come back to the previous zoom level.

void StelMovementMgr::autoZoomOut ( float  moveDuration = 1.f,
bool  full = 0 
)
slot

Unzoom to the previous position.

virtual void StelMovementMgr::draw ( StelCore )
inlinevirtual

Implement required draw function. Does nothing.

Reimplemented from StelModule.

Definition at line 91 of file StelMovementMgr.hpp.

void StelMovementMgr::flagTrackingChanged ( bool  b)
signal

Emitted when the tracking property changes.

double StelMovementMgr::getAimFov ( void  ) const
slot

If currently zooming, return the target FOV, otherwise return current FOV in degree.

float StelMovementMgr::getAutoMoveDuration ( void  ) const
inlineslot

Get automove duration in seconds.

Returns
the number of seconds it takes for an auto-move operation to complete.

Definition at line 155 of file StelMovementMgr.hpp.

virtual double StelMovementMgr::getCallOrder ( StelModuleActionName  actionName) const
virtual

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.

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.

double StelMovementMgr::getCurrentFov ( ) const
inlineslot

Get the current Field Of View in degrees.

Definition at line 219 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagAutoZoomOutResetsDirection ( void  )
inlineslot

Get whether auto zoom out will reset the viewing direction to the inital value.

Definition at line 160 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagEnableMouseNavigation ( ) const
inlineslot

Get whether mouse can control movement.

Definition at line 178 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagEnableMoveAtScreenEdge ( ) const
inlineslot

Get whether being at the edge of the screen activates movement.

Definition at line 173 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagEnableMoveKeys ( ) const
inlineslot

Get whether keys can control movement.

Definition at line 168 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagEnableZoomKeys ( ) const
inlineslot

Get whether keys can control zoom.

Definition at line 163 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagIndicationMountMode ( ) const
inlineslot

Get the state of flag for indication of mount mode.

Definition at line 183 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagLockEquPos ( void  ) const
inlineslot

Get whether sky position is locked.

Definition at line 142 of file StelMovementMgr.hpp.

bool StelMovementMgr::getFlagTracking ( void  ) const
inlineslot

Get current object tracking status.

Definition at line 137 of file StelMovementMgr.hpp.

double StelMovementMgr::getInitFov ( ) const
inlineslot

Return the initial default FOV in degree.

Definition at line 222 of file StelMovementMgr.hpp.

const Vec3d StelMovementMgr::getInitViewingDirection ( )
inlineslot

Return the inital viewing direction in altazimuthal coordinates.

Definition at line 227 of file StelMovementMgr.hpp.

double StelMovementMgr::getMaxFov ( void  ) const
inlineslot

Get the maximum field of View in degrees.

Definition at line 240 of file StelMovementMgr.hpp.

double StelMovementMgr::getMinFov ( void  ) const
inlineslot

Get the minimum field of View in degrees.

Definition at line 243 of file StelMovementMgr.hpp.

MountMode StelMovementMgr::getMountMode ( void  ) const
inlineslot

Get current mount type defining the reference frame in which head movements occur.

Definition at line 293 of file StelMovementMgr.hpp.

Vec3d StelMovementMgr::getViewDirectionJ2000 ( ) const
inlineslot

Return the current viewing direction in the equatorial J2000 frame.

Definition at line 233 of file StelMovementMgr.hpp.

Vec2f StelMovementMgr::getViewportOffsetTarget ( ) const
inlineslot

Returns the targetted value of the viewport offset.

Definition at line 301 of file StelMovementMgr.hpp.

Vec3d StelMovementMgr::getViewUpVectorJ2000 ( ) const

Return the current up view vector in J2000 coordinates.

double StelMovementMgr::getZoomSpeed ( )
inline

Get the zoom speed.

Definition at line 113 of file StelMovementMgr.hpp.

virtual void StelMovementMgr::handleKeys ( QKeyEvent *  event)
virtual

Handle keyboard events.

Reimplemented from StelModule.

virtual void StelMovementMgr::handleMouseClicks ( class QMouseEvent *  event)
virtual

Handle mouse click events.

Reimplemented from StelModule.

virtual bool StelMovementMgr::handleMouseMoves ( int  x,
int  y,
Qt::MouseButtons  b 
)
virtual

Handle mouse movement events.

Reimplemented from StelModule.

virtual void StelMovementMgr::handleMouseWheel ( class QWheelEvent *  event)
virtual

Handle mouse wheel events.

Reimplemented from StelModule.

virtual bool StelMovementMgr::handlePinch ( qreal  scale,
bool  started 
)
virtual

Handle pinch gesture.

Reimplemented from StelModule.

virtual void StelMovementMgr::init ( )
virtual

Initializes the object based on the application settings Includes:

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

void StelMovementMgr::lookEast ( bool  zero = false)
slot

Look immediately towards East.

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

Look immediately towards Nadir, turning southern horizon to screen top.

void StelMovementMgr::lookNorth ( bool  zero = false)
slot

Look immediately towards North.

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

Look immediately towards South.

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

Look immediately towards North Celestial pole.

void StelMovementMgr::lookTowardsSCP ( void  )
slot

Look immediately towards South Celestial pole.

void StelMovementMgr::lookWest ( bool  zero = false)
slot

Look immediately towards West.

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

Look immediately towards Zenith, turning southern horizon to screen bottom.

void StelMovementMgr::moveToAltAzi ( const Vec3d aim,
const Vec3d aimUp,
float  moveDuration = 1.,
ZoomingMode  zooming = ZoomNone 
)
slot

Move the view to a specified AltAzimuthal position.

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!
void StelMovementMgr::moveToJ2000 ( const Vec3d aim,
const Vec3d aimUp,
float  moveDuration = 1.,
ZoomingMode  zooming = ZoomNone 
)
slot

Move the view to a specified J2000 position.

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());
void StelMovementMgr::moveViewport ( float  offsetX,
float  offsetY,
const float  duration = 0.f 
)
slot

start animated move of the viewport offset.

Parameters
offsetXnew horizontal viewport offset, percent. clamped to [-50...50]
offsetYnew horizontal viewport offset, percent. clamped to [-50...50]
durationanimation duration, seconds.
Note
Only vertical viewport is really meaningful.
void StelMovementMgr::panView ( const double  deltaAz,
const double  deltaAlt 
)
slot

Move view in alt/az (or equatorial if in that mode) coordinates.

Changes to viewing direction are instantaneous.

Parameters
deltaAzchange in azimuth angle in radians
deltaAltchange in altitude angle in radians
void StelMovementMgr::setAutoMoveDuration ( float  f)
inlineslot

Set automove duration in seconds.

Parameters
fthe number of seconds it takes for an auto-move operation to complete.

Definition at line 152 of file StelMovementMgr.hpp.

void StelMovementMgr::setEquatorialMount ( bool  b)
slot

Define whether we should use equatorial mount or altazimuthal.

void StelMovementMgr::setFlagAutoZoomOutResetsDirection ( bool  b)
inlineslot

Set whether auto zoom out will reset the viewing direction to the inital value.

Definition at line 158 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagEnableMouseNavigation ( bool  b)
inlineslot

Set whether mouse can control movement.

Definition at line 180 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagEnableMoveAtScreenEdge ( bool  b)
inlineslot

Set whether being at the edge of the screen activates movement.

Definition at line 175 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagEnableMoveKeys ( bool  b)
inlineslot

Set whether keys can control movement.

Definition at line 170 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagEnableZoomKeys ( bool  b)
inlineslot

Set whether keys can control zoom.

Definition at line 165 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagIndicationMountMode ( bool  b)
inlineslot

Set the state of flag for indication of mount mode.

Definition at line 185 of file StelMovementMgr.hpp.

void StelMovementMgr::setFlagLockEquPos ( bool  b)
slot

Set whether sky position is to be locked.

void StelMovementMgr::setFlagTracking ( bool  b = true)
slot

Set object tracking on/off and go to selected object.

void StelMovementMgr::setInhibitAllAutomoves ( bool  inhibit)
inlineslot

Function designed only for scripting context.

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

Definition at line 298 of file StelMovementMgr.hpp.

void StelMovementMgr::setInitFov ( double  fov)
inlineslot

Set the initial Field Of View in degree.

Definition at line 224 of file StelMovementMgr.hpp.

void StelMovementMgr::setInitViewDirectionToCurrent ( )
slot

Sets the initial direction of view to the current altitude and azimuth.

Note: Updates the configuration file.

void StelMovementMgr::setMaxFov ( double  max)
slot

Set the maximum field of View in degrees.

void StelMovementMgr::setMountMode ( MountMode  m)
slot

Set current mount type defining the reference frame in which head movements occur.

void StelMovementMgr::setViewDirectionJ2000 ( const Vec3d v)
slot

Set the current viewing direction in the equatorial J2000 frame.

void StelMovementMgr::toggleMountMode ( )
inlineslot

Toggle current mount mode between equatorial and altazimuthal.

Definition at line 130 of file StelMovementMgr.hpp.

void StelMovementMgr::turnRight ( bool  )
slot

Viewing direction function : true move, false stop.

virtual void StelMovementMgr::update ( double  )
inlinevirtual

Update time-dependent things (triggers a time dragging record if required)

Implements StelModule.

Definition at line 85 of file StelMovementMgr.hpp.

void StelMovementMgr::updateMotion ( double  deltaTime)

Increment/decrement smoothly the vision field and position. Called in StelCore.update().

void StelMovementMgr::zoomTo ( double  aimFov,
float  moveDuration = 1. 
)
slot

Change the zoom level.

Parameters
aimFovThe desired field of view in degrees.
moveDurationThe time that the operation should take to complete. [seconds]

The documentation for this class was generated from the following file: