161
161
return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->getDeltaT(getJDay())/3600.);
164
QString StelMainScriptAPI::getDeltaTAlgorithm() const
166
return StelApp::getInstance().getCore()->getCurrentDeltaTAlgorithmKey();
169
void StelMainScriptAPI::setDeltaTAlgorithm(QString algorithmName)
171
StelApp::getInstance().getCore()->setCurrentDeltaTAlgorithmKey(algorithmName);
164
174
//! Set time speed in JDay/sec
165
175
//! @param ts time speed in JDay/sec
166
176
void StelMainScriptAPI::setTimeRate(double ts)
643
QRegExp nowRe("^(now)?(\\s*([+\\-])\\s*(\\d+(\\.\\d+)?)\\s*(second|seconds|minute|minutes|hour|hours|day|days|week|weeks))(\\s+(sidereal)?)?");
654
QRegExp nowRe("^(now)?(\\s*([+\\-])\\s*(\\d+(\\.\\d+)?)\\s*(second|seconds|minute|minutes|hour|hours|day|days|week|weeks|month|months|year|years))(\\s+(sidereal)?)?");
644
655
if (nowRe.exactMatch(dt))
648
659
double dayLength = 1.0;
660
double yearLength = 365.242190419; // duration of Earth's mean tropical year
661
double monthLength = 27.321582241; // duration of Earth's mean tropical month
650
663
if (nowRe.capturedTexts().at(1)=="now")
651
664
jd = StelUtils::getJDFromSystem();
653
jd = StelApp::getInstance().getCore()->getJDay();
666
jd = core->getJDay();
655
668
if (nowRe.capturedTexts().at(8) == "sidereal")
656
dayLength = StelApp::getInstance().getCore()->getLocalSideralDayLength();
670
dayLength = core->getLocalSideralDayLength();
671
yearLength = core->getLocalSideralYearLength();
672
monthLength = 27.321661; // duration of Earth's sidereal month
658
675
QString unitString = nowRe.capturedTexts().at(6);
659
676
if (unitString == "seconds" || unitString == "second")
790
QVariantMap StelMainScriptAPI::getSelectedObjectInfo()
792
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
794
if (omgr->getSelectedObject().isEmpty())
796
debug("getObjectData WARNING - object not selected");
797
map.insert("found", false);
801
StelObjectP obj = omgr->getSelectedObject()[0];
805
debug("getObjectData WARNING - object not found");
806
map.insert("found", false);
811
map.insert("found", true);
814
// OK, object found. Let's go.
816
double ra, dec, alt, azi, glong, glat;
817
StelCore* core = StelApp::getInstance().getCore();
820
pos = obj->getEquinoxEquatorialPos(core);
821
StelUtils::rectToSphe(&ra, &dec, pos);
822
map.insert("ra", ra*180./M_PI);
823
map.insert("dec", dec*180./M_PI);
826
pos = obj->getJ2000EquatorialPos(core);
827
StelUtils::rectToSphe(&ra, &dec, pos);
828
map.insert("raJ2000", ra*180./M_PI);
829
map.insert("decJ2000", dec*180./M_PI);
831
// apparent altitude/azimuth
832
pos = obj->getAltAzPosApparent(core);
833
StelUtils::rectToSphe(&azi, &alt, pos);
834
map.insert("altitude", alt*180./M_PI);
835
map.insert("azimuth", azi*180./M_PI);
837
// geometric altitude/azimuth
838
pos = obj->getAltAzPosGeometric(core);
839
StelUtils::rectToSphe(&azi, &alt, pos);
840
map.insert("altitude-geometric", alt*180./M_PI);
841
map.insert("azimuth-geometric", azi*180./M_PI);
843
// galactic long/lat in J2000
844
pos = obj->getJ2000GalacticPos(core);
845
StelUtils::rectToSphe(&glong, &glat, pos);
846
map.insert("glong", alt*180./M_PI);
847
map.insert("glat", azi*180./M_PI);
850
map.insert("vmag", obj->getVMagnitude(core, false));
851
map.insert("vmage", obj->getVMagnitude(core, true));
854
map.insert("size", obj->getAngularSize(core));
856
// english name or designation & localized name
857
map.insert("name", obj->getEnglishName());
858
map.insert("localized-name", obj->getNameI18n());
769
864
void StelMainScriptAPI::clear(const QString& state)
771
866
LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr);