StelMainScriptAPI.cpp   StelMainScriptAPI.cpp 
skipping to change at line 120 skipping to change at line 120
StelApp::getInstance().getCore()->setJDay(JD); StelApp::getInstance().getCore()->setJDay(JD);
} }
//! Get the current date in Julian Day //! Get the current date in Julian Day
//! @return the Julian Date //! @return the Julian Date
double StelMainScriptAPI::getJDay() const double StelMainScriptAPI::getJDay() const
{ {
return StelApp::getInstance().getCore()->getJDay(); return StelApp::getInstance().getCore()->getJDay();
} }
void StelMainScriptAPI::setDate(const QString& dt, const QString& spec) //! Set the current date in Modified Julian Day
//! @param MJD the Modified Julian Date
void StelMainScriptAPI::setMJDay(double MJD)
{ {
StelApp::getInstance().getCore()->setJDay(jdFromDateString(dt, spec) StelApp::getInstance().getCore()->setMJDay(MJD);
); }
//! Get the current date in Modified Julian Day
//! @return the Modified Julian Date
double StelMainScriptAPI::getMJDay() const
{
return StelApp::getInstance().getCore()->getMJDay();
}
void StelMainScriptAPI::setDate(const QString& dt, const QString& spec, con
st bool &enableDeltaT)
{
double JD = jdFromDateString(dt, spec);
StelCore* core = StelApp::getInstance().getCore();
if (enableDeltaT)
{
// 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);
} }
QString StelMainScriptAPI::getDeltaT() const QString StelMainScriptAPI::getDeltaT() const
{ {
return StelUtils::hoursToHmsStr(StelUtils::getDeltaT(getJDay())/3600 .); return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->ge tDeltaT(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()) ;
} }
skipping to change at line 200 skipping to change at line 226
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(); const PlanetP& planet = core->getCurrentPlanet();
double siderealDay = planet->getSiderealDay();
double siderealPeriod = planet->getSiderealPeriod();
double solarDay;
QString planetName = core->getCurrentLocation().planetName; 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", 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 // extra data
map.insert("sidereal-year", siderealPeriod); map.insert("sidereal-year", planet->getSiderealPeriod());
map.insert("sidereal-day", siderealDay*24.); map.insert("sidereal-day", planet->getSiderealDay()*24.);
map.insert("solar-day", solarDay*24.); map.insert("solar-day", planet->getMeanSolarDay()*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 307 skipping to change at line 325
QString StelMainScriptAPI::getSkyCulture() QString StelMainScriptAPI::getSkyCulture()
{ {
return StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultur eID(); return StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultur eID();
} }
void StelMainScriptAPI::setSkyCulture(const QString& id) void StelMainScriptAPI::setSkyCulture(const QString& id)
{ {
emit(requestSetSkyCulture(id)); emit(requestSetSkyCulture(id));
} }
QString StelMainScriptAPI::getSkyCultureName()
{
return StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultur
eEnglishName();
}
QString StelMainScriptAPI::getSkyCultureNameI18n()
{
return StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultur
eNameI18();
}
bool StelMainScriptAPI::getFlagGravityLabels() bool StelMainScriptAPI::getFlagGravityLabels()
{ {
return StelApp::getInstance().getCore()->getProjection(StelCore::Fra meJ2000)->getFlagGravityLabels(); return StelApp::getInstance().getCore()->getProjection(StelCore::Fra meJ2000)->getFlagGravityLabels();
} }
void StelMainScriptAPI::setFlagGravityLabels(bool b) void StelMainScriptAPI::setFlagGravityLabels(bool b)
{ {
StelApp::getInstance().getCore()->setFlagGravityLabels(b); StelApp::getInstance().getCore()->setFlagGravityLabels(b);
} }
skipping to change at line 981 skipping to change at line 1009
void StelMainScriptAPI::goHome() void StelMainScriptAPI::goHome()
{ {
emit(requestSetHomePosition()); emit(requestSetHomePosition());
} }
void StelMainScriptAPI::setMilkyWayVisible(bool b) void StelMainScriptAPI::setMilkyWayVisible(bool b)
{ {
GETSTELMODULE(MilkyWay)->setFlagShow(b); GETSTELMODULE(MilkyWay)->setFlagShow(b);
} }
void StelMainScriptAPI::setMilkyWayIntensity(float i) void StelMainScriptAPI::setMilkyWayIntensity(double i)
{ {
GETSTELMODULE(MilkyWay)->setIntensity(i); GETSTELMODULE(MilkyWay)->setIntensity(i);
} }
float StelMainScriptAPI::getMilkyWayIntensity() double StelMainScriptAPI::getMilkyWayIntensity()
{ {
return GETSTELMODULE(MilkyWay)->getIntensity(); return GETSTELMODULE(MilkyWay)->getIntensity();
} }
 End of changes. 9 change blocks. 
19 lines changed or deleted 47 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/