00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELMAINSCRIPTAPI_HPP_
00021 #define _STELMAINSCRIPTAPI_HPP_
00022
00023 #include "ScriptSleeper.hpp"
00024
00025 #include <QObject>
00026 #include <QVariant>
00027 #include <QStringList>
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 ScriptSleeper& getScriptSleeper(void);
00046
00047
00048 public slots:
00051 void setJDay(double JD);
00054 double getJDay(void) const;
00055
00073 void setDate(const QString& dt, const QString& spec="utc");
00074
00080 QString getDate(const QString& spec="utc");
00081
00087 void setTimeRate(double ts);
00090 double getTimeRate(void) const;
00091
00095 bool isRealTime();
00096
00098 void setRealTime();
00099
00102 void wait(double t);
00103
00112 void waitFor(const QString& dt, const QString& spec="utc");
00113
00119 void selectObjectByName(const QString& name, bool pointer=false);
00120
00131 QVariantMap getObjectPosition(const QString& name);
00132
00140 void clear(const QString& state="natural");
00141
00145 double getViewAltitudeAngle();
00146
00150 double getViewAzimuthAngle();
00151
00155 double getViewRaAngle();
00156
00160 double getViewDecAngle();
00161
00164 double getViewRaJ2000Angle();
00165
00168 double getViewDecJ2000Angle();
00169
00175 void moveToAltAzi(const QString& alt, const QString& azi, float duration=1.);
00176
00182 void moveToRaDec(const QString& ra, const QString& dec, float duration=1.);
00183
00189 void moveToRaDecJ2000(const QString& ra, const QString& dec, float duration=1.);
00190
00208 void setObserverLocation(double longitude, double latitude, double altitude, double duration=1., const QString& name="", const QString& planet="");
00209
00215 void setObserverLocation(const QString id, double duration=1.);
00216
00219 QString getObserverLocation();
00220
00226 void screenshot(const QString& prefix, bool invert=false, const QString& dir="");
00227
00231 void setGuiVisible(bool b);
00232
00238 void setMinFps(float m);
00239
00242 float getMinFps();
00243
00246 void setMaxFps(float m);
00247
00250 float getMaxFps();
00251
00254 QString getMountMode();
00255
00258 void setMountMode(const QString& mode);
00259
00262 bool getNightMode();
00263
00266 void setNightMode(bool b);
00267
00271 QString getProjectionMode();
00272
00284 void setProjectionMode(const QString& id);
00285
00288 bool getDiskViewport();
00289
00292 void setDiskViewport(bool b);
00293
00296 QStringList getAllSkyCultureIDs(void);
00297
00301 QString getSkyCulture();
00302
00305 void setSkyCulture(const QString& id);
00306
00309 bool getFlagGravityLabels();
00310
00313 void setFlagGravityLabels(bool b);
00314
00333 void loadSkyImage(const QString& id, const QString& filename,
00334 double ra0, double dec0,
00335 double ra1, double dec1,
00336 double ra2, double dec2,
00337 double ra3, double dec3,
00338 double minRes=2.5, double maxBright=14, bool visible=true);
00339
00343 void loadSkyImage(const QString& id, const QString& filename,
00344 const QString& ra0, const QString& dec0,
00345 const QString& ra1, const QString& dec1,
00346 const QString& ra2, const QString& dec2,
00347 const QString& ra3, const QString& dec3,
00348 double minRes=2.5, double maxBright=14, bool visible=true);
00349
00364 void loadSkyImage(const QString& id, const QString& filename,
00365 double ra, double dec, double angSize, double rotation,
00366 double minRes=2.5, double maxBright=14, bool visible=true);
00367
00372 void loadSkyImage(const QString& id, const QString& filename,
00373 const QString& ra, const QString& dec, double angSize, double rotation,
00374 double minRes=2.5, double maxBright=14, bool visible=true);
00375
00378 void removeSkyImage(const QString& id);
00379
00384 void loadSound(const QString& filename, const QString& id);
00385
00388 void playSound(const QString& id);
00389
00393 void pauseSound(const QString& id);
00394
00399 void stopSound(const QString& id);
00400
00404 void dropSound(const QString& id);
00405
00408 int getScreenWidth(void);
00411 int getScreenHeight(void);
00412
00415 double getScriptRate(void);
00420 void setScriptRate(double r);
00421
00424 void setSelectedObjectInfo(const QString& level);
00425
00427 void exit(void);
00428
00430 void quitStellarium(void);
00431
00434 void debug(const QString& s);
00435
00436 signals:
00437 void requestLoadSkyImage(const QString& id, const QString& filename,
00438 double c1, double c2,
00439 double c3, double c4,
00440 double c5, double c6,
00441 double c7, double c8,
00442 double minRes, double maxBright, bool visible);
00443
00444 void requestRemoveSkyImage(const QString& id);
00445
00446 void requestLoadSound(const QString& filename, const QString& id);
00447 void requestPlaySound(const QString& id);
00448 void requestPauseSound(const QString& id);
00449 void requestStopSound(const QString& id);
00450 void requestDropSound(const QString& id);
00451 void requestSetNightMode(bool b);
00452 void requestSetProjectionMode(QString id);
00453 void requestSetSkyCulture(QString id);
00454 void requestSetDiskViewport(bool b);
00455 void requestExit();
00456
00457 private:
00461 double jdFromDateString(const QString& dt, const QString& spec);
00462 ScriptSleeper scriptSleeper;
00463 };
00464
00465 #endif // _STELMAINSCRIPTAPI_HPP_
00466