Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

StelMainScriptAPI Class Reference

Provide script API for Stellarium global functions. More...

#include <StelScriptMgr.hpp>

List of all members.

Public Slots

void setJDay (double JD)
double getJDay (void) const
void setDate (const QString &dt, const QString &spec="utc")
void setTimeRate (double ts)
double getTimeRate (void) const
void wait (double t)
void waitFor (const QString &dt, const QString &spec="utc")
void selectObjectByName (const QString &name, bool pointer=false)
void clear (const QString &state="natural")
void moveToAltAzi (const QString &alt, const QString &azi, float duration=1.)
void moveToRaDec (const QString &ra, const QString &dec, float duration=1.)
void setObserverLocation (double longitude, double latitude, double altitude, double duration=1., const QString &name="", const QString &planet="")
void setObserverLocation (const QString id, double duration=1.)
void screenshot (const QString &prefix, bool invert=false, const QString &dir="")
void setHideGui (bool b)
void setMinFps (float m)
float getMinFps ()
void setMaxFps (float m)
float getMaxFps ()
void loadSkyImage (const QString &id, const QString &filename, double ra0, double dec0, double ra1, double dec1, double ra2, double dec2, double ra3, double dec3, double minRes=2.5, double maxBright=14, bool visible=true)
void loadSkyImage (const QString &id, const QString &filename, const QString &ra0, const QString &dec0, const QString &ra1, const QString &dec1, const QString &ra2, const QString &dec2, const QString &ra3, const QString &dec3, double minRes=2.5, double maxBright=14, bool visible=true)
void loadSkyImage (const QString &id, const QString &filename, double ra, double dec, double angSize, double rotation, double minRes=2.5, double maxBright=14, bool visible=true)
void loadSkyImage (const QString &id, const QString &filename, const QString &ra, const QString &dec, double angSize, double rotation, double minRes=2.5, double maxBright=14, bool visible=true)
void removeSkyImage (const QString &id)
void loadSound (const QString &filename, const QString &id)
void playSound (const QString &id)
void pauseSound (const QString &id)
void stopSound (const QString &id)
void dropSound (const QString &id)
void debug (const QString &s)

Signals

void requestLoadSkyImage (const QString &id, const QString &filename, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double minRes, double maxBright, bool visible)
void requestRemoveSkyImage (const QString &id)
void requestLoadSound (const QString &filename, const QString &id)
void requestPlaySound (const QString &id)
void requestPauseSound (const QString &id)
void requestStopSound (const QString &id)
void requestDropSound (const QString &id)

Public Member Functions

 StelMainScriptAPI (QObject *parent=0)

Properties

double JDay
double timeSpeed


Detailed Description

Provide script API for Stellarium global functions.

Public slots in this class may be used in Stellarium scripts, and are accessed as member function to the "core" scripting object. Module-specific functions, such as setting and clearing of display flags (e.g. LandscapeMgr::setFlagAtmosphere) can be accessed directly via the scripting object with the class name, e.g. by using the scripting command: LandscapeMgr.setFlagAtmosphere(true);


Member Function Documentation

void StelMainScriptAPI::setJDay ( double  JD  )  [slot]

Set the current date in Julian Day.

Parameters:
JD the Julian Date

double StelMainScriptAPI::getJDay ( void   )  const [slot]

Get the current date in Julian Day.

Returns:
the Julian Date

void StelMainScriptAPI::setDate ( const QString &  dt,
const QString &  spec = "utc" 
) [slot]

set the date in ISO format, e.g.

"2008-03-24T13:21:01"

Parameters:
dt the date string to use. Formats:
  • ISO, e.g. "2008-03-24T13:21:01"
  • "now" (set sim time to real time)
  • relative, e.g. "+ 4 days", "-2 weeks". can use these units: seconds, minutes, hours, days, weeks, months, years. You may also append " sidereal" to use sidereal days and so on. You can also use "now" at the start. For example: "now + 3 hours sidereal" Note: you must use the plural all the time, even when the number of the unit is 1. i.e. use "+ 1 days" not "+1 day". Note: when sidereal time is used, the length of time for each unit is dependent on the current planet. By contrast when sidereal timeis not specified (i.e. solar time is used) the value is conventional - i.e. 1 day means 1 Earth Solar day.
