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

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

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.

ra

The right ascension of the center of the image in J2000 frame degrees

dec

The declination of the center of the image in J2000 frame degrees

angSize

The angular size of the image in arc minutes

rotation

The clockwise rotation angle 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 &

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.

Parameters are the same as the version of this function which takes double values for the ra and dec, except here text expressions of angles may be used.

void StelMainScriptAPI::loadSkyImageAltAz

(

const QString &

id,

const QString &

filename,

double

alt0,

double

azi0,

double

alt1,

double

azi1,

double

alt2,

double

azi2,

double

alt3,

double

azi3,

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.

alt0

The altitude angle of the first corner of the image in degrees

azi0

The azimuth angle of the first corner of the image in degrees

alt1

The altitude angle of the second corner of the image in degrees

azi1

The azimuth angle of the second corner of the image in degrees

alt2

The altitude angle of the third corner of the image in degrees

azi2

The azimuth angle of the third corner of the image in degrees

alt3

The altitude angle of the fourth corner of the image in degrees

azi3

The azimuth angle 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::loadSkyImageAltAz

(

const QString &

id,

const QString &

filename,

double

alt,

double

azi,

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.

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.

alt

The altitude angle of the center of the image in degrees

azi

The azimuth angle of the center of the image in degrees

angSize

The angular size of the image in arc minutes

rotation

The clockwise rotation angle 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::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::loadVideo

(

const QString &

filename,

const QString &

id,

float

x,

float

y,

bool

show,

float

alpha

)

slot

Load a video from a file.

Parameters

filename

the name of the file to load.

id

the identifier which will be used to refer to the video when calling playVideo, pauseVideo, stopVideo and dropVideo.

x

the x-coordinate for the video widget.

y

the y-coordinate for the video widget.

show

the visibility state for the video.

alpha

the initial alpha value of the video.

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::moveToRaDecJ2000

(

const QString &

ra,

const QString &

dec,

float

duration = 1.

)

slot

move the current viewing direction to some specified right ascension and declination in the J2000 frame 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::pauseScript

(

)

slot

Pause the currently running script.

Note that you may need to use the key '6' or the GUI to resume script execution.

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::pauseVideo

(

const QString &

id

)

slot

Pause a video which is playing.

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

Parameters

id

the identifier used when loadVideo was called

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::playVideo

(

const QString &

id

)

slot

Play a video which has previously been loaded with loadVideo.

Parameters

id

the identifier used when loadVideo was called

void StelMainScriptAPI::quitStellarium

(

)

slot

Close Stellarium.

void StelMainScriptAPI::removeSkyImage

(

const QString &

id

)

slot

Remove a SkyImage.

Parameters

id

the ID of the image to remove.

void StelMainScriptAPI::resizeVideo

(

const QString &

id,

float

w,

float

h

)

slot

Resize the video widget to the specified width, height.

Parameters

id

the identifier used when loadVideo was called

w

the new width for the widget.

h

the new height for the widget.

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::seekVideo

(

const QString &

id,

qint64

ms

)

slot

Seeks a video to the requested time.

Parameters

id

the identifier used when loadVideo was called

ms

the time in milliseconds from the start of the media.

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::setAppLanguage

(

QString

langCode

)

slot

Set the current application language.

Parameters

langCode

two letter language code, e.g. "en", or "de".

void StelMainScriptAPI::setDate

(

const QString &

dt,

const QString &

spec = "utc",

const bool &

enableDeltaT = true

)

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

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.

Parameters

spec

"local" or "utc" - only has an effect when the ISO date type is used. Defaults to "utc".

enableDeltaT

is true or false - enable Delta-T correction or not. Defaults to "true".

Note

for fully compatibles behavior of this function with the version 0.11.4 or earlier, you should call core.setDeltaTAlgorithm("WithoutCorrection"); before running core.setDate(); for disabling DeltaT correction.

Note this only applies to GUI plugins which provide the public slot "setGuiVisible(bool)".

Parameters

b

if true, show the GUI, if false, hide the GUI.

void StelMainScriptAPI::setJDay

(

double

JD

)

slot

Set the current date in Julian Day.

Parameters

JD

the Julian Date

void StelMainScriptAPI::setMaxFps

(

float

m

)

slot

Set the maximum frames per second.

Parameters

m

the new maximum fps setting.

void StelMainScriptAPI::setMilkyWayIntensity

(

double

i

)

slot

Set Milky Way intensity.

Parameters

i

value of intensity for the Milky Way

void StelMainScriptAPI::setMilkyWayVisible

(

bool

b

)

slot

Show or hide the Milky Way.

Parameters

b

if true, show the Milky Way, if false, hide the Milky Way.

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.

void StelMainScriptAPI::setMJDay

(

double

MJD

)

slot

Set the current date in Modified Julian Day.

Parameters

MJD

the Modified Julian Date

void StelMainScriptAPI::setMountMode

(

const QString &

mode

)

slot

Set the mount mode.

Parameters

mode

should be "equatorial" or "azimuthal"

void StelMainScriptAPI::setNightMode

(

bool

b

)

slot

Set the status of Night Mode.

Parameters

b

if true, set Night Mode, else set Normal Mode

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,

float

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::setProjectionMode

(

const QString &

id

)

slot

Set the current projection mode.

Parameters

id

the name of the projection mode to use, e.g. "Perspective" and so on. valid values of id are:

ProjectionPerspective

ProjectionEqualArea

ProjectionStereographic

ProjectionFisheye

ProjectionHammer

ProjectionCylinder

ProjectionMercator

ProjectionOrthographic

void StelMainScriptAPI::setRealTime

(

)

slot

Set the simulation time to the current system time, and the time rate to 1.

void StelMainScriptAPI::setScriptRate

(

double

r

)

slot

Set the script execution rate as a multiple of normal execution speed.

Parameters

r

the multiple of the normal script execution speed, i.e. if 5 is passed the script will execute 5 times faster than it would if the script rate was 1.

void StelMainScriptAPI::setSelectedObjectInfo

(

const QString &

level

)

slot

Set the amount of selected object information to display.

Parameters

level

can be "AllInfo", "ShortInfo", "None"

void StelMainScriptAPI::setSkyCulture

(

const QString &

id

)

slot

Set the current sky culture.

Parameters

id

the ID of the sky culture to set, e.g. western or inuit etc.

void StelMainScriptAPI::setSkyLanguage

(

QString

langCode

)

slot

Set the current sky language.

Parameters

langCode

two letter language code, e.g. "en", or "de".

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.

void StelMainScriptAPI::setVideoAlpha

(

const QString &

id,

float

alpha

)

slot

Set the alpha value of a video when visible.

Parameters

id

the identifier used when loadVideo was called

alpha

the new alpha value to set.

void StelMainScriptAPI::setVideoXY

(

const QString &

id,

float

x,

float

y

)

slot

Sets the position of the video widget.

Parameters

id

the identifier used when loadVideo was called

x

the new x-coordinate for the video.

y

the new y-coordinate for the video.

void StelMainScriptAPI::showVideo

(

const QString &

id,

bool

show

)

slot

Set the visibility state of a video.

Parameters

id

the identifier used when loadVideo was called

show

the new visible state of the video.

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::stopVideo

(

const QString &

id

)

slot

Stop a video from playing.

This resets the position in the video to the start so that subsequent playVideo calls will start from the beginning.

Parameters

id

the identifier used when loadVideo was called

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