StelMainScriptAPI.cpp   StelMainScriptAPI.cpp 
skipping to change at line 53 skipping to change at line 53
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#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 <QAction> #include <QAction>
#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>
skipping to change at line 132 skipping to change at line 133
} }
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);
} }
QString StelMainScriptAPI::getDeltaT() const
{
return StelUtils::hoursToHmsStr(StelUtils::getDeltaT(getJDay())/3600
.);
}
//! Set time speed in JDay/sec //! Set time speed in JDay/sec
//! @param ts time speed in JDay/sec //! @param ts time speed in JDay/sec
void StelMainScriptAPI::setTimeRate(double ts) void StelMainScriptAPI::setTimeRate(double ts)
{ {
// 1 second = .00001157407407407407 JDay // 1 second = .00001157407407407407 JDay
StelApp::getInstance().getCore()->setTimeRate(ts * 0.000011574074074 07407 * StelMainGraphicsView::getInstance().getScriptMgr().getScriptRate()) ; StelApp::getInstance().getCore()->setTimeRate(ts * 0.000011574074074 07407 * StelMainGraphicsView::getInstance().getScriptMgr().getScriptRate()) ;
} }
//! Get time speed in JDay/sec //! Get time speed in JDay/sec
//! @return time speed in JDay/sec //! @return time speed in JDay/sec
skipping to change at line 193 skipping to change at line 199
} }
QString StelMainScriptAPI::getObserverLocation() QString StelMainScriptAPI::getObserverLocation()
{ {
return StelApp::getInstance().getCore()->getCurrentLocation().getID( ); return StelApp::getInstance().getCore()->getCurrentLocation().getID( );
} }
QVariantMap StelMainScriptAPI::getObserverLocationInfo() QVariantMap StelMainScriptAPI::getObserverLocationInfo()
{ {
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
const PlanetP& planet = core->getCurrentPlanet();
double siderealDay = planet->getSiderealDay();
double siderealPeriod = planet->getSiderealPeriod();
double solarDay;
QString planetName = core->getCurrentLocation().planetName;
if ((planetName == "Venus") || (planetName == "Uranus"))
solarDay = StelUtils::calculateSolarDay(siderealPeriod, side
realDay, false);
else
solarDay = StelUtils::calculateSolarDay(siderealPeriod, side
realDay, true);
QVariantMap map; QVariantMap map;
map.insert("longitude", core->getCurrentLocation().longitude); map.insert("longitude", core->getCurrentLocation().longitude);
map.insert("latitude", core->getCurrentLocation().latitude); map.insert("latitude", core->getCurrentLocation().latitude);
map.insert("planet", core->getCurrentLocation().planetName); map.insert("planet", planetName);
map.insert("altitude", core->getCurrentLocation().altitude); map.insert("altitude", core->getCurrentLocation().altitude);
map.insert("location", core->getCurrentLocation().getID()); map.insert("location", core->getCurrentLocation().getID());
// extra data
map.insert("sidereal-year", siderealPeriod);
map.insert("sidereal-day", siderealDay*24.);
map.insert("solar-day", solarDay*24.);
return map; return map;
} }
void StelMainScriptAPI::screenshot(const QString& prefix, bool invert, cons t QString& dir) void StelMainScriptAPI::screenshot(const QString& prefix, bool invert, cons t QString& dir)
{ {
bool oldInvertSetting = StelMainGraphicsView::getInstance().getFlagI nvertScreenShotColors(); bool oldInvertSetting = StelMainGraphicsView::getInstance().getFlagI nvertScreenShotColors();
StelMainGraphicsView::getInstance().setFlagInvertScreenShotColors(in vert); StelMainGraphicsView::getInstance().setFlagInvertScreenShotColors(in vert);
StelMainGraphicsView::getInstance().saveScreenShot(prefix, dir); StelMainGraphicsView::getInstance().saveScreenShot(prefix, dir);
StelMainGraphicsView::getInstance().setFlagInvertScreenShotColors(ol dInvertSetting); StelMainGraphicsView::getInstance().setFlagInvertScreenShotColors(ol dInvertSetting);
skipping to change at line 648 skipping to change at line 668
void StelMainScriptAPI::selectObjectByName(const QString& name, bool pointe r) void StelMainScriptAPI::selectObjectByName(const QString& name, bool pointe r)
{ {
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
omgr->setFlagSelectedObjectPointer(pointer); omgr->setFlagSelectedObjectPointer(pointer);
if (name=="") if (name=="")
omgr->unSelect(); omgr->unSelect();
else else
omgr->findAndSelect(name); omgr->findAndSelect(name);
} }
//DEPRECATED: Use getObjectInfo()
QVariantMap StelMainScriptAPI::getObjectPosition(const QString& name) QVariantMap StelMainScriptAPI::getObjectPosition(const QString& name)
{ {
return getObjectInfo(name);
}
QVariantMap StelMainScriptAPI::getObjectInfo(const QString& name)
{
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
StelObjectP obj = omgr->searchByName(name); StelObjectP obj = omgr->searchByName(name);
QVariantMap map; QVariantMap map;
if (!obj) if (!obj)
{ {
debug("getObjectData WARNING - object not found: " + name); debug("getObjectData WARNING - object not found: " + name);
map.insert("found", false); map.insert("found", false);
return map; return map;
} }
else else
{ {
map.insert("found", true); map.insert("found", true);
} }
Vec3d pos; Vec3d pos;
double ra, dec, alt, azi; double ra, dec, alt, azi, glong, glat;
StelCore* core = StelApp::getInstance().getCore();
// ra/dec // ra/dec
pos = obj->getEquinoxEquatorialPos(StelApp::getInstance().getCore()) ; pos = obj->getEquinoxEquatorialPos(core);
StelUtils::rectToSphe(&ra, &dec, pos); StelUtils::rectToSphe(&ra, &dec, pos);
map.insert("ra", ra*180./M_PI); map.insert("ra", ra*180./M_PI);
map.insert("dec", dec*180./M_PI); map.insert("dec", dec*180./M_PI);
// ra/dec in J2000 // ra/dec in J2000
pos = obj->getJ2000EquatorialPos(StelApp::getInstance().getCore()); pos = obj->getJ2000EquatorialPos(core);
StelUtils::rectToSphe(&ra, &dec, pos); StelUtils::rectToSphe(&ra, &dec, pos);
map.insert("raJ2000", ra*180./M_PI); map.insert("raJ2000", ra*180./M_PI);
map.insert("decJ2000", dec*180./M_PI); map.insert("decJ2000", dec*180./M_PI);
// altitude/azimuth // apparent altitude/azimuth
pos = obj->getAltAzPosApparent(StelApp::getInstance().getCore()); pos = obj->getAltAzPosApparent(core);
StelUtils::rectToSphe(&azi, &alt, pos); StelUtils::rectToSphe(&azi, &alt, pos);
map.insert("altitude", alt*180./M_PI); map.insert("altitude", alt*180./M_PI);
map.insert("azimuth", azi*180./M_PI); map.insert("azimuth", azi*180./M_PI);
pos = obj->getAltAzPosGeometric(StelApp::getInstance().getCore()); // geometric altitude/azimuth
pos = obj->getAltAzPosGeometric(core);
StelUtils::rectToSphe(&azi, &alt, pos); StelUtils::rectToSphe(&azi, &alt, pos);
map.insert("altitude-geometric", alt*180./M_PI); map.insert("altitude-geometric", alt*180./M_PI);
map.insert("azimuth-geometric", azi*180./M_PI); map.insert("azimuth-geometric", azi*180./M_PI);
// galactic long/lat in J2000
pos = obj->getJ2000GalacticPos(core);
StelUtils::rectToSphe(&glong, &glat, pos);
map.insert("glong", alt*180./M_PI);
map.insert("glat", azi*180./M_PI);
// magnitude
map.insert("vmag", obj->getVMagnitude(core, false));
map.insert("vmage", obj->getVMagnitude(core, true));
// angular size
map.insert("size", obj->getAngularSize(core));
// localized name
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);
skipping to change at line 931 skipping to change at line 975
void StelMainScriptAPI::setSkyLanguage(QString langCode) void StelMainScriptAPI::setSkyLanguage(QString langCode)
{ {
StelApp::getInstance().getLocaleMgr().setSkyLanguage(langCode); StelApp::getInstance().getLocaleMgr().setSkyLanguage(langCode);
} }
void StelMainScriptAPI::goHome() void StelMainScriptAPI::goHome()
{ {
emit(requestSetHomePosition()); emit(requestSetHomePosition());
} }
void StelMainScriptAPI::setMilkyWayVisible(bool b)
{
GETSTELMODULE(MilkyWay)->setFlagShow(b);
}
void StelMainScriptAPI::setMilkyWayIntensity(float i)
{
GETSTELMODULE(MilkyWay)->setIntensity(i);
}
float StelMainScriptAPI::getMilkyWayIntensity()
{
return GETSTELMODULE(MilkyWay)->getIntensity();
}
 End of changes. 14 change blocks. 
7 lines changed or deleted 54 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/