StelMainScriptAPI.cpp   StelMainScriptAPI.cpp 
skipping to change at line 54 skipping to change at line 54
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelSkyLayerMgr.hpp" #include "StelSkyLayerMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelGuiBase.hpp" #include "StelGuiBase.hpp"
#include "MilkyWay.hpp" #include "MilkyWay.hpp"
#include "ZodiacalLight.hpp"
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QRegExp> #include <QRegExp>
#include <QSet> #include <QSet>
#include <QStringList> #include <QStringList>
#include <QTemporaryFile> #include <QTemporaryFile>
skipping to change at line 135 skipping to change at line 136
//! Get the current date in Modified Julian Day //! Get the current date in Modified Julian Day
//! @return the Modified Julian Date //! @return the Modified Julian Date
double StelMainScriptAPI::getMJDay() const double StelMainScriptAPI::getMJDay() const
{ {
return StelApp::getInstance().getCore()->getMJDay(); return StelApp::getInstance().getCore()->getMJDay();
} }
void StelMainScriptAPI::setDate(const QString& dt, const QString& spec, con st bool &enableDeltaT) void StelMainScriptAPI::setDate(const QString& dt, const QString& spec, con st bool &enableDeltaT)
{ {
bool relativeTime = false;
if (dt.startsWith("+") || dt.startsWith("-") || (dt.startsWith("now"
) && (dt.startsWith("+") || dt.startsWith("-"))))
relativeTime = true;
double JD = jdFromDateString(dt, spec); double JD = jdFromDateString(dt, spec);
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
if (enableDeltaT) if (relativeTime)
{ {
// add Delta-T correction for date core->setJDay(JD);
core->setJDay(JD + core->getDeltaT(JD)/86400);
} }
else else
{ {
// set date without Delta-T correction if (enableDeltaT)
// compatible with 0.11 {
core->setJDay(JD); // add Delta-T correction for date
core->setJDay(JD + core->getDeltaT(JD)/86400);
}
else
{
// set date without Delta-T correction
// compatible with 0.11
core->setJDay(JD);
}
} }
} }
QString StelMainScriptAPI::getDate(const QString& spec) QString StelMainScriptAPI::getDate(const QString& spec)
{ {
if (spec=="utc") if (spec=="utc")
return StelUtils::julianDayToISO8601String(getJDay()); return StelUtils::julianDayToISO8601String(getJDay());
else else
return StelUtils::julianDayToISO8601String(getJDay()+StelUti ls::getGMTShiftFromQT(getJDay())/24); return StelUtils::julianDayToISO8601String(getJDay()+StelUti ls::getGMTShiftFromQT(getJDay())/24);
} }
skipping to change at line 784 skipping to change at line 795
pos = obj->getGalacticPos(core); pos = obj->getGalacticPos(core);
StelUtils::rectToSphe(&glong, &glat, pos); StelUtils::rectToSphe(&glong, &glat, pos);
map.insert("glong", glong*180./M_PI); map.insert("glong", glong*180./M_PI);
map.insert("glat", glat*180./M_PI); map.insert("glat", glat*180./M_PI);
// magnitude // magnitude
map.insert("vmag", obj->getVMagnitude(core)); map.insert("vmag", obj->getVMagnitude(core));
map.insert("vmage", obj->getVMagnitudeWithExtinction(core)); map.insert("vmage", obj->getVMagnitudeWithExtinction(core));
// angular size // angular size
map.insert("size", obj->getAngularSize(core)); double angularSize = 2.*obj->getAngularSize(core)*M_PI/180.;
bool sign;
double deg;
StelUtils::radToDecDeg(angularSize, sign, deg);
if (!sign)
deg *= -1;
map.insert("size", angularSize);
map.insert("size-dd", deg);
map.insert("size-deg", StelUtils::radToDecDegStr(angularSize, 5));
map.insert("size-dms", StelUtils::radToDmsStr(angularSize, true));
if (obj->getType().toLower()=="planet" && name!="Sun")
{
SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
map.insert("distance", obj->getJ2000EquatorialPos(core).leng
th());
double phase = ssmgr->getPhaseForPlanet(name);
map.insert("phase", phase);
map.insert("illumination", 100.*phase);
double phaseAngle = ssmgr->getPhaseAngleForPlanet(name);
map.insert("phase-angle", phaseAngle);
map.insert("phase-angle-dms", StelUtils::radToDmsStr(phaseAn
gle));
map.insert("phase-angle-deg", StelUtils::radToDecDegStr(phas
eAngle));
double elongation = ssmgr->getElongationForPlanet(name);
map.insert("elongation", elongation);
map.insert("elongation-dms", StelUtils::radToDmsStr(elongati
on));
map.insert("elongation-deg", StelUtils::radToDecDegStr(elong
ation));
}
// localized name // localized name
map.insert("localized-name", obj->getNameI18n()); map.insert("localized-name", obj->getNameI18n());
return map; return map;
} }
QVariantMap StelMainScriptAPI::getSelectedObjectInfo() QVariantMap StelMainScriptAPI::getSelectedObjectInfo()
{ {
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
skipping to change at line 864 skipping to change at line 901
pos = obj->getGalacticPos(core); pos = obj->getGalacticPos(core);
StelUtils::rectToSphe(&glong, &glat, pos); StelUtils::rectToSphe(&glong, &glat, pos);
map.insert("glong", glong*180./M_PI); map.insert("glong", glong*180./M_PI);
map.insert("glat", glat*180./M_PI); map.insert("glat", glat*180./M_PI);
// magnitude // magnitude
map.insert("vmag", obj->getVMagnitude(core)); map.insert("vmag", obj->getVMagnitude(core));
map.insert("vmage", obj->getVMagnitudeWithExtinction(core)); map.insert("vmage", obj->getVMagnitudeWithExtinction(core));
// angular size // angular size
map.insert("size", obj->getAngularSize(core)); double angularSize = 2.*obj->getAngularSize(core)*M_PI/180.;
bool sign;
double deg;
StelUtils::radToDecDeg(angularSize, sign, deg);
if (!sign)
deg *= -1;
map.insert("size", angularSize);
map.insert("size-dd", deg);
map.insert("size-deg", StelUtils::radToDecDegStr(angularSize, 5));
map.insert("size-dms", StelUtils::radToDmsStr(angularSize, true));
if (obj->getType().toLower()=="planet" && obj->getEnglishName()!="Su
n")
{
SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
map.insert("distance", obj->getJ2000EquatorialPos(core).leng
th());
double phase = ssmgr->getPhaseForPlanet(obj->getEnglishName(
));
map.insert("phase", phase);
map.insert("illumination", 100.*phase);
double phaseAngle = ssmgr->getPhaseAngleForPlanet(obj->getEn
glishName());
map.insert("phase-angle", phaseAngle);
map.insert("phase-angle-dms", StelUtils::radToDmsStr(phaseAn
gle));
map.insert("phase-angle-deg", StelUtils::radToDecDegStr(phas
eAngle));
double elongation = ssmgr->getElongationForPlanet(obj->getEn
glishName());
map.insert("elongation", elongation);
map.insert("elongation-dms", StelUtils::radToDmsStr(elongati
on));
map.insert("elongation-deg", StelUtils::radToDecDegStr(elong
ation));
}
// english name or designation & localized name // english name or designation & localized name
map.insert("name", obj->getEnglishName()); map.insert("name", obj->getEnglishName());
map.insert("localized-name", obj->getNameI18n()); map.insert("localized-name", obj->getNameI18n());
return map; return map;
} }
void StelMainScriptAPI::clear(const QString& state) void StelMainScriptAPI::clear(const QString& state)
{ {
LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr); LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr);
SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
MeteorMgr* mmgr = GETSTELMODULE(MeteorMgr); MeteorMgr* mmgr = GETSTELMODULE(MeteorMgr);
StelSkyDrawer* skyd = StelApp::getInstance().getCore()->getSkyDrawer (); StelSkyDrawer* skyd = StelApp::getInstance().getCore()->getSkyDrawer ();
ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr); ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr);
StarMgr* smgr = GETSTELMODULE(StarMgr); StarMgr* smgr = GETSTELMODULE(StarMgr);
NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr); NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
GridLinesMgr* glmgr = GETSTELMODULE(GridLinesMgr); GridLinesMgr* glmgr = GETSTELMODULE(GridLinesMgr);
StelMovementMgr* movmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* movmgr = GETSTELMODULE(StelMovementMgr);
ZodiacalLight* zl = GETSTELMODULE(ZodiacalLight);
if (state.toLower() == "natural") if (state.toLower() == "natural")
{ {
movmgr->setMountMode(StelMovementMgr::MountAltAzimuthal); movmgr->setMountMode(StelMovementMgr::MountAltAzimuthal);
skyd->setFlagTwinkle(true); skyd->setFlagTwinkle(true);
skyd->setFlagLuminanceAdaptation(true); skyd->setFlagLuminanceAdaptation(true);
ssmgr->setFlagPlanets(true); ssmgr->setFlagPlanets(true);
ssmgr->setFlagHints(false); ssmgr->setFlagHints(false);
ssmgr->setFlagOrbits(false); ssmgr->setFlagOrbits(false);
ssmgr->setFlagMoonScale(false); ssmgr->setFlagMoonScale(false);
skipping to change at line 916 skipping to change at line 980
cmgr->setFlagLines(false); cmgr->setFlagLines(false);
cmgr->setFlagLabels(false); cmgr->setFlagLabels(false);
cmgr->setFlagBoundaries(false); cmgr->setFlagBoundaries(false);
cmgr->setFlagArt(false); cmgr->setFlagArt(false);
smgr->setFlagLabels(false); smgr->setFlagLabels(false);
ssmgr->setFlagLabels(false); ssmgr->setFlagLabels(false);
nmgr->setFlagHints(false); nmgr->setFlagHints(false);
lmgr->setFlagLandscape(true); lmgr->setFlagLandscape(true);
lmgr->setFlagAtmosphere(true); lmgr->setFlagAtmosphere(true);
lmgr->setFlagFog(true); lmgr->setFlagFog(true);
zl->setFlagShow(true);
} }
else if (state.toLower() == "starchart") else if (state.toLower() == "starchart")
{ {
movmgr->setMountMode(StelMovementMgr::MountEquinoxEquatorial ); movmgr->setMountMode(StelMovementMgr::MountEquinoxEquatorial );
skyd->setFlagTwinkle(false); skyd->setFlagTwinkle(false);
skyd->setFlagLuminanceAdaptation(false); skyd->setFlagLuminanceAdaptation(false);
ssmgr->setFlagPlanets(true); ssmgr->setFlagPlanets(true);
ssmgr->setFlagHints(false); ssmgr->setFlagHints(false);
ssmgr->setFlagOrbits(false); ssmgr->setFlagOrbits(false);
ssmgr->setFlagMoonScale(false); ssmgr->setFlagMoonScale(false);
skipping to change at line 948 skipping to change at line 1013
cmgr->setFlagLines(true); cmgr->setFlagLines(true);
cmgr->setFlagLabels(true); cmgr->setFlagLabels(true);
cmgr->setFlagBoundaries(true); cmgr->setFlagBoundaries(true);
cmgr->setFlagArt(false); cmgr->setFlagArt(false);
smgr->setFlagLabels(true); smgr->setFlagLabels(true);
ssmgr->setFlagLabels(true); ssmgr->setFlagLabels(true);
nmgr->setFlagHints(true); nmgr->setFlagHints(true);
lmgr->setFlagLandscape(false); lmgr->setFlagLandscape(false);
lmgr->setFlagAtmosphere(false); lmgr->setFlagAtmosphere(false);
lmgr->setFlagFog(false); lmgr->setFlagFog(false);
zl->setFlagShow(false);
} }
else if (state.toLower() == "deepspace") else if (state.toLower() == "deepspace")
{ {
movmgr->setMountMode(StelMovementMgr::MountEquinoxEquatorial ); movmgr->setMountMode(StelMovementMgr::MountEquinoxEquatorial );
skyd->setFlagTwinkle(false); skyd->setFlagTwinkle(false);
skyd->setFlagLuminanceAdaptation(false); skyd->setFlagLuminanceAdaptation(false);
ssmgr->setFlagPlanets(false); ssmgr->setFlagPlanets(false);
ssmgr->setFlagHints(false); ssmgr->setFlagHints(false);
ssmgr->setFlagOrbits(false); ssmgr->setFlagOrbits(false);
ssmgr->setFlagMoonScale(false); ssmgr->setFlagMoonScale(false);
skipping to change at line 980 skipping to change at line 1046
cmgr->setFlagLines(false); cmgr->setFlagLines(false);
cmgr->setFlagLabels(false); cmgr->setFlagLabels(false);
cmgr->setFlagBoundaries(false); cmgr->setFlagBoundaries(false);
cmgr->setFlagArt(false); cmgr->setFlagArt(false);
smgr->setFlagLabels(false); smgr->setFlagLabels(false);
ssmgr->setFlagLabels(false); ssmgr->setFlagLabels(false);
nmgr->setFlagHints(false); nmgr->setFlagHints(false);
lmgr->setFlagLandscape(false); lmgr->setFlagLandscape(false);
lmgr->setFlagAtmosphere(false); lmgr->setFlagAtmosphere(false);
lmgr->setFlagFog(false); lmgr->setFlagFog(false);
zl->setFlagShow(false);
} }
else else
{ {
qWarning() << "WARNING clear(" << state << ") - state not kn own"; qWarning() << "WARNING clear(" << state << ") - state not kn own";
} }
} }
double StelMainScriptAPI::getViewAltitudeAngle() double StelMainScriptAPI::getViewAltitudeAngle()
{ {
const Vec3d& current = StelApp::getInstance().getCore()->j2000ToAltA z(GETSTELMODULE(StelMovementMgr)->getViewDirectionJ2000(), StelCore::Refrac tionOff); const Vec3d& current = StelApp::getInstance().getCore()->j2000ToAltA z(GETSTELMODULE(StelMovementMgr)->getViewDirectionJ2000(), StelCore::Refrac tionOff);
skipping to change at line 1077 skipping to change at line 1144
mvmgr->moveToJ2000(StelApp::getInstance().getCore()->equinoxEquToJ20 00(aim), duration); mvmgr->moveToJ2000(StelApp::getInstance().getCore()->equinoxEquToJ20 00(aim), duration);
} }
void StelMainScriptAPI::moveToRaDecJ2000(const QString& ra, const QString& dec, float duration) void StelMainScriptAPI::moveToRaDecJ2000(const QString& ra, const QString& dec, float duration)
{ {
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
Q_ASSERT(mvmgr); Q_ASSERT(mvmgr);
GETSTELMODULE(StelObjectMgr)->unSelect(); GETSTELMODULE(StelObjectMgr)->unSelect();
Vec3d aimJ2000, aimEquofDate; Vec3d aimJ2000;
double dRa = StelUtils::getDecAngle(ra); double dRa = StelUtils::getDecAngle(ra);
double dDec = StelUtils::getDecAngle(dec); double dDec = StelUtils::getDecAngle(dec);
StelUtils::spheToRect(dRa,dDec,aimJ2000); StelUtils::spheToRect(dRa,dDec,aimJ2000);
aimEquofDate = StelApp::getInstance().getCore()->j2000ToEquinoxEqu(a mvmgr->moveToJ2000(aimJ2000, duration);
imJ2000);
mvmgr->moveToJ2000(aimEquofDate, duration);
} }
QString StelMainScriptAPI::getAppLanguage() QString StelMainScriptAPI::getAppLanguage()
{ {
return StelApp::getInstance().getLocaleMgr().getAppLanguage(); return StelApp::getInstance().getLocaleMgr().getAppLanguage();
} }
void StelMainScriptAPI::setAppLanguage(QString langCode) void StelMainScriptAPI::setAppLanguage(QString langCode)
{ {
StelApp::getInstance().getLocaleMgr().setAppLanguage(langCode); StelApp::getInstance().getLocaleMgr().setAppLanguage(langCode);
skipping to change at line 1125 skipping to change at line 1191
void StelMainScriptAPI::setMilkyWayIntensity(double i) void StelMainScriptAPI::setMilkyWayIntensity(double i)
{ {
GETSTELMODULE(MilkyWay)->setIntensity(i); GETSTELMODULE(MilkyWay)->setIntensity(i);
} }
double StelMainScriptAPI::getMilkyWayIntensity() double StelMainScriptAPI::getMilkyWayIntensity()
{ {
return GETSTELMODULE(MilkyWay)->getIntensity(); return GETSTELMODULE(MilkyWay)->getIntensity();
} }
void StelMainScriptAPI::setZodiacalLightVisible(bool b)
{
GETSTELMODULE(ZodiacalLight)->setFlagShow(b);
}
void StelMainScriptAPI::setZodiacalLightIntensity(double i)
{
GETSTELMODULE(ZodiacalLight)->setIntensity(i);
}
double StelMainScriptAPI::getZodiacalLightIntensity()
{
return GETSTELMODULE(ZodiacalLight)->getIntensity();
}
 End of changes. 14 change blocks. 
12 lines changed or deleted 92 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/