Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

scripting/StelMainScriptAPI.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2009 Matthew Gates
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00018  */
00019 
00020 #ifndef _STELMAINSCRIPTAPI_HPP_
00021 #define _STELMAINSCRIPTAPI_HPP_
00022 
00023 #include <QObject>
00024 #include <QVariant>
00025 #include <QStringList>
00026 
00027 class QScriptEngine;
00028 
00035 class StelMainScriptAPI : public QObject
00036 {
00037     Q_OBJECT
00038     Q_PROPERTY(double JDay READ getJDay WRITE setJDay)
00039     Q_PROPERTY(double timeSpeed READ getTimeRate WRITE setTimeRate)
00040 
00041 public:
00042     StelMainScriptAPI(QObject *parent = 0);
00043     ~StelMainScriptAPI();
00044 
00045 // These functions will be available in scripts
00046 public slots:
00049     void setJDay(double JD);
00052     double getJDay() const;
00053 
00071     void setDate(const QString& dt, const QString& spec="utc");
00072 
00078     QString getDate(const QString& spec="utc");
00079 
00085     void setTimeRate(double ts);
00088     double getTimeRate() const;
00089 
00093     bool isRealTime();
00094 
00096     void setRealTime();
00097 
00103     void selectObjectByName(const QString& name, bool pointer=false);
00104 
00117     QVariantMap getObjectPosition(const QString& name);
00118 
00126     void clear(const QString& state="natural");
00127 
00131     double getViewAltitudeAngle();
00132 
00136     double getViewAzimuthAngle();
00137 
00141     double getViewRaAngle();
00142 
00146     double getViewDecAngle();
00147 
00150     double getViewRaJ2000Angle();
00151 
00154     double getViewDecJ2000Angle();
00155 
00161     void moveToAltAzi(const QString& alt, const QString& azi, float duration=1.);
00162 
00168     void moveToRaDec(const QString& ra, const QString& dec, float duration=1.);
00169 
00175     void moveToRaDecJ2000(const QString& ra, const QString& dec, float duration=1.);
00176 
00194     void setObserverLocation(double longitude, double latitude, double altitude, double duration=1., const QString& name="", const QString& planet="");
00195 
00201     void setObserverLocation(const QString id, float duration=1.);
00202 
00204     QString getObserverLocation();
00205 
00213     QVariantMap getObserverLocationInfo();
00214 
00220     void screenshot(const QString& prefix, bool invert=false, const QString& dir="");
00221 
00225     void setGuiVisible(bool b);
00226 
00232     void setMinFps(float m);
00233 
00236     float getMinFps();
00237 
00240     void setMaxFps(float m);
00241 
00244     float getMaxFps();
00245 
00248     QString getMountMode();
00249 
00252     void setMountMode(const QString& mode);
00253 
00256     bool getNightMode();
00257 
00260     void setNightMode(bool b);
00261 
00265     QString getProjectionMode();
00266 
00278     void setProjectionMode(const QString& id);
00279 
00282     bool getDiskViewport();
00283 
00286     void setDiskViewport(bool b);
00287 
00290     QStringList getAllSkyCultureIDs();
00291 
00295     QString getSkyCulture();
00296 
00299     void setSkyCulture(const QString& id);
00300 
00303     bool getFlagGravityLabels();
00304 
00307     void setFlagGravityLabels(bool b);
00308 
00327     void loadSkyImage(const QString& id, const QString& filename,
00328                       double ra0, double dec0,
00329                       double ra1, double dec1,
00330                       double ra2, double dec2,
00331                       double ra3, double dec3,
00332                       double minRes=2.5, double maxBright=14, bool visible=true);
00333 
00334 
00338     void loadSkyImage(const QString& id, const QString& filename,
00339                       const QString& ra0, const QString& dec0,
00340                       const QString& ra1, const QString& dec1,
00341                       const QString& ra2, const QString& dec2,
00342                       const QString& ra3, const QString& dec3,
00343                       double minRes=2.5, double maxBright=14, bool visible=true);
00344 
00359     void loadSkyImage(const QString& id, const QString& filename,
00360                       double ra, double dec, double angSize, double rotation,
00361                       double minRes=2.5, double maxBright=14, bool visible=true);
00362 
00367     void loadSkyImage(const QString& id, const QString& filename,
00368                       const QString& ra, const QString& dec, double angSize, double rotation,
00369                       double minRes=2.5, double maxBright=14, bool visible=true);
00370 
00389     void loadSkyImageAltAz(const QString& id, const QString& filename,
00390                       double alt0, double azi0,
00391                       double alt1, double azi1,
00392                       double alt2, double azi2,
00393                       double alt3, double azi3,
00394                       double minRes=2.5, double maxBright=14, bool visible=true);
00395 
00410     void loadSkyImageAltAz(const QString& id, const QString& filename,
00411                       double alt, double azi, double angSize, double rotation,
00412                       double minRes=2.5, double maxBright=14, bool visible=true);
00413 
00416     void removeSkyImage(const QString& id);
00417 
00422     void loadSound(const QString& filename, const QString& id);
00423 
00426     void playSound(const QString& id);
00427 
00431     void pauseSound(const QString& id);
00432 
00437     void stopSound(const QString& id);
00438 
00442     void dropSound(const QString& id);
00443 
00452     void loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha);
00453 
00456     void playVideo(const QString& id);
00457 
00461     void pauseVideo(const QString& id);
00462 
00467     void stopVideo(const QString& id);
00468 
00472     void dropVideo(const QString& id);
00473 
00477         void seekVideo(const QString& id, qint64 ms);                                   
00478 
00483         void setVideoXY(const QString& id, float x, float y);                           
00484 
00488         void setVideoAlpha(const QString& id, float alpha);                             
00489 
00494         void resizeVideo(const QString& id, float w, float h);
00495 
00499         void showVideo(const QString& id, bool show);
00500 
00503     int getScreenWidth();
00506     int getScreenHeight();
00507 
00510     double getScriptRate();
00515     void setScriptRate(double r);
00516 
00519     void pauseScript();
00520 
00523     void setSelectedObjectInfo(const QString& level);
00524 
00526     void exit();
00527 
00529     void quitStellarium();
00530 
00533     void debug(const QString& s);
00534 
00537     QString getAppLanguage();
00538 
00541     void setAppLanguage(QString langCode);
00542 
00545     QString getSkyLanguage();
00546 
00549     void setSkyLanguage(QString langCode);
00550 
00552     void goHome();
00553 
00557     double jdFromDateString(const QString& dt, const QString& spec);
00558     
00559 signals:
00560     void requestLoadSkyImage(const QString& id, const QString& filename,
00561                              double c1, double c2,
00562                              double c3, double c4,
00563                              double c5, double c6,
00564                              double c7, double c8,
00565                              double minRes, double maxBright, bool visible);
00566     void requestLoadSkyImageAltAz(const QString& id, const QString& filename,
00567                              double c1, double c2,
00568                              double c3, double c4,
00569                              double c5, double c6,
00570                              double c7, double c8,
00571                              double minRes, double maxBright, bool visible);
00572 
00573 
00574     void requestRemoveSkyImage(const QString& id);
00575 
00576     void requestLoadSound(const QString& filename, const QString& id);
00577     void requestPlaySound(const QString& id);
00578     void requestPauseSound(const QString& id);
00579     void requestStopSound(const QString& id);
00580     void requestDropSound(const QString& id);
00581     void requestLoadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha);
00582     void requestPlayVideo(const QString& id);
00583     void requestPauseVideo(const QString& id);
00584     void requestStopVideo(const QString& id);
00585     void requestDropVideo(const QString& id);
00586     void requestSeekVideo(const QString& id, qint64 ms);
00587     void requestSetVideoXY(const QString& id, float x, float y);
00588     void requestSetVideoAlpha(const QString& id, float alpha);
00589     void requestResizeVideo(const QString& id, float w, float h);
00590     void requestShowVideo(const QString& id, bool show);
00591     
00592     void requestSetNightMode(bool b);
00593     void requestSetProjectionMode(QString id);
00594     void requestSetSkyCulture(QString id);
00595     void requestSetDiskViewport(bool b);
00596     void requestExit();
00597     void requestSetHomePosition();
00598 };
00599 
00600 #endif // _STELMAINSCRIPTAPI_HPP_
00601 
Generated on Sat Aug 25 22:13:30 2012 for Stellarium by  doxygen 1.6.3