Stellarium  23.4
Public Slots | Signals | Public Member Functions | Properties
StelMainScriptAPI Class Reference

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

#include <StelMainScriptAPI.hpp>

Public Slots

static Vec3d vec3d (const double x, const double y, const double z)
 Create a Vec3d object. More...
 
static Vec3f vec3f (const float x, const float y, const float z)
 Create a Vec3f object. More...
 
static bool useQtScript ()
 Returns true if the script is running on the older, Qt5-based QtScript JavaScript engine. More...
 
static void setJDay (double JD)
 Set the current date as Julian Day number. More...
 
static double getJDay ()
 Get the current date as Julian Day number. More...
 
static void setMJDay (double MJD)
 Set the current date as Modified Julian Day. More...
 
static double getMJDay ()
 Get the current date as Modified Julian Day. More...
 
static void setDate (const QString &dateStr, const QString &spec="utc", const bool &dateIsDT=false)
 Sets Stellarium's date using an absolute or relative value. More...
 
static QString getDate (const QString &spec="utc")
 get the simulation date and time as a string in ISO format, e.g. More...
 
static QString getDeltaT ()
 get the DeltaT for the simulation date and time as a string in HMS format, e.g. More...
 
static double getDeltaTsec ()
 get the DeltaT for the simulation date and time as a double in seconds More...
 
static QString getDeltaTAlgorithm ()
 get the DeltaT equation name for the simulation date and time as a string More...
 
static void setDeltaTAlgorithm (QString algorithmName)
 set equation of the DeltaT for the simulation date and time More...
 
static void setTimeRate (double ts)
 Set time speed in JDay/sec. More...
 
static double getTimeRate ()
 Get simulation time rate. More...
 
static bool isRealTime ()
 Get the simulation time and rate state - is it "real time". More...
 
static void setRealTime ()
 Set the simulation time to the current system time, and the time rate to 1.
 
static bool isPlanetocentricCalculations ()
 Get the type of calculations in the simulation - is it "planetocentric calculations" or not. More...
 
static void setPlanetocentricCalculations (bool f)
 Set the flag for use planetocentric calculations.
 
static void selectObjectByName (const QString &name, bool pointer=false)
 Select an object by name. More...
 
static void selectConstellationByName (const QString &name)
 Select a constellation by name. More...
 
static QVariantMap getObjectInfo (const QString &name)
 Fetch a map with data about an object's position, magnitude and so on. More...
 
static QVariantMap getSelectedObjectInfo ()
 Fetch a map with data about the latest selected object's position, magnitude and so on. More...
 
static void addToSelectedObjectInfoString (const QString &str, bool replace=false)
 Add some arbitrary string to the object information of the currently selected object. More...
 
static void setStelProperty (const QString &propertyName, QVariant propertyValue)
 Set value for some StelProperty. More...
 
static QVariant getStelProperty (const QString &propertyName)
 Get value for some StelProperty. More...
 
static void clear (const QString &state="natural")
 Clear the display options, setting a "standard" view. More...
 
static double getViewAltitudeAngle ()
 Get the current viewing direction altitude angle at center of view. More...
 
static double getViewAzimuthAngle ()
 Get the current viewing direction azimuth angle at center of view. More...
 
static double getViewRaAngle ()
 Get the current viewing direction Right Ascension at center of view. More...
 
static double getViewDecAngle ()
 Get the current viewing direction Declination angle at center of view. More...
 
static double getViewRaJ2000Angle ()
 Get the current viewing direction Right Ascension in J2000 frame at center of view. More...
 
static double getViewDecJ2000Angle ()
 Get the current viewing direction Declination angle in J2000 frame at center of view. More...
 
static void moveToObject (const QString &name, float duration=1.)
 Move the current viewing direction to some object. More...
 
static void moveToSelectedObject (float duration=1.)
 Move the current viewing direction to selected object. More...
 
static void moveToAltAzi (const QString &alt, const QString &azi, float duration=1.)
 move the current viewing direction to some specified altitude and azimuth. More...
 
static void moveToRaDec (const QString &ra, const QString &dec, float duration=1.)
 move the current viewing direction to some specified right ascension and declination. More...
 
static void moveToRaDecJ2000 (const QString &ra, const QString &dec, float duration=1.)
 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() More...
 
static void moveToGalLongLat (const QString &lon, const QString &lat, float duration=1.)
 move the current viewing direction to some specified galactic coordinates angles may be specified in a format recognised by StelUtils::getDecAngle() More...
 
static void setObserverLocation (double longitude, double latitude, double altitude, double duration=1., const QString &name="", const QString &planet="")
 Set the observer location. More...
 
static void setObserverLocation (const QString &id, double duration=1.)
 Set the location by the name of the location. More...
 
static QString getObserverLocation ()
 Get the ID of the current observer location.
 
static QVariantMap getObserverLocationInfo ()
 Get the info of the current observer location. More...
 
static void setTimezone (QString tz, int markAsCustom=-1)
 set timezone name. More...
 
static QStringList getAllTimezoneNames ()
 Return an array of all timezone names valid for setTimezone(tzName)
 
static QList< double > geo2utm (const double longitude, const double latitude, const int zone=0)
 Coordinate conversion: geographic (WGS84)-->UTM. More...
 
static QList< double > utm2geo (const double easting, const double northing, const int zone, const bool north)
 Coordinate conversion: UTM->geographic (WGS84) More...
 
static void screenshot (const QString &prefix, bool invert=false, const QString &dir="", const bool overwrite=false, const QString &format="")
 Save a screenshot. More...
 
static void setGuiVisible (bool b)
 Show or hide the GUI (toolbars). More...
 
static void setSelectedObjectMarkerVisible (bool b)
 Show or hide the selection pointers/markers. More...
 
static void setGuiStyle (const QString &cssStyle)
 Use a custom CSS for the GUI. More...
 
static void setMinFps (float m)
 Set the minimum frames per second. More...
 
static float getMinFps ()
 Get the current minimum frames per second. More...
 
static void setMaxFps (float m)
 Set the maximum frames per second. More...
 
static float getMaxFps ()
 Get the current maximum frames per second. More...
 
static QString getMountMode ()
 Get the mount mode as a string. More...
 
static void setMountMode (const QString &mode)
 Set the mount mode. More...
 
static bool getNightMode ()
 Get the current status of Night Mode. More...
 
static void setNightMode (bool b)
 Set the status of Night Mode. More...
 
static QString getProjectionMode ()
 Get the current projection mode ID string. More...
 
void setProjectionMode (const QString &id)
 Set the current projection mode. More...
 
static Vec2d setWindowSize (int width, int height)
 Set size of current window. More...
 
static bool getDiskViewport ()
 Get the status of the disk viewport. More...
 
void setDiskViewport (bool b)
 Set the disk viewport. More...
 
static void setSphericMirror (bool b)
 Set the viewport distortion effect. More...
 
static void setViewportStretch (const float stretch)
 Set a lateral width distortion. More...
 
static QStringList getAllSkyCultureIDs ()
 Get a list of Sky Culture IDs. More...
 
static QString getSkyCulture ()
 Find out the current sky culture. More...
 
void setSkyCulture (const QString &id)
 Set the current sky culture. More...
 
static QString getSkyCultureName ()
 Find out the current sky culture and get it English name. More...
 
static QString getSkyCultureNameI18n ()
 Find out the current sky culture and get it localized name. More...
 
static bool getFlagGravityLabels ()
 Get the current status of the gravity labels option. More...
 
static bool getFlipHorz ()
 Get the current status of the horizontal flip. More...
 
static void setFlipHorz (bool b)
 Set the horizontal flip status. More...
 
static bool getFlipVert ()
 Get the current status of the vertical flip. More...
 
static void setFlipVert (bool b)
 Set the vertical flip status. More...
 