spec "local" or "utc" - only has an effect when the ISO date type is used.

void StelMainScriptAPI::setTimeRate ( double  ts  )  [slot]

Set time speed in JDay/sec.

Parameters:
ts the new rate of passage of time as a multiple of real time. For example if ts is 1, time will pass at the normal rate. If ts == 10 then simulation time will pass at 10 times the normal rate. If ts is negative, simulation time will go backwards.

double StelMainScriptAPI::getTimeRate ( void   )  const [slot]

Get simulation time rate.

Returns:
time speed as a multiple of real time.

void StelMainScriptAPI::wait ( double  t  )  [slot]

Pauses the script for t seconds.

Parameters:
t the number of seconds to wait

void StelMainScriptAPI::waitFor ( const QString &  dt,
const QString &  spec = "utc" 
) [slot]

Waits until a specified simulation date/time.

This function will take into account the rate (and direction) in which simulation time is passing. e.g. if a future date is specified and the time is moving backwards, the function will return immediately. If the time rate is 0, the function will not wait. This is to prevent infinite wait time.

Parameters:
dt the date string to use
spec "local" or "utc"

void StelMainScriptAPI::selectObjectByName ( const QString &  name,
bool  pointer = false 
) [slot]

Select an object by name.

Parameters:
name the name of the object to select (english) If the name is "", any currently selected objects will be de-selected.
pointer whether or not to have the selection pointer enabled

void StelMainScriptAPI::clear ( const QString &  state = "natural"  )  [slot]

Clear the display options, setting a "standard" view.

Preset states:

  • natural : azimuthal mount, atmosphere, landscape, no lines, labels or markers
  • starchart : equatorial mount, constellation lines, no landscape, atmoshere etc. labels & markers on.
    Parameters:
    state the name of a preset state.

void StelMainScriptAPI::moveToAltAzi ( const QString &  alt,
const QString &  azi,
float  duration = 1. 
) [slot]

move the current viewing direction to some specified altitude and azimuth angles may be specified in a format recognised by StelUtils::getDecAngle()

Parameters:
alt the altitude angle
azi the azimuth angle
duration the duration of the movement in seconds

void StelMainScriptAPI::moveToRaDec ( const QString &  ra,
const QString &  dec,
float  duration = 1. 
) [slot]

move the current viewing direction to some specified right ascension and declination angles may be specified in a format recognised by StelUtils::getDecAngle()

Parameters:
ra the right ascension angle
dec the declination angle
duration the duration of the movement in seconds

void StelMainScriptAPI::setObserverLocation ( double  longitude,
double  latitude,
double  altitude,
double  duration = 1.,
const QString &  name = "",
const QString &  planet = "" 
) [slot]

Set the observer location.

Parameters:
longitude the longitude in degrees. E is +ve. values out of the range -180 .. 180 mean that the longitude will not be set
latitude the longitude in degrees. N is +ve. values out of the range -180 .. 180 mean that the latitude will not be set
altitude the new altitude in meters. values less than -1000 mean the altitude will not be set.
duration the time for the transition from the old to the new location.
name A name for the location (which will appear in the status bar.
planet the English name of the new planet. If the planet name is not known (e.g. ""), the planet will not be set.

void StelMainScriptAPI::setObserverLocation ( const QString  id,
double  duration = 1. 
) [slot]

Set the location by the name of the location.

Parameters:
id the location ID as it would be found in the database of locations - do a search in the Location window to see what where is. e.g. "York, UnitedKingdom".
duration the number of seconds to take to move location.

void StelMainScriptAPI::screenshot ( const QString &  prefix,
bool  invert = false,
const QString &  dir = "" 
) [slot]

Save a screenshot.

Parameters:
prefix the prefix for the file name to use
dir the path of the directory to save the screenshot in. If none is specified, the default screenshot directory will be used.
invert whether colors have to be inverted in the output image

void StelMainScriptAPI::setHideGui ( bool  b  )  [slot]

Hide or show the GUI (toolbars).

Parameters:
b the new hidden status of the toolbars, i.e. if b==true, the toolbars will be hidden, else they will be made visible.

void StelMainScriptAPI::setMinFps ( float  m  )  [slot]

Set the minimum frames per second.

Usually this minimum will be switched to after there are no user events for some seconds to save power. However, if can be useful to set this to a high value to improve playing smoothness in scripts.

Parameters:
m the new minimum fps setting.

float StelMainScriptAPI::getMinFps (  )  [slot]

Get the current minimum frames per second.

void StelMainScriptAPI::setMaxFps ( float  m  )  [slot]

Set the maximum frames per second.

Parameters:
m the new maximum fps setting.

float StelMainScriptAPI::getMaxFps (  )  [slot]

Get the current maximum frames per second.

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
double  ra0,
double  dec0,
double  ra1,
double  dec1,
double  ra2,
double  dec2,
double  ra3,
double  dec3,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true 
) [slot]

