StelMainScriptAPI.cpp   StelMainScriptAPI.cpp 
skipping to change at line 84 skipping to change at line 84
connect(this, SIGNAL(requestRemoveSkyImage(const QString&)), smgr, SLOT(removeSkyLayer(const QString&))); connect(this, SIGNAL(requestRemoveSkyImage(const QString&)), smgr, SLOT(removeSkyLayer(const QString&)));
} }
connect(this, SIGNAL(requestLoadSound(const QString&, const QString& )), StelApp::getInstance().getStelAudioMgr(), SLOT(loadSound(const QString& , const QString&))); connect(this, SIGNAL(requestLoadSound(const QString&, const QString& )), StelApp::getInstance().getStelAudioMgr(), SLOT(loadSound(const QString& , const QString&)));
connect(this, SIGNAL(requestPlaySound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(playSound(const QString&))); connect(this, SIGNAL(requestPlaySound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(playSound(const QString&)));
connect(this, SIGNAL(requestPauseSound(const QString&)), StelApp::ge tInstance().getStelAudioMgr(), SLOT(pauseSound(const QString&))); connect(this, SIGNAL(requestPauseSound(const QString&)), StelApp::ge tInstance().getStelAudioMgr(), SLOT(pauseSound(const QString&)));
connect(this, SIGNAL(requestStopSound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(stopSound(const QString&))); connect(this, SIGNAL(requestStopSound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(stopSound(const QString&)));
connect(this, SIGNAL(requestDropSound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(dropSound(const QString&))); connect(this, SIGNAL(requestDropSound(const QString&)), StelApp::get Instance().getStelAudioMgr(), SLOT(dropSound(const QString&)));
connect(this, SIGNAL(requestLoadVideo(const QString&, const QString& , float, float, bool, float)), StelApp::getInstance().getStelVideoMgr(), SL OT(loadVideo(const QString&, const QString&, float, float, bool, float))); connect(this, SIGNAL(requestLoadVideo(const QString&, const QString& , float, float, bool, float)), StelApp::getInstance().getStelVideoMgr(), SL OT(loadVideo(const QString&, const QString&, float, float, bool, float)));
connect(this, SIGNAL(requestPlayVideo(const QString&)), StelApp::get connect(this, SIGNAL(requestPlayVideo(const QString&, const bool)),
Instance().getStelVideoMgr(), SLOT(playVideo(const QString&))); StelApp::getInstance().getStelVideoMgr(), SLOT(playVideo(const QString&, co
nst bool)));
connect(this, SIGNAL(requestPlayVideoPopout(QString,float,float,floa
t,float,float,float,float,bool)), StelApp::getInstance().getStelVideoMgr(),
SLOT(playVideoPopout(QString,float,float,float,float,float,float,float,boo
l)));
connect(this, SIGNAL(requestPauseVideo(const QString&)), StelApp::ge tInstance().getStelVideoMgr(), SLOT(pauseVideo(const QString&))); connect(this, SIGNAL(requestPauseVideo(const QString&)), StelApp::ge tInstance().getStelVideoMgr(), SLOT(pauseVideo(const QString&)));
connect(this, SIGNAL(requestStopVideo(const QString&)), StelApp::get Instance().getStelVideoMgr(), SLOT(stopVideo(const QString&))); connect(this, SIGNAL(requestStopVideo(const QString&)), StelApp::get Instance().getStelVideoMgr(), SLOT(stopVideo(const QString&)));
connect(this, SIGNAL(requestDropVideo(const QString&)), StelApp::get Instance().getStelVideoMgr(), SLOT(dropVideo(const QString&))); connect(this, SIGNAL(requestDropVideo(const QString&)), StelApp::get Instance().getStelVideoMgr(), SLOT(dropVideo(const QString&)));
connect(this, SIGNAL(requestSeekVideo(const QString&, qint64)), Stel connect(this, SIGNAL(requestSeekVideo(const QString&, qint64, bool))
App::getInstance().getStelVideoMgr(), SLOT(seekVideo(const QString&, qint64 , StelApp::getInstance().getStelVideoMgr(), SLOT(seekVideo(const QString&,
))); qint64, bool)));
connect(this, SIGNAL(requestSetVideoXY(const QString&, float, float) connect(this, SIGNAL(requestSetVideoXY(const QString&, float, float,
), StelApp::getInstance().getStelVideoMgr(), SLOT(setVideoXY(const QString& bool)), StelApp::getInstance().getStelVideoMgr(), SLOT(setVideoXY(const QS
, float, float))); tring&, float, float, bool)));
connect(this, SIGNAL(requestSetVideoAlpha(const QString&, float)), S telApp::getInstance().getStelVideoMgr(), SLOT(setVideoAlpha(const QString&, float))); connect(this, SIGNAL(requestSetVideoAlpha(const QString&, float)), S telApp::getInstance().getStelVideoMgr(), SLOT(setVideoAlpha(const QString&, float)));
connect(this, SIGNAL(requestResizeVideo(const QString&, float, float )), StelApp::getInstance().getStelVideoMgr(), SLOT(resizeVideo(const QStrin g&, float, float))); connect(this, SIGNAL(requestResizeVideo(const QString&, float, float )), StelApp::getInstance().getStelVideoMgr(), SLOT(resizeVideo(const QStrin g&, float, float)));
connect(this, SIGNAL(requestShowVideo(const QString&, bool)), StelAp p::getInstance().getStelVideoMgr(), SLOT(showVideo(const QString&, bool))); connect(this, SIGNAL(requestShowVideo(const QString&, bool)), StelAp p::getInstance().getStelVideoMgr(), SLOT(showVideo(const QString&, bool)));
connect(this, SIGNAL(requestExit()), this->parent(), SLOT(stopScript ())); connect(this, SIGNAL(requestExit()), this->parent(), SLOT(stopScript ()));
connect(this, SIGNAL(requestSetNightMode(bool)), &StelApp::getInstan ce(), SLOT(setVisionModeNight(bool))); connect(this, SIGNAL(requestSetNightMode(bool)), &StelApp::getInstan ce(), SLOT(setVisionModeNight(bool)));
connect(this, SIGNAL(requestSetProjectionMode(QString)), StelApp::ge tInstance().getCore(), SLOT(setCurrentProjectionTypeKey(QString))); connect(this, SIGNAL(requestSetProjectionMode(QString)), StelApp::ge tInstance().getCore(), SLOT(setCurrentProjectionTypeKey(QString)));
connect(this, SIGNAL(requestSetSkyCulture(QString)), &StelApp::getIn stance().getSkyCultureMgr(), SLOT(setCurrentSkyCultureID(QString))); connect(this, SIGNAL(requestSetSkyCulture(QString)), &StelApp::getIn stance().getSkyCultureMgr(), SLOT(setCurrentSkyCultureID(QString)));
connect(this, SIGNAL(requestSetDiskViewport(bool)), StelApp::getInst ance().getMainScriptAPIProxy(), SLOT(setDiskViewport(bool))); connect(this, SIGNAL(requestSetDiskViewport(bool)), StelApp::getInst ance().getMainScriptAPIProxy(), SLOT(setDiskViewport(bool)));
connect(this, SIGNAL(requestSetHomePosition()), StelApp::getInstance ().getCore(), SLOT(returnToHome())); connect(this, SIGNAL(requestSetHomePosition()), StelApp::getInstance ().getCore(), SLOT(returnToHome()));
skipping to change at line 406 skipping to change at line 407
core->setCurrentProjectionTypeKey(core->getDefaultProjection TypeKey()); core->setCurrentProjectionTypeKey(core->getDefaultProjection TypeKey());
StelApp::getInstance().setViewportEffect("none"); StelApp::getInstance().setViewportEffect("none");
} }
} }
void StelMainScriptAPI::setDiskViewport(bool b) void StelMainScriptAPI::setDiskViewport(bool b)
{ {
emit(requestSetDiskViewport(b)); emit(requestSetDiskViewport(b));
} }
void StelMainScriptAPI::setViewportOffset(const float x, const float y)
{
StelCore* core = StelApp::getInstance().getCore();
core->getMovementMgr()->moveViewport(x,y);
}
void StelMainScriptAPI::setViewportStretch(const float stretch)
{
StelApp::getInstance().getCore()->setViewportStretch(stretch);
}
void StelMainScriptAPI::loadSkyImage(const QString& id, const QString& file name, void StelMainScriptAPI::loadSkyImage(const QString& id, const QString& file name,
double ra0, double dec0, double ra0, double dec0,
double ra1, double dec1, double ra1, double dec1,
double ra2, double dec2, double ra2, double dec2,
double ra3, double dec3, double ra3, double dec3,
double minRes, double maxBright, bool v isible) double minRes, double maxBright, bool v isible)
{ {
QString path = "scripts/" + filename; QString path = "scripts/" + filename;
emit(requestLoadSkyImage(id, path, ra0, dec0, ra1, dec1, ra2, dec2, ra3, dec3, minRes, maxBright, visible)); emit(requestLoadSkyImage(id, path, ra0, dec0, ra1, dec1, ra2, dec2, ra3, dec3, minRes, maxBright, visible));
} }
skipping to change at line 476 skipping to change at line 488
const QString& ra, const QString& dec, const QString& ra, const QString& dec,
double angSize, double rotation, double angSize, double rotation,
double minRes, double maxBright, bool v isible) double minRes, double maxBright, bool v isible)
{ {
loadSkyImage(id, filename, StelUtils::getDecAngle(ra)*180./M_PI, loadSkyImage(id, filename, StelUtils::getDecAngle(ra)*180./M_PI,
StelUtils::getDecAngle(dec)*180./M_PI, angSize, StelUtils::getDecAngle(dec)*180./M_PI, angSize,
rotation, minRes, maxBright, visible); rotation, minRes, maxBright, visible);
} }
void StelMainScriptAPI::loadSkyImageAltAz(const QString& id, const QString& filename, void StelMainScriptAPI::loadSkyImageAltAz(const QString& id, const QString& filename,
double alt0, double azi0, double azi0, double alt0,
double alt1, double azi1, double azi1, double alt1,
double alt2, double azi2, double azi2, double alt2,
double alt3, double azi3, double azi3, double alt3,
double minRes, double maxBright, b ool visible) double minRes, double maxBright, b ool visible)
{ {
QString path = "scripts/" + filename; QString path = "scripts/" + filename;
emit(requestLoadSkyImageAltAz(id, path, alt0, azi0, alt1, azi1, alt2 , azi2, alt3, azi3, minRes, maxBright, visible)); emit(requestLoadSkyImageAltAz(id, path, alt0, azi0, alt1, azi1, alt2 , azi2, alt3, azi3, minRes, maxBright, visible));
} }
void StelMainScriptAPI::loadSkyImageAltAz(const QString& id, const QString& filename, void StelMainScriptAPI::loadSkyImageAltAz(const QString& id, const QString& filename,
double alt, double azi, double alt, double azi,
double angSize, double rotation, double angSize, double rotation,
double minRes, double maxBright, b ool visible) double minRes, double maxBright, b ool visible)
{ {
Vec3f XYZ; Vec3f XYZ;
static const float RADIUS_NEB = 1.; static const float RADIUS_NEB = 1.;
StelUtils::spheToRect((180-azi)*M_PI/180., alt*M_PI/180., XYZ); StelUtils::spheToRect((180-azi)*M_PI/180., alt*M_PI/180., XYZ);
XYZ*=RADIUS_NEB; XYZ*=RADIUS_NEB;
float texSize = RADIUS_NEB * sin(angSize/2/60*M_PI/180); float texSize = RADIUS_NEB * sin(angSize/2/60*M_PI/180);
Mat4f matPrecomp = Mat4f::translation(XYZ) * Mat4f matPrecomp = Mat4f::translation(XYZ) *
Mat4f::zrotation((180-azi)*M_PI/180.) * Mat4f::zrotation((180.-azi)*M_PI/180.) *
Mat4f::yrotation(-alt*M_PI/180.) * Mat4f::yrotation(-alt*M_PI/180.) *
Mat4f::xrotation((rotation+90)*M_PI/180.); Mat4f::xrotation((rotation+90.)*M_PI/180.);
Vec3f corners[4]; Vec3f corners[4];
corners[0] = matPrecomp * Vec3f(0.f,-texSize,-texSize); corners[0] = matPrecomp * Vec3f(0.f,-texSize,-texSize);
corners[1] = matPrecomp * Vec3f(0.f,-texSize, texSize); corners[1] = matPrecomp * Vec3f(0.f,-texSize, texSize);
corners[2] = matPrecomp * Vec3f(0.f, texSize,-texSize); corners[2] = matPrecomp * Vec3f(0.f, texSize,-texSize);
corners[3] = matPrecomp * Vec3f(0.f, texSize, texSize); corners[3] = matPrecomp * Vec3f(0.f, texSize, texSize);
// convert back to alt/azi (radians) // convert back to alt/azi (radians)
Vec3f cornersAltAz[4]; Vec3f cornersAltAz[4];
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
skipping to change at line 558 skipping to change at line 570
void StelMainScriptAPI::stopSound(const QString& id) void StelMainScriptAPI::stopSound(const QString& id)
{ {
emit(requestStopSound(id)); emit(requestStopSound(id));
} }
void StelMainScriptAPI::dropSound(const QString& id) void StelMainScriptAPI::dropSound(const QString& id)
{ {
emit(requestDropSound(id)); emit(requestDropSound(id));
} }
qint64 StelMainScriptAPI::getSoundPosition(const QString& id)
{
return StelApp::getInstance().getStelAudioMgr()->position(id);
}
qint64 StelMainScriptAPI::getSoundDuration(const QString& id)
{
return StelApp::getInstance().getStelAudioMgr()->duration(id);
}
void StelMainScriptAPI::loadVideo(const QString& filename, const QString& i d, float x, float y, bool show, float alpha) void StelMainScriptAPI::loadVideo(const QString& filename, const QString& i d, float x, float y, bool show, float alpha)
{ {
QString path = StelFileMgr::findFile("scripts/" + filename); QString path = StelFileMgr::findFile("scripts/" + filename);
if (path.isEmpty()) if (path.isEmpty())
{ {
qWarning() << "cannot play video" << QDir::toNativeSeparator s(filename); qWarning() << "cannot play video" << QDir::toNativeSeparator s(filename);
return; return;
} }
emit(requestLoadVideo(path, id, x, y, show, alpha)); emit(requestLoadVideo(path, id, x, y, show, alpha));
} }
void StelMainScriptAPI::playVideo(const QString& id) void StelMainScriptAPI::playVideo(const QString& id, bool keepVisibleAtEnd)
{ {
emit(requestPlayVideo(id)); emit(requestPlayVideo(id, keepVisibleAtEnd));
}
void StelMainScriptAPI::playVideoPopout(const QString& id, float fromX, flo
at fromY, float atCenterX, float atCenterY, float finalSizeX, float finalSi
zeY, float popupDuration, bool frozenInTransition)
{
emit(requestPlayVideoPopout(id, fromX, fromY, atCenterX, atCenterY,
finalSizeX, finalSizeY, popupDuration, frozenInTransition));
} }
void StelMainScriptAPI::pauseVideo(const QString& id) void StelMainScriptAPI::pauseVideo(const QString& id)
{ {
emit(requestPauseVideo(id)); emit(requestPauseVideo(id));
} }
void StelMainScriptAPI::stopVideo(const QString& id) void StelMainScriptAPI::stopVideo(const QString& id)
{ {
emit(requestStopVideo(id)); emit(requestStopVideo(id));
} }
void StelMainScriptAPI::dropVideo(const QString& id) void StelMainScriptAPI::dropVideo(const QString& id)
{ {
emit(requestDropVideo(id)); emit(requestDropVideo(id));
} }
void StelMainScriptAPI::seekVideo(const QString& id, qint64 ms) void StelMainScriptAPI::seekVideo(const QString& id, qint64 ms, bool pause)
{ {
emit(requestSeekVideo(id, ms)); emit(requestSeekVideo(id, ms, pause));
} }
void StelMainScriptAPI::setVideoXY(const QString& id, float x, float y) void StelMainScriptAPI::setVideoXY(const QString& id, float x, float y, boo l relative)
{ {
emit(requestSetVideoXY(id, x, y)); emit(requestSetVideoXY(id, x, y, relative));
} }
void StelMainScriptAPI::setVideoAlpha(const QString& id, float alpha) void StelMainScriptAPI::setVideoAlpha(const QString& id, float alpha)
{ {
emit(requestSetVideoAlpha(id, alpha)); emit(requestSetVideoAlpha(id, alpha));
} }
void StelMainScriptAPI::resizeVideo(const QString& id, float w, float h) void StelMainScriptAPI::resizeVideo(const QString& id, float w, float h)
{ {
emit(requestResizeVideo(id, w, h)); emit(requestResizeVideo(id, w, h));
} }
void StelMainScriptAPI::showVideo(const QString& id, bool show) void StelMainScriptAPI::showVideo(const QString& id, bool show)
{ {
emit(requestShowVideo(id, show)); emit(requestShowVideo(id, show));
} }
qint64 StelMainScriptAPI::getVideoDuration(const QString& id)
{
return StelApp::getInstance().getStelVideoMgr()->getVideoDuration(id
);
}
qint64 StelMainScriptAPI::getVideoPosition(const QString& id)
{
return StelApp::getInstance().getStelVideoMgr()->getVideoPosition(id
);
}
int StelMainScriptAPI::getScreenWidth() int StelMainScriptAPI::getScreenWidth()
{ {
return StelMainView::getInstance().size().width(); return StelMainView::getInstance().size().width();
} }
int StelMainScriptAPI::getScreenHeight() int StelMainScriptAPI::getScreenHeight()
{ {
return StelMainView::getInstance().size().height(); return StelMainView::getInstance().size().height();
} }
skipping to change at line 678 skipping to change at line 715
void StelMainScriptAPI::output(const QString &s) void StelMainScriptAPI::output(const QString &s)
{ {
StelApp::getInstance().getScriptMgr().output(s); StelApp::getInstance().getScriptMgr().output(s);
} }
void StelMainScriptAPI::resetOutput(void) void StelMainScriptAPI::resetOutput(void)
{ {
StelApp::getInstance().getScriptMgr().resetOutput(); StelApp::getInstance().getScriptMgr().resetOutput();
} }
void StelMainScriptAPI::saveOutputAs(const QString &filename)
{
StelApp::getInstance().getScriptMgr().saveOutputAs(filename);
}
double StelMainScriptAPI::jdFromDateString(const QString& dt, const QString & spec) double StelMainScriptAPI::jdFromDateString(const QString& dt, const QString & spec)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
if (dt == "now") if (dt == "now")
return StelUtils::getJDFromSystem(); return StelUtils::getJDFromSystem();
bool ok; bool ok;
double jd; double jd;
if (spec=="local") if (spec=="local")
{ {
skipping to change at line 788 skipping to change at line 830
return map; return map;
} }
else else
{ {
map.insert("found", true); map.insert("found", true);
} }
Vec3d pos; Vec3d pos;
double ra, dec, alt, az, glong, glat; double ra, dec, alt, az, glong, glat;
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
bool useOldAzimuth = StelApp::getInstance().getFlagOldAzimuthUsage() ; bool useOldAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsage ();
// ra/dec // ra/dec
pos = obj->getEquinoxEquatorialPos(core); 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(core); pos = obj->getJ2000EquatorialPos(core);
StelUtils::rectToSphe(&ra, &dec, pos); StelUtils::rectToSphe(&ra, &dec, pos);
skipping to change at line 921 skipping to change at line 963
} }
else else
{ {
map.insert("found", true); map.insert("found", true);
} }
// OK, object found. Let's go. // OK, object found. Let's go.
Vec3d pos; Vec3d pos;
double ra, dec, alt, az, glong, glat; double ra, dec, alt, az, glong, glat;
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
bool useOldAzimuth = StelApp::getInstance().getFlagOldAzimuthUsage() ; bool useOldAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsage ();
// ra/dec // ra/dec
pos = obj->getEquinoxEquatorialPos(core); 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(core); pos = obj->getJ2000EquatorialPos(core);
StelUtils::rectToSphe(&ra, &dec, pos); StelUtils::rectToSphe(&ra, &dec, pos);
skipping to change at line 1056 skipping to change at line 1098
ssmgr->setFlagHints(false); ssmgr->setFlagHints(false);
ssmgr->setFlagOrbits(false); ssmgr->setFlagOrbits(false);
ssmgr->setFlagMoonScale(false); ssmgr->setFlagMoonScale(false);
ssmgr->setFlagTrails(false); ssmgr->setFlagTrails(false);
mmgr->setZHR(10); mmgr->setZHR(10);
glmgr->setFlagAzimuthalGrid(false); glmgr->setFlagAzimuthalGrid(false);
glmgr->setFlagGalacticGrid(false); glmgr->setFlagGalacticGrid(false);
glmgr->setFlagEquatorGrid(false); glmgr->setFlagEquatorGrid(false);
glmgr->setFlagEquatorLine(false); glmgr->setFlagEquatorLine(false);
glmgr->setFlagEclipticLine(false); glmgr->setFlagEclipticLine(false);
glmgr->setFlagEclipticJ2000Line(false);
glmgr->setFlagMeridianLine(false); glmgr->setFlagMeridianLine(false);
glmgr->setFlagLongitudeLine(false); glmgr->setFlagLongitudeLine(false);
glmgr->setFlagHorizonLine(false); glmgr->setFlagHorizonLine(false);
glmgr->setFlagColureLines(false);
glmgr->setFlagPrimeVerticalLine(false);
glmgr->setFlagGalacticEquatorLine(false); glmgr->setFlagGalacticEquatorLine(false);
glmgr->setFlagEquatorJ2000Grid(false); glmgr->setFlagEquatorJ2000Grid(false);
glmgr->setFlagEclipticGrid(false);
glmgr->setFlagEclipticJ2000Grid(false);
lmgr->setFlagCardinalsPoints(false); lmgr->setFlagCardinalsPoints(false);
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);
skipping to change at line 1246 skipping to change at line 1293
{ {
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
Q_ASSERT(mvmgr); Q_ASSERT(mvmgr);
GETSTELMODULE(StelObjectMgr)->unSelect(); GETSTELMODULE(StelObjectMgr)->unSelect();
Vec3d aim; Vec3d aim;
double dAlt = StelUtils::getDecAngle(alt); double dAlt = StelUtils::getDecAngle(alt);
double dAzi = M_PI - StelUtils::getDecAngle(azi); double dAzi = M_PI - StelUtils::getDecAngle(azi);
if (StelApp::getInstance().getFlagOldAzimuthUsage()) if (StelApp::getInstance().getFlagSouthAzimuthUsage())
dAzi -= M_PI; dAzi -= M_PI;
StelUtils::spheToRect(dAzi,dAlt,aim); StelUtils::spheToRect(dAzi,dAlt,aim);
mvmgr->moveToJ2000(StelApp::getInstance().getCore()->altAzToJ2000(ai
m, StelCore::RefractionOff), duration); // make up vector more stable:
StelMovementMgr::MountMode mountMode=mvmgr->getMountMode();
Vec3d aimUp;
if ( (mountMode==StelMovementMgr::MountAltAzimuthal) && (fabs(dAlt)>
(0.9*M_PI/2.0)) )
aimUp=Vec3d(-cos(dAzi), -sin(dAzi), 0.) * (dAlt>0. ? 1. : -1
.);
else
aimUp=Vec3d(0., 0., 1.);
mvmgr->moveToAltAzi(aim, aimUp, duration);
} }
void StelMainScriptAPI::moveToRaDec(const QString& ra, const QString& dec, float duration) void StelMainScriptAPI::moveToRaDec(const QString& ra, const QString& dec, float duration)
{ {
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
Q_ASSERT(mvmgr); Q_ASSERT(mvmgr);
StelCore* core = StelApp::getInstance().getCore();
GETSTELMODULE(StelObjectMgr)->unSelect(); GETSTELMODULE(StelObjectMgr)->unSelect();
Vec3d aim; Vec3d aim;
double dRa = StelUtils::getDecAngle(ra); double dRa = StelUtils::getDecAngle(ra);
double dDec = StelUtils::getDecAngle(dec); double dDec = StelUtils::getDecAngle(dec);
StelUtils::spheToRect(dRa,dDec,aim); StelUtils::spheToRect(dRa,dDec,aim);
mvmgr->moveToJ2000(StelApp::getInstance().getCore()->equinoxEquToJ20 // make up vector more stable:
00(aim), duration); StelMovementMgr::MountMode mountMode=mvmgr->getMountMode();
Vec3d aimUp;
if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(d
Dec)> (0.9*M_PI/2.0)) )
aimUp=core->equinoxEquToJ2000(Vec3d(-cos(dRa), -sin(dRa), 0.
) * (dDec>0. ? 1. : -1. ));
else
aimUp=core->equinoxEquToJ2000(Vec3d(0., 0., 1.));
mvmgr->moveToJ2000(StelApp::getInstance().getCore()->equinoxEquToJ20
00(aim), aimUp, 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; 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);
mvmgr->moveToJ2000(aimJ2000, duration); // make up vector more stable. Not sure if we have to set the up vec
tor in this case though.
StelMovementMgr::MountMode mountMode=mvmgr->getMountMode();
Vec3d aimUp;
if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(d
Dec)> (0.9*M_PI/2.0)) )
aimUp=Vec3d(-cos(dRa), -sin(dRa), 0.) * (dDec>0. ? 1. : -1.
);
else
aimUp=Vec3d(0., 0., 1.);
mvmgr->moveToJ2000(aimJ2000, aimUp, 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 1337 skipping to change at line 1410
void StelMainScriptAPI::setZodiacalLightIntensity(double i) void StelMainScriptAPI::setZodiacalLightIntensity(double i)
{ {
GETSTELMODULE(ZodiacalLight)->setIntensity(i); GETSTELMODULE(ZodiacalLight)->setIntensity(i);
} }
double StelMainScriptAPI::getZodiacalLightIntensity() double StelMainScriptAPI::getZodiacalLightIntensity()
{ {
return GETSTELMODULE(ZodiacalLight)->getIntensity(); return GETSTELMODULE(ZodiacalLight)->getIntensity();
} }
int StelMainScriptAPI::getBortleScaleIndex() const
{
return StelApp::getInstance().getCore()->getSkyDrawer()->getBortleSc
aleIndex();
}
void StelMainScriptAPI::setBortleScaleIndex(int index)
{
StelApp::getInstance().getCore()->getSkyDrawer()->setBortleScaleInde
x(index);
}
QVariantMap StelMainScriptAPI::getScreenXYFromAltAzi(const QString &alt, co
nst QString &azi)
{
Vec3d aim, v;
double dAlt = StelUtils::getDecAngle(alt);
double dAzi = M_PI - StelUtils::getDecAngle(azi);
if (StelApp::getInstance().getFlagSouthAzimuthUsage())
dAzi -= M_PI;
StelUtils::spheToRect(dAzi,dAlt,aim);
const StelProjectorP prj = StelApp::getInstance().getCore()->getProj
ection(StelCore::FrameAltAz, StelCore::RefractionOff);
prj->project(aim, v);
QVariantMap map;
map.insert("x", qRound(v[0]));
map.insert("y", prj->getViewportHeight()-qRound(v[1]));
return map;
}
 End of changes. 26 change blocks. 
28 lines changed or deleted 116 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/