static void setFlagGravityLabels (bool b)
 Turn on/off gravity labels. More...
 
void loadSkyImage (const QString &id, const QString &filename, double lon0, double lat0, double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double minRes=2.5, double maxBright=14, bool visible=true, const QString &frame="EqJ2000", bool withAberration=true)
 Load an image into the sky background at the given sky coordinates and be warped with the sky. More...
 
void loadSkyImage (const QString &id, const QString &filename, const QString &lon0, const QString &lat0, const QString &lon1, const QString &lat1, const QString &lon2, const QString &lat2, const QString &lon3, const QString &lat3, double minRes=2.5, double maxBright=14, bool visible=true, const QString &frame="EqJ2000", bool withAberration=true)
 Convenience function which allows the user to provide longitudinal and latitudinal angles (RA/Dec or Long/Lat or Az/Alt) as strings (e.g. More...
 
void loadSkyImage (const QString &id, const QString &filename, double lon, double lat, double angSize, double rotation, double minRes=2.5, double maxBright=14, bool visible=true, const QString &frame="EqJ2000", bool withAberration=true)
 Convenience function which allows loading of a (square) sky image based on a central coordinate, angular size and rotation. More...
 
void loadSkyImage (const QString &id, const QString &filename, const QString &lon, const QString &lat, double angSize, double rotation, double minRes=2.5, double maxBright=14, bool visible=true, const QString &frame="EqJ2000", bool withAberration=true)
 Convenience function which allows loading of a (square) sky image based on a central coordinate, angular size and rotation. More...
 
void removeSkyImage (const QString &id)
 Remove a SkyImage. More...
 
static QVariantMap getScreenXYFromAltAzi (const QString &alt, const QString &azi)
 Get screen coordinates from some specified altitude and azimuth angles may be specified in a format recognised by StelUtils::getDecAngle() More...
 
void loadSound (const QString &filename, const QString &id)
 Load a sound from a file. More...
 
void playSound (const QString &id)
 Play a sound which has previously been loaded with loadSound. More...
 
void pauseSound (const QString &id)
 Pause a sound which is playing. More...
 
void stopSound (const QString &id)
 Stop a sound from playing. More...
 
void dropSound (const QString &id)
 Drop a sound from memory. More...
 
static qint64 getSoundPosition (const QString &id)
 Get position in a playing sound. More...
 
static qint64 getSoundDuration (const QString &id)
 Get duration of a sound object (if possible). More...
 
void loadVideo (const QString &filename, const QString &id, float x, float y, bool show=true, float alpha=1.0f)
 Load a video from a file. More...
 
void playVideo (const QString &id, bool keepVisibleAtEnd=false)
 Play a video which has previously been loaded with loadVideo. More...
 
void playVideoPopout (const QString &id, float fromX, float fromY, float atCenterX, float atCenterY, float finalSizeX, float finalSizeY, float popupDuration, bool frozenInTransition)
 Play a video which has previously been loaded with loadVideo with a complex effect. More...
 
void pauseVideo (const QString &id)
 Pause a video which is playing. More...
 
void stopVideo (const QString &id)
 Stop a video from playing. More...
 
void dropVideo (const QString &id)
 Drop a video from memory. More...
 
void seekVideo (const QString &id, qint64 ms, bool pause=false)
 Seeks a video to the requested time and either start playing or freeze there. More...
 
void setVideoXY (const QString &id, float x, float y, bool relative=false)
 Sets the position of the video widget. More...
 
void setVideoAlpha (const QString &id, float alpha)
 Set the alpha value of a video when visible. More...
 
void resizeVideo (const QString &id, float w, float h)
 Resize the video widget to the specified width, height. More...
 
void showVideo (const QString &id, bool show=true)
 Set the visibility state of a video. More...
 
static qint64 getVideoDuration (const QString &id)
 Get the duration of a loaded video, or -1. More...
 
static qint64 getVideoPosition (const QString &id)
 Get the current position of a loaded video, or -1. More...
 
static int getScreenWidth ()
 Get the screen width in pixels. More...
 
static int getScreenHeight ()
 Get the screen height (actually, height of Stellarium main view) in pixels. More...
 
static double getScriptRate ()
 Get the script execution rate as a multiple of normal execution speed. More...
 
static void setScriptRate (double r)
 Set the script execution rate as a multiple of normal execution speed. More...
 
static void pauseScript ()
 Pause the currently running script. More...
 
static void setSelectedObjectInfo (const QString &level)
 Set the amount of selected object information to display. More...
 
void exit ()
 Stop the script.
 
void quitStellarium ()
 Close Stellarium.
 
static QStringList getPropertyList ()
 Return a QStringlist of all available properties. Useful for script development...
 
static void debug (const QString &s)
 print a debugging message to the console More...
 
static void output (const QString &s)
 print an output message from script More...
 
static QString mapToString (const QVariantMap &map)
 print contents of a QVariantMap as []-delimited list of [ "key" = ] lists. More...
 
static void resetOutput (void)
 Reset (clear) output file.
 
static void saveOutputAs (const QString &filename)
 Save output file to new file (in same directory as output.txt). More...
 
static QString getAppLanguage ()
 Get the current application language. More...
 
static void setAppLanguage (QString langCode)
 Set the current application language. More...
 
static QString getSkyLanguage ()
 Get the current sky language. More...
 
static void setSkyLanguage (QString langCode)
 Set the current sky language. More...
 
static QString translate (QString englishText)
 Translate the string.
 
void goHome ()
 Go to defaults position and direction of view.
 
static int getBortleScaleIndex ()
 Returns the currently set Bortle scale index, which is used to simulate light pollution. More...
 
static void setBortleScaleIndex (int index)
 Changes the Bortle scale index, which is used to simulate light pollution. More...
 
static double refraction (double altitude, bool apparent=false)
 Apply refraction with current atmospheric parameters to altitude. More...
 
static double jdFromDateString (const QString &dt, const QString &spec)
 For use in setDate and waitFor For parameter descriptions see setDate(). More...
 
void wait (double t)
 Pauses the script for t seconds. More...
 
void waitFor (const QString &dt, const QString &spec="utc")
 Waits until a specified simulation date/time. More...
 
static QString getEnv (const QString &var)
 Retrieve value of environment variable. More...
 
static bool isModuleLoaded (const QString &moduleID)
 return whether a particular module has been loaded. More...
 
static QString getPlatformName (void)
 
static bool isMediaPlaybackSupported (void)
 Get the current status of media playback support. More...
 
static void setDisplayMaxLuminance (double cdPerSqM)
 Experimental. More...
 
static double getDisplayMaxLuminance ()
 Experimental. More...
 
static void setDisplayAdaptationLuminance (double cdPerSqM)
 Experimental. More...
 
static double getDisplayAdaptationLuminance ()
 Experimental. More...
 
static void setDisplayGamma (double gamma)
 Experimental: Set the display gamma. More...
 
static double getDisplayGamma ()
 Experimental: Get the display gamma. More...
 

Signals

void requestLoadSkyImage (const QString &id, const QString &filename, double lon0, double lat0, double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double minRes, double maxBright, bool visible, const StelCore::FrameType frameType, bool withAberration)
 
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)
 
void requestLoadVideo (const QString &filename, const QString &id, float x, float y, bool show, float alpha)
 
void requestPlayVideo (const QString &id, const bool keepVisibleAtEnd)
 
void requestPlayVideoPopout (const QString &id, float fromX, float fromY, float atCenterX, float atCenterY, float finalSizeX, float finalSizeY, float popupDuration, bool frozenInTransition)
 
void requestPauseVideo (const QString &id)
 
void requestStopVideo (const QString &id)
 
void requestDropVideo (const QString &id)
 
void requestSeekVideo (const QString &id, qint64 ms, bool pause=false)
 
void requestSetVideoXY (const QString &id, float x, float y, bool relative=false)
 