Load an image which will have sky coordinates.

Parameters:
id a string ID to be used when referring to this image (e.g. when changing the displayed status or deleting it.
filename the file name of the image. If a relative path is specified, "scripts/" will be prefixed before the image is searched for using StelFileMgr.
ra0 The right ascension of the first corner of the image in degrees
dec0 The declenation of the first corner of the image in degrees
ra1 The right ascension of the second corner of the image in degrees
dec1 The declenation of the second corner of the image in degrees
ra2 The right ascension of the third corner of the image in degrees
dec2 The declenation of the third corner of the image in degrees
ra3 The right ascension of the fourth corner of the image in degrees
dec3 The declenation of the fourth corner of the image in degrees
minRes The minimum resolution setting for the image
maxBright The maximum brightness setting for the image
visible The initial visibility of the image

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
const QString &  ra0,
const QString &  dec0,
const QString &  ra1,
const QString &  dec1,
const QString &  ra2,
const QString &  dec2,
const QString &  ra3,
const QString &  dec3,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true 
) [slot]

Convenience function which allows the user to provide RA and DEC angles as strings (e.g.

"12d 14m 8s" or "5h 26m 8s" - formats accepted by StelUtils::getDecAngle()).

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
double  ra,
double  dec,
double  angSize,
double  rotation,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true 
) [slot]

Convenience function which allows loading of a sky image based on a central coordinate, angular size and rotation.

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
const QString &  ra,
const QString &  dec,
double  angSize,
double  rotation,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true 
) [slot]

Convenience function which allows loading of a sky image based on a central coordinate, angular size and rotation.

void StelMainScriptAPI::removeSkyImage ( const QString &  id  )  [slot]

Remove a SkyImage.

Parameters:
id the ID of the image to remove.

void StelMainScriptAPI::loadSound ( const QString &  filename,
const QString &  id 
) [slot]

Load a sound from a file.

Parameters:
filename the name of the file to load.
id the identifier which will be used to refer to the sound when calling playSound, pauseSound, stopSound and dropSound.

void StelMainScriptAPI::playSound ( const QString &  id  )  [slot]

Play a sound which has previously been loaded with loadSound.

Parameters:
id the identifier used when loadSound was called

void StelMainScriptAPI::pauseSound ( const QString &  id  )  [slot]

Pause a sound which is playing.

Subsequent playSound calls will resume playing from the position in the file when it was paused.

Parameters:
id the identifier used when loadSound was called

void StelMainScriptAPI::stopSound ( const QString &  id  )  [slot]

Stop a sound from playing.

This resets the position in the sound to the start so that subsequent playSound calls will start from the beginning.

Parameters:
id the identifier used when loadSound was called

void StelMainScriptAPI::dropSound ( const QString &  id  )  [slot]

Drop a sound from memory.

You should do this before the end of your script.

Parameters:
id the identifier used when loadSound was called

void StelMainScriptAPI::debug ( const QString &  s  )  [slot]

print a debugging message to the console

Parameters:
s the message to be displayed on the console.


Generated on Mon Mar 9 16:16:17 2009 for Stellarium by  doxygen 1.5.5