void requestSetVideoAlpha (const QString &id, float alpha)
 
void requestResizeVideo (const QString &id, float w, float h)
 
void requestShowVideo (const QString &id, bool show)
 
void requestSetProjectionMode (QString id)
 
void requestSetSkyCulture (QString id)
 
void requestSetDiskViewport (bool b)
 
void requestExit ()
 
void requestSetHomePosition ()
 

Public Member Functions

 StelMainScriptAPI (QObject *parent=Q_NULLPTR)
 

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

◆ addToSelectedObjectInfoString

static void StelMainScriptAPI::addToSelectedObjectInfoString ( const QString &  str,
bool  replace = false 
)
staticslot

Add some arbitrary string to the object information of the currently selected object.

if

  • replace==true, replace this extra string, if false, add to it. Note that while most objects keep this information after unselection and reselection, stars will start with no extra information when they become selected again.

◆ clear

static void StelMainScriptAPI::clear ( const QString &  state = "natural")
staticslot

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, atmosphere etc. labels & markers on.
  • deepspace : like starchart, but no planets, no eq.grid, no markers, no lines.
  • galactic : like deepspace, but in galactic coordinate system.
  • supergalactic : like deepspace, but in supergalactic coordinate system.
    Parameters
    statethe name of a preset state.

◆ debug

static void StelMainScriptAPI::debug ( const QString &  s)
staticslot

print a debugging message to the console

Parameters
sthe message to be displayed on the console.

◆ dropSound

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

Drop a sound from memory.

You should do this before the end of your script.

Parameters
idthe identifier used when loadSound was called

◆ dropVideo

void StelMainScriptAPI::dropVideo ( const QString &  id)
slot

Drop a video from memory.

You should do this before the end of your script.

Parameters
idthe identifier used when loadVideo() was called

◆ geo2utm

static QList<double> StelMainScriptAPI::geo2utm ( const double  longitude,
const double  latitude,
const int  zone = 0 
)
staticslot

Coordinate conversion: geographic (WGS84)-->UTM.

  • longitude geographic longitude from Greenwich, degrees
  • latitude geographic latitude from equator, degrees
  • zone UTM zone [1...60]. If 0, compute best-fit zone.
    Returns
    {{E[m], N[m], zone, gamma[deg], k}} The returned zone contains the input or, if input was 0 (or missing), the most appropriate zone. North or South is not returned but is trivially fround from latitude.

◆ getAllSkyCultureIDs

static QStringList StelMainScriptAPI::getAllSkyCultureIDs ( )
staticslot

Get a list of Sky Culture IDs.

Returns
a list of valid sky culture IDs

◆ getAppLanguage

static QString StelMainScriptAPI::getAppLanguage ( )
staticslot

Get the current application language.

Returns
two letter language code, e.g. "en", or "de" and so on.

◆ getBortleScaleIndex

static int StelMainScriptAPI::getBortleScaleIndex ( )
staticslot

Returns the currently set Bortle scale index, which is used to simulate light pollution.

Wrapper for StelSkyDrawer::getBortleScaleIndex

See also
https://en.wikipedia.org/wiki/Bortle_scale
Returns
the Bortle scale index in range [1,9]

◆ getDate

static QString StelMainScriptAPI::getDate ( const QString &  spec = "utc")
staticslot

get the simulation date and time as a string in ISO format, e.g.

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

Parameters
specif "utc", the returned string's timezone is UTC, else it is local time.
Returns
the current simulation time.

◆ getDeltaT

static QString StelMainScriptAPI::getDeltaT ( )
staticslot

get the DeltaT for the simulation date and time as a string in HMS format, e.g.

"0h1m68.2s"

Returns
the DeltaT for current simulation time.

◆ getDeltaTAlgorithm

static QString StelMainScriptAPI::getDeltaTAlgorithm ( )
staticslot

get the DeltaT equation name for the simulation date and time as a string

Returns
name of the DeltaT equation

◆ getDeltaTsec

static double StelMainScriptAPI::getDeltaTsec ( )
staticslot

get the DeltaT for the simulation date and time as a double in seconds

Returns
the DeltaT for current simulation time.

◆ getDiskViewport

static bool StelMainScriptAPI::getDiskViewport ( )
staticslot

Get the status of the disk viewport.

Returns
true if the disk view port is currently enabled

◆ getDisplayAdaptationLuminance

static double StelMainScriptAPI::getDisplayAdaptationLuminance ( )
staticslot

Experimental.

Returns
configured physical display adaptation luminance for tonemapping. The standard value is 50cd/m^2, appropriate for CRTs in dimly lit office environments.
Note
This is experimental and may not be available in later versions.

◆ getDisplayGamma

static double StelMainScriptAPI::getDisplayGamma ( )
staticslot

Experimental: Get the display gamma.

Initial default value is 2.2222 (for a CRT), and sRGB LCD (and similar modern) panels try to reproduce that. Higher gamma makes the sky brighter.

Note
This is experimental and may not be available in later versions.

◆ getDisplayMaxLuminance

static double StelMainScriptAPI::getDisplayMaxLuminance ( )
staticslot

Experimental.

Returns
configured physical display luminance for tonemapping. The standard value is 100cd/m^2, appropriate for CRTs. More modern screens often have more.
Note
This is experimental and may not be available in later versions.

◆ getEnv

static QString StelMainScriptAPI::getEnv ( const QString &  var)
staticslot

Retrieve value of environment variable.

Parameters
name.On desktop Windows and Qt before 5.10, this call may result in data loss if the original string contains Unicode characters not representable in the ANSI encoding.

◆ getFlagGravityLabels

static bool StelMainScriptAPI::getFlagGravityLabels ( )
staticslot

Get the current status of the gravity labels option.

Returns
true if gravity labels are enabled, else false

◆ getFlipHorz

static bool StelMainScriptAPI::getFlipHorz ( )
staticslot

Get the current status of the horizontal flip.

Returns
true if horizontal flip are enabled, else false

◆ getFlipVert

static bool StelMainScriptAPI::getFlipVert ( )
staticslot

Get the current status of the vertical flip.

Returns
true if vertical flip are enabled, else false

◆ getJDay

static double StelMainScriptAPI::getJDay ( )
staticslot

Get the current date as Julian Day number.

Returns
the Julian Day number

◆ getMaxFps

static float StelMainScriptAPI::getMaxFps ( )
staticslot

Get the current maximum frames per second.

Returns
The current maximum frames per second setting.

◆ getMinFps

static float StelMainScriptAPI::getMinFps ( )
staticslot

Get the current minimum frames per second.

Returns
The current minimum frames per second setting.

◆ getMJDay

static double StelMainScriptAPI::getMJDay ( )
staticslot

Get the current date as Modified Julian Day.

Returns
the Modified Julian Day

◆ getMountMode

static QString StelMainScriptAPI::getMountMode ( )
staticslot

Get the mount mode as a string.

Returns
"equatorial" or "azimuthal"

◆ getNightMode

static bool StelMainScriptAPI::getNightMode ( )
staticslot

Get the current status of Night Mode.

Returns
true if night mode is currently set

◆ getObjectInfo

static QVariantMap StelMainScriptAPI::getObjectInfo ( const QString &  name)
staticslot

Fetch a map with data about an object's position, magnitude and so on.

Parameters
nameis the English name of the object for which data will be returned.
Returns
a map of object data. Keys:
  • above-horizon : true, if celestial body is above horizon
  • altitude : apparent altitude angle in decimal degrees
  • azimuth : apparent azimuth angle in decimal degrees
  • altitude-geometric : geometric altitude angle in decimal degrees
  • azimuth-geometric : geometric azimuth angle in decimal degrees
  • ra : right ascension angle (current date frame) in decimal degrees
  • dec : declination angle (current date frame) in decimal degrees
  • raJ2000 : right ascension angle (J2000 frame) in decimal degrees
  • decJ2000 : declination angle (J2000 frame) in decimal degrees
  • parallacticAngle : parallactic angle in decimal degrees (for non-star objects only)
  • hourAngle-dd : hour angle in decimal degrees
  • hourAngle-hms : hour angle in HMS format (formatted string)
  • iauConstellation : 3-letter abbreviation of IAU constellation (string)
  • meanSidTm : mean sidereal time, in decimal degrees (on Earth only!)
  • appSidTm : mean sidereal time, in decimal degrees (on Earth only!)
  • glong : galactic longitude in decimal degrees
  • glat : galactic latitude in decimal degrees
  • sglong : supergalactic longitude in decimal degrees
  • sglat : supergalactic latitude in decimal degrees
  • elong : ecliptic longitude in decimal degrees (on Earth only!)
  • elat : ecliptic latitude in decimal degrees (on Earth only!)
  • elongJ2000 : ecliptic longitude (Earth's J2000 frame) in decimal degrees
  • elatJ2000 : ecliptic latitude (Earth's J2000 frame) in decimal degrees
  • vmag : visual magnitude
  • vmage : visual magnitude (extincted)
  • size: angular size in radians
  • size-dd : angular size in decimal degrees
  • size-deg : angular size in decimal degrees (formatted string)
  • size-dms : angular size in DMS format
  • localized-name : localized name
    The returned map can contain other information. For example, Solar System objects add:
  • distance : distance to object in AU (for Solar system objects only!)
  • phase : phase (illuminated fraction, 0..1) of object (for Solar system objects only!)
  • illumination : phase of object in percent (0..100) (for Solar system objects only!)
  • phase-angle : phase angle of object in radians (for Solar system objects only!)
  • phase-angle-dms : phase angle of object in DMS (for Solar system objects only!)
  • phase-angle-deg : phase angle of object in decimal degrees (for Solar system objects only!)
  • is-waning : whether phase angle is increasing, signifying the waning phase (for Solar system objects only!)
  • elongation : elongation of object in radians (for Solar system objects only!)
  • elongation-dms : elongation of object in DMS (for Solar system objects only!)
  • elongation-deg : elongation of object in decimal degrees (for Solar system objects only!)
  • ecl-elongation : elongation (difference in ecliptical longitude) of object in radians (for Solar system objects and from Earth only!)
  • ecl-elongation-dms : elongation (difference in ecliptical longitude) of object in DMS (for Solar system objects and from Earth only!)
  • ecl-elongation-deg : elongation (difference in ecliptical longitude) of object in decimal degrees (for Solar system objects and from Earth only!)
  • velocity: the planet velocity around the parent planet in ecliptical coordinates in AU/d (for Solar system objects only!)
  • velocity-kms: the planet velocity around the parent planet in km/s (for Solar system objects only!)
  • heliocentric-velocity: the planet's heliocentric velocity in the solar system in ecliptical coordinates in AU/d (for Solar system objects only!)
  • heliocentric-velocity-kms: the planet heliocentric velocity in the solar system in km/s (for Solar system objects only!)
  • scale: scale factor for Solar system bodies (for Solar system objects only!)
  • eclipse-obscuration: value of obscuration for solar eclipse (for Sun only!)
  • eclipse-magnitude: value of magnitude for solar eclipse (for Sun only!) Other StelObject derivates, also those defined in plugins, may add more, these fields are documented in the respective classes, or simply try what you get: You can print a complete set of entries into output with the following commands:
    map=core.getSelectedObjectInfo();
    core.output(core.mapToString(map));

◆ getObserverLocationInfo

static QVariantMap StelMainScriptAPI::getObserverLocationInfo ( )
staticslot

Get the info of the current observer location.

Returns
a map of object data. Keys:
  • altitude : altitude in meters
  • longitude : longitude in decimal degrees
  • latitude : latitude in decimal degrees
  • planet : name of planet
  • location : city and region
  • sidereal-year : duration of the sidereal year on the planet in Earth's days (since 0.12.0)
  • sidereal-day : duration of the sidereal day on the planet in Earth's hours (since 0.12.0)
  • solar-day : duration of the mean solar day on the planet in Earth's hours (since 0.12.0)
  • local-sidereal-time : local sidereal time on the planet in hours (since 0.13.3)
  • local-sidereal-time-hms : local sidereal time on the planet in hours in HMS format (since 0.13.3)
  • timezone : IANA timezone or "LMST" (Local Mean Solar Time) or "LTST" (Local True Solar Time) (since 0.18.3)
  • location-timezone : IANA timezone of current location (as stored in location database) (since 0.18.3)

◆ getPlatformName

static QString StelMainScriptAPI::getPlatformName ( void  )
staticslot
Returns
The name of platform where running Stellarium. Keys:
  • FreeBSD
  • OpenBSD
  • NetBSD
  • Linux
  • Windows
  • macOS
  • Unknown

◆ getProjectionMode

static QString StelMainScriptAPI::getProjectionMode ( )
staticslot

Get the current projection mode ID string.

Returns
the string which identifies the current projection mode. For a list of possibl results, see setProjectionMode();

◆ getScreenHeight

static int StelMainScriptAPI::getScreenHeight ( )
staticslot

Get the screen height (actually, height of Stellarium main view) in pixels.

Returns
The screen height in pixels

◆ getScreenWidth

static int StelMainScriptAPI::getScreenWidth ( )
staticslot

Get the screen width in pixels.

Returns
The screen width (actually, width of Stellarium main view) in pixels

◆ getScreenXYFromAltAzi

static QVariantMap StelMainScriptAPI::getScreenXYFromAltAzi ( const QString &  alt,
const QString &  azi 
)
staticslot

Get screen coordinates from some specified altitude and azimuth angles may be specified in a format recognised by StelUtils::getDecAngle()

Parameters
altthe altitude angle [degrees]
azithe azimuth angle [degrees]
Returns
a map of object data. Keys:
  • x : x coordinate on the screen
  • y : y coordinate on the screen

◆ getScriptRate

static double StelMainScriptAPI::getScriptRate ( )
staticslot

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

Returns
the current script execution rate.

◆ getSelectedObjectInfo

static QVariantMap StelMainScriptAPI::getSelectedObjectInfo ( )
staticslot

Fetch a map with data about the latest selected object's position, magnitude and so on.

Returns
a map of object data. See description for getObjectInfo(const QString& name);

◆ getSkyCulture

static QString StelMainScriptAPI::getSkyCulture ( )
staticslot

Find out the current sky culture.

Returns
the ID of the current sky culture (i.e. the name of the directory in which the current sky cultures files are found, e.g. "western")

◆ getSkyCultureName

static QString StelMainScriptAPI::getSkyCultureName ( )
staticslot

Find out the current sky culture and get it English name.

Returns
the English name of the current sky culture

◆ getSkyCultureNameI18n

static QString StelMainScriptAPI::getSkyCultureNameI18n ( )
staticslot

Find out the current sky culture and get it localized name.

Returns
the translated name of the current sky culture

◆ getSkyLanguage

static QString StelMainScriptAPI::getSkyLanguage ( )
staticslot

Get the current sky language.

Returns
two letter language code, e.g. "en", or "de" and so on.

◆ getSoundDuration

static qint64 StelMainScriptAPI::getSoundDuration ( const QString &  id)
staticslot

Get duration of a sound object (if possible).

Parameters
idthe identifier used when loadSound was called
Returns
duration[ms] if known, 0 if unknown (e.g. during load/before playing), -1 in case of error.

◆ getSoundPosition

static qint64 StelMainScriptAPI::getSoundPosition ( const QString &  id)
staticslot

Get position in a playing sound.

Parameters
idthe identifier used when loadSound was called
Returns
position [ms] during play or pause, 0 when stopped, -1 in case of error.

◆ getStelProperty

static QVariant StelMainScriptAPI::getStelProperty ( const QString &  propertyName)
staticslot

Get value for some StelProperty.

Note
This method may be very helpful for change the values in the plugins to avoid crashes when some plugin is not loaded.
See also isModuleLoaded() method
Parameters
propertyNamethe name of StelProperty, e.g. "Satellites.flagOrbitLines"

◆ getTimeRate

static double StelMainScriptAPI::getTimeRate ( )
staticslot

Get simulation time rate.

Returns
time speed as a multiple of real time.

◆ getVideoDuration

static qint64 StelMainScriptAPI::getVideoDuration ( const QString &  id)
staticslot

Get the duration of a loaded video, or -1.

Parameters
idthe identifier used when loadVideo() was called

◆ getVideoPosition

static qint64 StelMainScriptAPI::getVideoPosition ( const QString &  id)
staticslot

Get the current position of a loaded video, or -1.

Parameters
idthe identifier used when loadVideo() was called

◆ getViewAltitudeAngle

static double StelMainScriptAPI::getViewAltitudeAngle ( )
staticslot

Get the current viewing direction altitude angle at center of view.

Returns
the altitude angle in decimal degrees. 0 is horizon, zenith is 180, nadir = -180.

◆ getViewAzimuthAngle

static double StelMainScriptAPI::getViewAzimuthAngle ( )
staticslot

Get the current viewing direction azimuth angle at center of view.

Returns
the azimuth angle in decimal degrees as a compass bearing i.e. 0 is North, 90 is East, 180 is South, 270 is West.

◆ getViewDecAngle

static double StelMainScriptAPI::getViewDecAngle ( )
staticslot

Get the current viewing direction Declination angle at center of view.

Returns
the Declination angle in decimal degrees. The value returned falls in the range -180 .. 180

◆ getViewDecJ2000Angle

static double StelMainScriptAPI::getViewDecJ2000Angle ( )
staticslot

Get the current viewing direction Declination angle in J2000 frame at center of view.

Returns
the Declination angle in J2000 frame in decimal degrees.

◆ getViewRaAngle

static double StelMainScriptAPI::getViewRaAngle ( )
staticslot

Get the current viewing direction Right Ascension at center of view.

Returns
the Right Ascension angle in decimal degrees. The value returned falls in the range 0 .. 360

◆ getViewRaJ2000Angle

static double StelMainScriptAPI::getViewRaJ2000Angle ( )
staticslot

Get the current viewing direction Right Ascension in J2000 frame at center of view.

Returns
the Right Ascension angle in J2000 frame in decimal degrees.

◆ isMediaPlaybackSupported

static bool StelMainScriptAPI::isMediaPlaybackSupported ( void  )
staticslot

Get the current status of media playback support.

Returns
The current status of media playback support.

◆ isModuleLoaded

static bool StelMainScriptAPI::isModuleLoaded ( const QString &  moduleID)
staticslot

return whether a particular module has been loaded.

Mostly useful to check whether a module available as plugin is active.

Note
See also setStelProperty() and getStelProperty() methods
Parameters
moduleIDthe QObject name of the module instance, by convention it is equal to the class name.

◆ isPlanetocentricCalculations

static bool StelMainScriptAPI::isPlanetocentricCalculations ( )
staticslot

Get the type of calculations in the simulation - is it "planetocentric calculations" or not.

Returns
true if the calculations is planetocentric (geocentric on Earth), else return false

◆ isRealTime

static bool StelMainScriptAPI::isRealTime ( )
staticslot

Get the simulation time and rate state - is it "real time".

Returns
true if the time rate is normal, and the simulation time is real time, else return false

◆ jdFromDateString

static double StelMainScriptAPI::jdFromDateString ( const QString &  dt,
const QString &  spec 
)
staticslot

For use in setDate and waitFor For parameter descriptions see setDate().

Returns
Julian day.

◆ loadSkyImage [1/4]

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
const QString &  lon,
const QString &  lat,
double  angSize,
double  rotation,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true,
const QString &  frame = "EqJ2000",
bool  withAberration = true 
)
slot

Convenience function which allows loading of a (square) 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 lon and lat, except here text expressions of angles may be used.

◆ loadSkyImage [2/4]

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
const QString &  lon0,
const QString &  lat0,
const QString &  lon1,
const QString &  lat1,
const QString &  lon2,
const QString &  lat2,
const QString &  lon3,
const QString &  lat3,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true,
const QString &  frame = "EqJ2000",
bool  withAberration = true 
)
slot

Convenience function which allows the user to provide longitudinal and latitudinal angles (RA/Dec or Long/Lat or Az/Alt) as strings (e.g.

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

◆ loadSkyImage [3/4]

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
double  lon,
double  lat,
double  angSize,
double  rotation,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true,
const QString &  frame = "EqJ2000",
bool  withAberration = true 
)
slot

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

Note that the edges will not be aligned with edges at center plus/minus size!

Parameters
ida string ID to be used when referring to this image (e.g. when changing the displayed status or deleting it.
filenamethe file name of the image. If a relative path is specified, "scripts/" will be prefixed before the image is searched for using StelFileMgr.
lonThe right ascension/longitude/azimuth of the center of the image in frame degrees
latThe declination/latitude/altitude of the center of the image in frame degrees
angSizeThe angular size of the image in arc minutes
rotationThe clockwise rotation angle of the image in degrees. Use 0 for an image with top=north. (New from 2017 – This used to be 90!)
minResThe minimum resolution setting for the image. UNCLEAR, using 2.5 seems to work well.
maxBrightThe maximum brightness setting for the image, Vmag/arcmin^2. Use this to blend the brightest possible pixels with DSO. mag 15 or brighter seems ok.
visibleThe initial visibility of the image
frameone of EqJ2000|EqDate|EclJ2000|EclDate|Gal(actic)|SuperG(alactic)|AzAlt.
withAberrationThe image, if frame==EqJ2000, undergoes aberration effect. Default: true.
Note
Images in AzAlt frame are not affected by atmosphere effects like refraction or extinction.

◆ loadSkyImage [4/4]

void StelMainScriptAPI::loadSkyImage ( const QString &  id,
const QString &  filename,
double  lon0,
double  lat0,
double  lon1,
double  lat1,
double  lon2,
double  lat2,
double  lon3,
double  lat3,
double  minRes = 2.5,
double  maxBright = 14,
bool  visible = true,
const QString &  frame = "EqJ2000",
bool  withAberration = true 
)
slot

Load an image into the sky background at the given sky coordinates and be warped with the sky.

The image is projected like a deep-sky object, with a notion for surface magnitude of the brightest parts. Transparent sections in the image are possibly rendered white, so make your image just RGB with black background. The black background covers the milky way, but is brightened by the Zodiacal light.

Parameters
ida string ID to be used when referring to this image (e.g. when changing the displayed status or deleting it.
filenamethe file name of the image. "scripts/" will be prefixed before the image is searched for using StelFileMgr.
lon0The right ascension/longitude/azimuth of the first corner of the image in degrees (bottom left)
lat0The declination/latitude/altitude of the first corner of the image in degrees (bottom left)
lon1The right ascension/longitude/azimuth of the second corner of the image in degrees (bottom right)
lat1The declination/latitude/altitude of the second corner of the image in degrees (bottom right)
lon2The right ascension/longitude/azimuth of the third corner of the image in degrees (top right)
lat2The declination/latitude/altitude of the third corner of the image in degrees (top right)
lon3The right ascension/longitude/azimuth of the fourth corner of the image in degrees (top left)
lat3The declination/latitude/altitude of the fourth corner of the image in degrees (top left)
minResThe minimum resolution setting for the image
maxBrightThe maximum brightness setting for the image
visibleThe initial visibility of the image
frameone of EqJ2000|EqDate|EclJ2000|EclDate|Gal(actic)|SuperG(alactic)|AzAlt.
withAberrationThe image, if frame==EqJ2000, undergoes aberration effect. Default: true.
Note
Images in AzAlt frame are not affected by atmosphere effects like refraction or extinction, and also not by aberration.

◆ loadSound

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

Load a sound from a file.

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

◆ loadVideo

void StelMainScriptAPI::loadVideo ( const QString &  filename,
const QString &  id,
float  x,
float  y,
bool  show = true,
float  alpha = 1.0f 
)
slot

Load a video from a file.

Parameters
filenamethe name of the file to load, relative to the scripts directory.
idthe identifier which will be used to refer to the video when calling playVideo(), pauseVideo(), stopVideo(), dropVideo() etc.
xthe x-coordinate (pixels from left) for the video frame.
ythe y-coordinate (pixels from top) for the video frame.
showthe visibility state for the video. (Optional since V0.15) You should load a video with show=true (or leave default), to start it immediately in native size. Else set show=false, and then call resizeVideo(), playVideo() or use playVideoPopout().
alphathe initial alpha value of the video, defaults to 1.

◆ mapToString

static QString StelMainScriptAPI::mapToString ( const QVariantMap &  map)
staticslot

print contents of a QVariantMap as []-delimited list of [ "key" = ] lists.

Parameters
mapQVariantMap e.g. from getObjectInfo() or getLocationInfo()
Note
string values are surrounded with ", simple numeric types are printed as themselves.
More complicated value types like lists are only indicated by their type name. You must extract those (and their contents) yourself.

◆ moveToAltAzi

static void StelMainScriptAPI::moveToAltAzi ( const QString &  alt,
const QString &  azi,
float  duration = 1. 
)
staticslot

move the current viewing direction to some specified altitude and azimuth.

The move will run in AltAz coordinates. This will look different from moveToRaDec() when timelapse is fast. angles may be specified in a format recognised by StelUtils::getDecAngle()

Parameters
altthe altitude angle
azithe azimuth angle
durationthe duration of the movement in seconds

◆ moveToGalLongLat

static void StelMainScriptAPI::moveToGalLongLat ( const QString &  lon,
const QString &  lat,
float  duration = 1. 
)
staticslot

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

Parameters
lonthe galactic longitude
decthe galactic latitude
durationthe duration of the movement in seconds

◆ moveToObject

static void StelMainScriptAPI::moveToObject ( const QString &  name,
float  duration = 1. 
)
staticslot

Move the current viewing direction to some object.

Parameters
nameis the English name of the object
durationthe duration of the movement in seconds

◆ moveToRaDec

static void StelMainScriptAPI::moveToRaDec ( const QString &  ra,
const QString &  dec,
float  duration = 1. 
)
staticslot

move the current viewing direction to some specified right ascension and declination.

The move will run in equatorial coordinates. This will look different from moveToAltAzi() when timelapse is fast. angles may be specified in a format recognised by StelUtils::getDecAngle()

Parameters
rathe right ascension angle
decthe declination angle
durationthe duration of the movement in seconds

◆ moveToRaDecJ2000

static void StelMainScriptAPI::moveToRaDecJ2000 ( const QString &  ra,
const QString &  dec,
float  duration = 1. 
)
staticslot

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
rathe right ascension angle
decthe declination angle
durationthe duration of the movement in seconds

◆ moveToSelectedObject

static void StelMainScriptAPI::moveToSelectedObject ( float  duration = 1.)
staticslot

Move the current viewing direction to selected object.

Parameters
durationthe duration of the movement in seconds

◆ output

static void StelMainScriptAPI::output ( const QString &  s)
staticslot

print an output message from script

Parameters
sthe message to be displayed on the output file.

◆ pauseScript

static void StelMainScriptAPI::pauseScript ( )
staticslot

Pause the currently running script.

Note that you may need to use a key sequence like 'Ctrl-D,R' or the GUI to resume script execution.

◆ pauseSound

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
idthe identifier used when loadSound was called

◆ pauseVideo

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
idthe identifier used when loadVideo() was called

◆ playSound

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

Play a sound which has previously been loaded with loadSound.

Parameters
idthe identifier used when loadSound was called

◆ playVideo

void StelMainScriptAPI::playVideo ( const QString &  id,
bool  keepVisibleAtEnd = false 
)
slot

Play a video which has previously been loaded with loadVideo.

Parameters
idthe identifier used when loadVideo was called

◆ playVideoPopout

void StelMainScriptAPI::playVideoPopout ( const QString &  id,
float  fromX,
float  fromY,
float  atCenterX,
float  atCenterY,
float  finalSizeX,
float  finalSizeY,
float  popupDuration,
bool  frozenInTransition 
)
slot

Play a video which has previously been loaded with loadVideo with a complex effect.

The video appears out of fromX/fromY, grows within popupDuration to size finalSizeX/finalSizeY, and shrinks back towards fromX/fromY at the end during popdownDuration.

Parameters
idthe identifier used when loadVideo was called
fromXX position of starting point, counted from left of window. May be absolute (if >1) or relative (0<X<1)
fromYY position of starting point, counted from top of window. May be absolute (if >1) or relative (0<Y<1)
atCenterXX position of center of final video frame, counted from left of window. May be absolute (if >1) or relative (0<X<1)
atCenterYY position of center of final video frame, counted from top of window. May be absolute (if >1) or relative (0<Y<1)
finalSizeXX size of final video frame. May be absolute (if >1) or relative to window size (0<X<1). If -1, scale proportional from finalSizeY.
finalSizeYY size of final video frame. May be absolute (if >1) or relative to window size (0<Y<1). If -1, scale proportional from finalSizeX.
popupDurationduration of growing start transition (seconds)
frozenInTransitiontrue if video should be paused during growing/shrinking transition.

◆ refraction

static double StelMainScriptAPI::refraction ( double  altitude,
bool  apparent = false 
)
staticslot

Apply refraction with current atmospheric parameters to altitude.

Parameters
altitudedegrees
apparenttrue to remove refraction from an apparent (observed) altitude

◆ removeSkyImage

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

Remove a SkyImage.

Parameters
idthe ID of the image to remove.

◆ resizeVideo

void StelMainScriptAPI::resizeVideo ( const QString &  id,
float  w,
float  h 
)
slot

Resize the video widget to the specified width, height.

Parameters
idthe identifier used when loadVideo() was called
wthe new width for the widget. (if <1, relative to main view size)
hthe new height for the widget. (if <1, relative to main view size)

◆ saveOutputAs

static void StelMainScriptAPI::saveOutputAs ( const QString &  filename)
staticslot

Save output file to new file (in same directory as output.txt).

This is required to allow reading with other program on Windows while output.txt is still open.

◆ screenshot

static void StelMainScriptAPI::screenshot ( const QString &  prefix,
bool  invert = false,
const QString &  dir = "",
const bool  overwrite = false,
const QString &  format = "" 
)
staticslot

Save a screenshot.

Parameters
prefixthe prefix for the file name to use
dirthe path of the directory to save the screenshot in. If none is specified, the default screenshot directory will be used.
invertwhether colors have to be inverted in the output image
overwritetrue to use exactly the prefix as filename (plus .png), and overwrite any existing file.
formatFile format. One of png|bmp|jpg|jpeg|tif|tiff|webm|pbm|pgm|ppm|xbm|xpm|ico. Use current format if left empty or invalid.

◆ seekVideo

void StelMainScriptAPI::seekVideo ( const QString &  id,
qint64  ms,
bool  pause = false 
)
slot

Seeks a video to the requested time and either start playing or freeze there.

Parameters
idthe identifier used when loadVideo() was called
msthe time in milliseconds from the start of the media.
pausetrue if you want to pause at the requested position, keep it false to play from here.

◆ selectConstellationByName

static void StelMainScriptAPI::selectConstellationByName ( const QString &  name)
staticslot

Select a constellation by name.

Parameters
namethe name of the constellation to select (english)

◆ selectObjectByName

static void StelMainScriptAPI::selectObjectByName ( const QString &  name,
bool  pointer = false 
)
staticslot

Select an object by name.

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

◆ setAppLanguage

static void StelMainScriptAPI::setAppLanguage ( QString  langCode)
staticslot

Set the current application language.

Parameters
langCodetwo letter language code, e.g. "en", or "de".

◆ setBortleScaleIndex

static void StelMainScriptAPI::setBortleScaleIndex ( int  index)
staticslot

Changes the Bortle scale index, which is used to simulate light pollution.

Wrapper for StelSkyDrawer::setBortleScaleIndex Valid values are in the range [1,9]

See also
https://en.wikipedia.org/wiki/Bortle_scale
Parameters
indexthe new Bortle scale index, must be in range [1,9]

◆ setDate

static void StelMainScriptAPI::setDate ( const QString &  dateStr,
const QString &  spec = "utc",
const bool &  dateIsDT = false 
)
staticslot

Sets Stellarium's date using an absolute or relative value.

Parameters
dateStrDefines the date or offset to use. Possible formats:
  • Date and time according to ISO 8601, without time zone, e.g., "2008-03-24T13:21:01"
  • Use "now" to set Stellarium's time to the system's (presumably) real time.
  • Specify an offset in the form <sign>

<unit> to set the date relative to its current value. <unit> may be one of second, minute, hour, day, sol, week, month, year, with a plural 's' optionally appended, e.g., "+3.25 days", " - 1 year".

  • Use "now" followed by an offset to set the date relative to the system's current value, e.g., "now+1hour".
  • You may append "sidereal" to use units derived from the length of a sidereal day, e.g., "now +2days sidereal".
    Note
    When sidereal time is used, the length of time for each unit is dependent on the current planet. By contrast, when sidereal time is not specified (i.e., solar time is used) the value is conventional so that 1 day means 1 Earth Solar day.
    Parameters
    specMay be "local" or "utc". Only has an effect when an ISO format string is used. Defaults to "utc".
    dateIsDTset to true indicates that the given date is formulated in Dynamical Time, i.e. with DeltaT added.
    Note
    For fully compatible behaviour of this function with versions 0.11.4 or earlier you should call core.setDeltaTAlgorithm("WithoutCorrection"); before running core.setDate(); for disabling DeltaT correction.
    Starting with version 0.13.2 all relative dates are set without DeltaT correction.
    Starting with version 0.14.0 the Boolean argument has a different meaning and default!

◆ setDeltaTAlgorithm

static void StelMainScriptAPI::setDeltaTAlgorithm ( QString  algorithmName)
staticslot

set equation of the DeltaT for the simulation date and time

Parameters
algorithmNameis name of equation, e.g. "WithoutCorrection" or "EspenakMeeus"
Note
list of possible names of equation for DeltaT:
  • WithoutCorrection
  • Schoch
  • Clemence
  • IAU
  • AstronomicalEphemeris
  • TuckermanGoldstine
  • MullerStephenson
  • Stephenson1978
  • SchmadelZech1979
  • MorrisonStephenson1982
  • StephensonMorrison1984
  • StephensonHoulden
  • Espenak
  • Borkowski
  • SchmadelZech1988
  • ChaprontTouze
  • StephensonMorrison1995
  • Stephenson1997
  • ChaprontMeeus
  • JPLHorizons
  • MeeusSimons
  • MontenbruckPfleger
  • ReingoldDershowitz
  • MorrisonStephenson2004
  • EspenakMeeus
  • Reijs
  • Banjevic
  • IslamSadiqQureshi
  • Henriksson2017
  • Custom

◆ setDiskViewport

void StelMainScriptAPI::setDiskViewport ( bool  b)
slot

Set the disk viewport.

Parameters
bif true, sets the disk viewport on, else sets it off

◆ setDisplayAdaptationLuminance

static void StelMainScriptAPI::setDisplayAdaptationLuminance ( double  cdPerSqM)
staticslot

Experimental.

Allow setting physical display adaptation luminance for tonemapping. The standard value is 50cd/m^2, appropriate for CRTs in dimly lit office environments. TBD true?: Increasing the value makes most of the sky darker, to allow saving the highest tones for the brightest lights (esp. the Sun).

Note
This is experimental and may not be available in later versions.

◆ setDisplayGamma

static void StelMainScriptAPI::setDisplayGamma ( double  gamma)
staticslot

Experimental: Set the display gamma.

Parameters
gammathe gamma. Initial default value is 2.2222 (for a CRT), and sRGB LCD (and similar modern) panels try to reproduce that. This method allows overriding for other sky tones. Higher gamma makes the sky brighter.
Note
It may be technically an error to deviate from the defaults!
Only the blue-sky (atmosphere) model is influenced, not the foreground (landscape)
This is experimental and may not be available in later versions.

◆ setDisplayMaxLuminance

static void StelMainScriptAPI::setDisplayMaxLuminance ( double  cdPerSqM)
staticslot

Experimental.

Allow setting physical display properties for tonemapping. The standard value is 100cd/m^2, appropriate for CRTs. More modern screens often have more. Increasing the value makes most of the sky darker, to allow saving the highest tones for the brightest lights (esp. the Sun).

Note
This is experimental and may not be available in later versions.

◆ setFlagGravityLabels

static void StelMainScriptAPI::setFlagGravityLabels ( bool  b)
staticslot

Turn on/off gravity labels.

Parameters
bif true, turn on gravity labels, else turn them off

◆ setFlipHorz

static void StelMainScriptAPI::setFlipHorz ( bool  b)
staticslot

Set the horizontal flip status.

Parameters
flipThe new value (true = flipped, false = unflipped).

◆ setFlipVert

static void StelMainScriptAPI::setFlipVert ( bool  b)
staticslot

Set the vertical flip status.

Parameters
flipThe new value (true = flipped, false = unflipped).

◆ setGuiStyle

static void StelMainScriptAPI::setGuiStyle ( const QString &  cssStyle)
staticslot

Use a custom CSS for the GUI.

This is a very advanced feature, designing CSS is an art. To use properly, place a private copy of normalStyle.css into your user data directory and edit style, but leave structure as-is.

Parameters
cssStyleThe file name without ".css" The special name "default" can be used to reset everything to defaults.
Attention
Stellarium's normalStyle.css evolves. We cannot give any guarantee that a modified CSS will work with another version of Stellarium.

◆ setGuiVisible

static void StelMainScriptAPI::setGuiVisible ( bool  b)
staticslot

Show or hide the GUI (toolbars).

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

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

◆ setJDay

static void StelMainScriptAPI::setJDay ( double  JD)
staticslot

Set the current date as Julian Day number.

Parameters
JDthe Julian Day number

◆ setMaxFps

static void StelMainScriptAPI::setMaxFps ( float  m)
staticslot

Set the maximum frames per second.

Parameters
mthe new maximum fps setting.

◆ setMinFps

static void StelMainScriptAPI::setMinFps ( float  m)
staticslot

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
mthe new minimum fps setting.

◆ setMJDay

static void StelMainScriptAPI::setMJDay ( double  MJD)
staticslot

Set the current date as Modified Julian Day.

Parameters
MJDthe Modified Julian Day

◆ setMountMode

static void StelMainScriptAPI::setMountMode ( const QString &  mode)
staticslot

Set the mount mode.

Parameters
modeshould be "equatorial" or "azimuthal"

◆ setNightMode

static void StelMainScriptAPI::setNightMode ( bool  b)
staticslot

Set the status of Night Mode.

Parameters
bif true, set Night Mode, else set Normal Mode

◆ setObserverLocation [1/2]

static void StelMainScriptAPI::setObserverLocation ( const QString &  id,
double  duration = 1. 
)
staticslot

Set the location by the name of the location.

Parameters
idthe 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".
durationthe number of seconds to take to move location.

◆ setObserverLocation [2/2]

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

Set the observer location.

Parameters
longitudethe longitude in degrees. E is +ve. values out of the range -180..180 mean that the longitude will not be set
latitudethe latitude in degrees. N is +ve. values out of the range -90..90 mean that the latitude will not be set
altitudethe new altitude in meters. values less than -1000 mean the altitude will not be set.
durationthe time for the transition from the old to the new location.
nameA name for the location (which will appear in the status bar. Use "<city>, <region>" for moving across a border.
planetthe English name of the new planet. If the planet name is not known (e.g. ""), the planet will not be set.

◆ setProjectionMode

void StelMainScriptAPI::setProjectionMode ( const QString &  id)
slot

Set the current projection mode.

Parameters
idthe name of the projection mode to use, e.g. "ProjectionPerspective" and so on. valid values of id are:
  • ProjectionPerspective
  • ProjectionEqualArea
  • ProjectionStereographic
  • ProjectionFisheye
  • ProjectionHammer
  • ProjectionCylinder
  • ProjectionMercator
  • ProjectionOrthographic
  • ProjectionSinusoidal
  • ProjectionMiller

◆ setScriptRate

static void StelMainScriptAPI::setScriptRate ( double  r)
staticslot

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

Parameters
rthe 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.

◆ setSelectedObjectInfo

static void StelMainScriptAPI::setSelectedObjectInfo ( const QString &  level)
staticslot

Set the amount of selected object information to display.

Parameters
levelcan be "AllInfo", "DefaultInfo", "ShortInfo", "None", "Custom"

◆ setSelectedObjectMarkerVisible

static void StelMainScriptAPI::setSelectedObjectMarkerVisible ( bool  b)
staticslot

Show or hide the selection pointers/markers.

Parameters
bif true, show the pointer/marker around selected objects, if false, hide the pointer/marker.

◆ setSkyCulture

void StelMainScriptAPI::setSkyCulture ( const QString &  id)
slot

Set the current sky culture.

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

◆ setSkyLanguage

static void StelMainScriptAPI::setSkyLanguage ( QString  langCode)
staticslot

Set the current sky language.

Parameters
langCodetwo letter language code, e.g. "en", or "de".

◆ setSphericMirror

static void StelMainScriptAPI::setSphericMirror ( bool  b)
staticslot

Set the viewport distortion effect.

Parameters
bif true, sets the spherical mirror distortion effect for viewport on, else sets it off

◆ setStelProperty

static void StelMainScriptAPI::setStelProperty ( const QString &  propertyName,
QVariant  propertyValue 
)
staticslot

Set value for some StelProperty.

Note
This method may be very helpful for change the values in the plugins to avoid crashes when some plugin is not loaded.
See also isModuleLoaded() method
Parameters
propertyNamethe name of StelProperty, e.g. "Satellites.flagOrbitLines"
propertyValuethe value of StelProperty

◆ setTimeRate

static void StelMainScriptAPI::setTimeRate ( double  ts)
staticslot

Set time speed in JDay/sec.

Parameters
tsthe 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.

◆ setTimezone

static void StelMainScriptAPI::setTimezone ( QString  tz,
int  markAsCustom = -1 
)
staticslot

set timezone name.

This only changes the currently used timezone (in StelCore). Location (database) timezone will not be touched. Valid values for tz can be found from the results of getAllTimezoneNames, including: "LMST" = Local Mean Solar Time "LTST" = Local True Solar Time

Parameters
markAsCustomset flag/property StelCore.flagUseCTZ. (since 0.19.0) Acceptable values: 0: set off; 1: set on. Other values: don't touch. This parameter is mostly to reflect the respective setting in the Location dialog.
  • If tz is the default timezone for a site, markAsCustom should be 0.
  • For a definitively custom zone, set 1.
  • If unsure, set to -1.

◆ setVideoAlpha

void StelMainScriptAPI::setVideoAlpha ( const QString &  id,
float  alpha 
)
slot

Set the alpha value of a video when visible.

Parameters
idthe identifier used when loadVideo() was called
alphathe new alpha value to set.
alphadoes not work properly, only
alpha=0makes it invisible.

◆ setVideoXY

void StelMainScriptAPI::setVideoXY ( const QString &  id,
float  x,
float  y,
bool  relative = false 
)
slot

Sets the position of the video widget.

Parameters
idthe identifier used when loadVideo() was called
xthe new x-coordinate for the video. (if <1, relative to main view size)
ythe new y-coordinate for the video. (if <1, relative to main view size)
relativetrue if you want to move in relative coordinates, not set absolutely

◆ setViewportStretch

static void StelMainScriptAPI::setViewportStretch ( const float  stretch)
staticslot

Set a lateral width distortion.

Use this e.g. in startup.ssc. Implemented for 0.15 for a setup with 5 projectors with edge blending. The 9600x1200 get squeezed somewhat which looks a bit odd. Use this stretch to compensate. Experimental! To avoid overuse, there is currently no config.ini setting available.

Note
Currently only the projected content is affected. ScreenImage, ScreenLabel is not stretched.

◆ setWindowSize

static Vec2d StelMainScriptAPI::setWindowSize ( int  width,
int  height 
)
staticslot

Set size of current window.

This will never exceed the current screen dimensions.

Returns
the actually gained size(width, height).

◆ showVideo

void StelMainScriptAPI::showVideo ( const QString &  id,
bool  show = true 
)
slot

Set the visibility state of a video.

Parameters
idthe identifier used when loadVideo() was called
showthe new visible state of the video.
Note
You must call this if you called loadVideo() with its
Parameters
show=false,elsevideo will be played hidden.

◆ stopSound

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
idthe identifier used when loadSound was called

◆ stopVideo

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
idthe identifier used when loadVideo() was called

◆ useQtScript

static bool StelMainScriptAPI::useQtScript ( )
staticslot

Returns true if the script is running on the older, Qt5-based QtScript JavaScript engine.

Note that it is possible to build Stellarium on Qt5.14 and later also with the newer scripting engine. Use this to make code paths work with all versions of Stellarium.

◆ utm2geo

static QList<double> StelMainScriptAPI::utm2geo ( const double  easting,
const double  northing,
const int  zone,
const bool  north 
)
staticslot

Coordinate conversion: UTM->geographic (WGS84)

  • easting (metres). False Easting of Zone meridian = 500000
  • northing (metres). For southern latitudes, equator = 10000000
  • zone UTM zone (longitudinal) [1...60].
  • north true for N, false for S latitude zones.
    Returns
    {{longitude[deg], latitude[deg], refLong[deg], gamma[deg], k}}

◆ vec3d

static Vec3d StelMainScriptAPI::vec3d ( const double  x,
const double  y,
const double  z 
)
staticslot

Create a Vec3d object.

This is very important for many functions, but can only be created indirectly. Either use this function or use an intermediary V3d object like

var myV3d=new V3d(vec);
var myVec3d=myV3d.toVec3d();

◆ vec3f

static Vec3f StelMainScriptAPI::vec3f ( const float  x,
const float  y,
const float  z 
)
staticslot

Create a Vec3f object.

This is very important for many functions, but can only be created indirectly. Either use this function or use an intermediary V3f object like

var myV3f=new V3f(vec);
var myVec3f=myV3f.toVec3f();

◆ wait

void StelMainScriptAPI::wait ( double  t)
slot

Pauses the script for t seconds.

Parameters
tthe number of seconds to wait

◆ waitFor

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
dtthe date string to use, format like "2012-06-06T4:44:00" or "-1428-03-04T22:23:45"
spec"local" or "utc"