Satellites.cpp   Satellites.cpp 
skipping to change at line 92 skipping to change at line 92
, updateState(CompleteNoUpdates) , updateState(CompleteNoUpdates)
, downloadMgr(NULL) , downloadMgr(NULL)
, progressBar(NULL) , progressBar(NULL)
, numberDownloadsComplete(0) , numberDownloadsComplete(0)
, updateTimer(0) , updateTimer(0)
, updatesEnabled(false) , updatesEnabled(false)
, autoAddEnabled(false) , autoAddEnabled(false)
, autoRemoveEnabled(false) , autoRemoveEnabled(false)
, updateFrequencyHours(0) , updateFrequencyHours(0)
, messageTimer(0) , messageTimer(0)
, iridiumFlaresPredictionDepth(7)
{ {
setObjectName("Satellites"); setObjectName("Satellites");
configDialog = new SatellitesDialog(); configDialog = new SatellitesDialog();
} }
void Satellites::deinit() void Satellites::deinit()
{ {
Satellite::hintTexture.clear(); Satellite::hintTexture.clear();
texPointer.clear(); texPointer.clear();
} }
skipping to change at line 612 skipping to change at line 613
// updater related settings... // updater related settings...
updateFrequencyHours = conf->value("update_frequency_hours", 72).toI nt(); updateFrequencyHours = conf->value("update_frequency_hours", 72).toI nt();
// last update default is the first Towell Day. <3 DA // last update default is the first Towell Day. <3 DA
lastUpdate = QDateTime::fromString(conf->value("last_update", "2001- 05-25T12:00:00").toString(), Qt::ISODate); lastUpdate = QDateTime::fromString(conf->value("last_update", "2001- 05-25T12:00:00").toString(), Qt::ISODate);
setFlagHints(conf->value("show_satellite_hints", true).toBool()); setFlagHints(conf->value("show_satellite_hints", true).toBool());
Satellite::showLabels = conf->value("show_satellite_labels", false). toBool(); Satellite::showLabels = conf->value("show_satellite_labels", false). toBool();
updatesEnabled = conf->value("updates_enabled", true).toBool(); updatesEnabled = conf->value("updates_enabled", true).toBool();
autoAddEnabled = conf->value("auto_add_enabled", true).toBool(); autoAddEnabled = conf->value("auto_add_enabled", true).toBool();
autoRemoveEnabled = conf->value("auto_remove_enabled", true).toBool( ); autoRemoveEnabled = conf->value("auto_remove_enabled", true).toBool( );
iridiumFlaresPredictionDepth = conf->value("flares_prediction_depth" , 7).toInt();
// Get a font for labels // Get a font for labels
labelFont.setPixelSize(conf->value("hint_font_size", 10).toInt()); labelFont.setPixelSize(conf->value("hint_font_size", 10).toInt());
// orbit drawing params // orbit drawing params
Satellite::orbitLinesFlag = conf->value("orbit_line_flag", false).to Bool(); Satellite::orbitLinesFlag = conf->value("orbit_line_flag", false).to Bool();
Satellite::orbitLineSegments = conf->value("orbit_line_segments", 90 ).toInt(); Satellite::orbitLineSegments = conf->value("orbit_line_segments", 90 ).toInt();
Satellite::orbitLineFadeSegments = conf->value("orbit_fade_segments" , 5).toInt(); Satellite::orbitLineFadeSegments = conf->value("orbit_fade_segments" , 5).toInt();
Satellite::orbitLineSegmentDuration = conf->value("orbit_segment_dur ation", 20).toInt(); Satellite::orbitLineSegmentDuration = conf->value("orbit_segment_dur ation", 20).toInt();
skipping to change at line 642 skipping to change at line 644
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
conf->beginGroup("Satellites"); conf->beginGroup("Satellites");
// updater related settings... // updater related settings...
conf->setValue("update_frequency_hours", updateFrequencyHours); conf->setValue("update_frequency_hours", updateFrequencyHours);
conf->setValue("show_satellite_hints", getFlagHints()); conf->setValue("show_satellite_hints", getFlagHints());
conf->setValue("show_satellite_labels", Satellite::showLabels); conf->setValue("show_satellite_labels", Satellite::showLabels);
conf->setValue("updates_enabled", updatesEnabled ); conf->setValue("updates_enabled", updatesEnabled );
conf->setValue("auto_add_enabled", autoAddEnabled); conf->setValue("auto_add_enabled", autoAddEnabled);
conf->setValue("auto_remove_enabled", autoRemoveEnabled); conf->setValue("auto_remove_enabled", autoRemoveEnabled);
conf->setValue("flares_prediction_depth", iridiumFlaresPredictionDep th);
// Get a font for labels // Get a font for labels
conf->setValue("hint_font_size", labelFont.pixelSize()); conf->setValue("hint_font_size", labelFont.pixelSize());
// orbit drawing params // orbit drawing params
conf->setValue("orbit_line_flag", Satellite::orbitLinesFlag); conf->setValue("orbit_line_flag", Satellite::orbitLinesFlag);
conf->setValue("orbit_line_segments", Satellite::orbitLineSegments); conf->setValue("orbit_line_segments", Satellite::orbitLineSegments);
conf->setValue("orbit_fade_segments", Satellite::orbitLineFadeSegmen ts); conf->setValue("orbit_fade_segments", Satellite::orbitLineFadeSegmen ts);
conf->setValue("orbit_segment_duration", Satellite::orbitLineSegment Duration); conf->setValue("orbit_segment_duration", Satellite::orbitLineSegment Duration);
skipping to change at line 1114 skipping to change at line 1117
if (updateFrequencyHours != hours) if (updateFrequencyHours != hours)
{ {
updateFrequencyHours = hours; updateFrequencyHours = hours;
emit settingsChanged(); emit settingsChanged();
} }
} }
void Satellites::checkForUpdate(void) void Satellites::checkForUpdate(void)
{ {
if (updatesEnabled && updateState != Updating if (updatesEnabled && updateState != Updating
&& lastUpdate.addSecs(updateFrequencyHours * 3600) <= QDateTime: && lastUpdate.addSecs(updateFrequencyHours * 3600) <= QDateTime:
:currentDateTime()) :currentDateTime()
&& downloadMgr->networkAccessible()==QNetworkAccessManager::Acce
ssible)
updateFromOnlineSources(); updateFromOnlineSources();
} }
void Satellites::updateFromOnlineSources() void Satellites::updateFromOnlineSources()
{ {
if (updateState==Satellites::Updating) if (updateState==Satellites::Updating)
{ {
qWarning() << "[Satellites] Internet update already in progr ess!"; qWarning() << "[Satellites] Internet update already in progr ess!";
return; return;
} }
skipping to change at line 1604 skipping to change at line 1608
} }
void Satellites::draw(StelCore* core) void Satellites::draw(StelCore* core)
{ {
// Separated because first test should be very fast. // Separated because first test should be very fast.
if (!hintFader && hintFader.getInterstate() <= 0.) if (!hintFader && hintFader.getInterstate() <= 0.)
return; return;
if (core->getCurrentLocation().planetName != earth->getEnglishName() || !isValidRangeDates()) if (core->getCurrentLocation().planetName != earth->getEnglishName() || !isValidRangeDates())
return; return;
StelProjectorP prj = core->getProjection(StelCore::FrameAltAz); StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelC ore::RefractionAuto);
StelPainter painter(prj); StelPainter painter(prj);
painter.setFont(labelFont); painter.setFont(labelFont);
Satellite::hintBrightness = hintFader.getInterstate(); Satellite::hintBrightness = hintFader.getInterstate();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); painter.setBlending(true);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
Satellite::hintTexture->bind(); Satellite::hintTexture->bind();
Satellite::viewportHalfspace = painter.getProjector()->getBoundingCa p(); Satellite::viewportHalfspace = painter.getProjector()->getBoundingCa p();
foreach (const SatelliteP& sat, satellites) foreach (const SatelliteP& sat, satellites)
{ {
if (sat && sat->initialized && sat->displayed) if (sat && sat->initialized && sat->displayed)
sat->draw(core, painter, 1.0); sat->draw(core, painter, 1.0);
} }
if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer()) if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer())
drawPointer(core, painter); drawPointer(core, painter);
skipping to change at line 1641 skipping to change at line 1643
const StelObjectP obj = newSelected[0]; const StelObjectP obj = newSelected[0];
Vec3d pos=obj->getJ2000EquatorialPos(core); Vec3d pos=obj->getJ2000EquatorialPos(core);
Vec3d screenpos; Vec3d screenpos;
// Compute 2D pos and return if outside screen // Compute 2D pos and return if outside screen
if (!prj->project(pos, screenpos)) if (!prj->project(pos, screenpos))
return; return;
painter.setColor(0.4f,0.5f,0.8f); painter.setColor(0.4f,0.5f,0.8f);
texPointer->bind(); texPointer->bind();
glEnable(GL_TEXTURE_2D); painter.setBlending(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal
transparency mode
// Size on screen // Size on screen
float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter(); float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter();
size += 12.f + 3.f*std::sin(2.f * StelApp::getInstance().get TotalRunTime()); size += 12.f + 3.f*std::sin(2.f * StelApp::getInstance().get TotalRunTime());
// size+=20.f + 10.f*std::sin(2.f * StelApp::getInstance().g etTotalRunTime()); // size+=20.f + 10.f*std::sin(2.f * StelApp::getInstance().g etTotalRunTime());
painter.drawSprite2dMode(screenpos[0]-size/2, screenpos[1]-s ize/2, 20, 90); painter.drawSprite2dMode(screenpos[0]-size/2, screenpos[1]-s ize/2, 20, 90);
painter.drawSprite2dMode(screenpos[0]-size/2, screenpos[1]+s ize/2, 20, 0); painter.drawSprite2dMode(screenpos[0]-size/2, screenpos[1]+s ize/2, 20, 0);
painter.drawSprite2dMode(screenpos[0]+size/2, screenpos[1]+s ize/2, 20, -90); painter.drawSprite2dMode(screenpos[0]+size/2, screenpos[1]+s ize/2, 20, -90);
painter.drawSprite2dMode(screenpos[0]+size/2, screenpos[1]-s ize/2, 20, -180); painter.drawSprite2dMode(screenpos[0]+size/2, screenpos[1]-s ize/2, 20, -180);
} }
skipping to change at line 1697 skipping to change at line 1697
if (lastUpdate.isNull()) // No updates yet? if (lastUpdate.isNull()) // No updates yet?
uJD = tJD; uJD = tJD;
// do not draw anything before Oct 4, 1957, 19:28:34GMT ;-) // do not draw anything before Oct 4, 1957, 19:28:34GMT ;-)
// upper limit for drawing is +5 years after latest update of TLE // upper limit for drawing is +5 years after latest update of TLE
if ((tJD<2436116.3115) || (tJD>(uJD+1825))) if ((tJD<2436116.3115) || (tJD>(uJD+1825)))
return false; return false;
else else
return true; return true;
} }
#ifdef _OLD_IRIDIUM_PREDICTIONS
IridiumFlaresPredictionList Satellites::getIridiumFlaresPrediction() IridiumFlaresPredictionList Satellites::getIridiumFlaresPrediction()
{ {
StelCore* pcore = StelApp::getInstance().getCore(); StelCore* pcore = StelApp::getInstance().getCore();
double currentJD = pcore->getJD(); // save current JD double currentJD = pcore->getJD(); // save current JD
bool isTimeNow = pcore->getIsTimeNow(); bool isTimeNow = pcore->getIsTimeNow();
long iJD =currentJD; long iJD =currentJD;
double JDMidnight = iJD + 0.5 - pcore->getCurrentLocation().longitud e / 360.f; double JDMidnight = iJD + 0.5 - pcore->getCurrentLocation().longitud e / 360.f;
double delta = currentJD - JDMidnight; double delta = currentJD - JDMidnight;
pcore->setJD(iJD + 0.5 - pcore->getCurrentLocation().longitude / 360 .f); pcore->setJD(iJD + 0.5 - pcore->getCurrentLocation().longitude / 360 .f);
skipping to change at line 1767 skipping to change at line 1768
} }
} }
Satellite::timeShift = 0.; Satellite::timeShift = 0.;
if (isTimeNow) if (isTimeNow)
pcore->setTimeNow(); pcore->setTimeNow();
else else
pcore->setJD(currentJD); pcore->setJD(currentJD);
return predictions; return predictions;
} }
#else
struct SatDataStruct {
double nextJD;
double angleToSun;
double altitude;
double azimuth;
double v;
};
IridiumFlaresPredictionList Satellites::getIridiumFlaresPrediction()
{
StelCore* pcore = StelApp::getInstance().getCore();
SolarSystem* ssystem = (SolarSystem*)StelApp::getInstance().getModul
eMgr().getModule("SolarSystem");
double currentJD = pcore->getJD(); // save current JD
bool isTimeNow = pcore->getIsTimeNow();
double predictionJD = currentJD - 1.; // investigate what's seen r
ecently// yesterday
double predictionEndJD = currentJD + getIridiumFlaresPredictionDepth
(); // 7 days interval by default
pcore->setJD(predictionJD);
bool useSouthAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsa
ge();
IridiumFlaresPredictionList predictions;
// create a lіst of Iridiums
QMap<SatelliteP,SatDataStruct> iridiums;
SatDataStruct sds;
double nextJD = predictionJD + 1./24;
foreach(const SatelliteP& sat, satellites)
{
if (sat->initialized && sat.data()->getEnglishName().startsW
ith("IRIDIUM"))
{
Vec3d pos = sat.data()->getAltAzPosApparent(pcore);
sds.angleToSun = sat.data()->sunReflAngle;
sds.altitude = pos.latitude();
sds.azimuth = pos.longitude();
sds.v = sat.data()->getVMagnitude(pcore);
double t;
if (sds.altitude<0)
t = qMax(-sds.altitude, 1.) / 2880;
else
if (sds.angleToSun>0)
t = qMax(sds.angleToSun, 1.) / (2*86400);
else
{
//qDebug() << "IRIDIUM warn: alt, angleToSun
= " <<sds.altitude << sds.angleToSun;
t = 0.25/1440; // we should never be here, b
ut assuming 1/4 minute to leave this
}
sds.nextJD = predictionJD + t;
iridiums.insert(sat, sds);
//qDebug() << sat.data()->getEnglishName() << ": "
// << sds.altitude
// << sds.azimuth
// << sds.angleToSun
// << sds.v
// << StelUtils::julianDayToISO8601Str
ing(predictionJD+StelApp::getInstance().getCore()->getUTCOffset(predictionJ
D)/24.f)
// ;
if (nextJD>sds.nextJD)
nextJD = sds.nextJD;
}
}
predictionJD = nextJD;
while (predictionJD<predictionEndJD)
{
nextJD = predictionJD + 1./24;
pcore->setJD(predictionJD);
ssystem->getEarth().data()->computePosition(predictionJD);
pcore->update(0);
QMap<SatelliteP,SatDataStruct>::iterator i = iridiums.begin(
);
while (i != iridiums.end())
{
if ( i.value().nextJD<=predictionJD)
{
i.key().data()->update(0);
double v = i.key().data()->getVMagnitude(pco
re);
bool flareFound = false;
if (v > i.value().v)
{
if (i.value().v < 1. // brighness li
mit
&& i.value().angleToSun>0.
&& i.value().angleToSun<2.)
{
IridiumFlaresPrediction flar
e;
flare.datetime = StelUtils::
julianDayToISO8601String(predictionJD+StelApp::getInstance().getCore()->get
UTCOffset(predictionJD)/24.f);
flare.satellite = i.key().da
ta()->getEnglishName();
flare.azimuth = i.value().
azimuth;
if (useSouthAzimuth)
{
flare.azimuth += M_P
I;
if (flare.azimuth >
M_PI*2)
flare.azimut
h -= M_PI*2;
}
flare.altitude = i.value().
altitude;
flare.magnitude = i.value().
v;
predictions.append(flare);
flareFound = true;
//qDebug() << "Flare:" << fl
are.datetime << flare.satellite;
}
}
/* qDebug() << QString::asprintf("%20s alt:%6.
1f az:%6.1f sun:%6.1f v:%6.1f",
i.key().data()->getEnglishName().toStdString(),
i.value().altitude*180/M_PI,
i.value().azimuth*180/M_PI,
i.value().angleToSun,
v
)
<< StelUtils::julianDayToI
SO8601String(predictionJD+StelApp::getInstance().getCore()->getUTCOffset(pr
edictionJD)/24.f)
;
*/
Vec3d pos = i.key().data()->getAltAzPosAppar
ent(pcore);
i.value().v = flareFound ? 17 : v; // block
extra report
i.value().altitude = pos.latitude();
i.value().azimuth = M_PI - pos.longitude();
i.value().angleToSun = i.key().data()->sunRe
flAngle;
double t;
if (flareFound)
t = 1./24;
else
if (i.value().altitude<0)
t = qMax((-i.value().altitude)*57,1.
) / 5600;
else
if (i.value().angleToSun>0)
t = qMax(i.value().angleToSun,1.) /
(4*86400);
else
{
//qDebug() << "IRIDIUM warn2: alt, a
ngleToSun = " <<i.value().altitude << i.value().angleToSun;
t = 0.25/1440; // we should never be
here, but assuming 1/4 minute to leave this
}
i.value().nextJD = predictionJD + t;
if (nextJD>i.value().nextJD)
nextJD = i.value().nextJD;
}
++i;
}
predictionJD = nextJD;
}
Satellite::timeShift = 0.;
if (isTimeNow)
pcore->setTimeNow();
else
pcore->setJD(currentJD);
return predictions;
}
#endif
void Satellites::translations() void Satellites::translations()
{ {
#if 0 #if 0
// Satellite groups // Satellite groups
// TRANSLATORS: Satellite group: Bright/naked-eye-visible satellites // TRANSLATORS: Satellite group: Bright/naked-eye-visible satellites
N_("visual"); N_("visual");
// TRANSLATORS: Satellite group: Scientific satellites // TRANSLATORS: Satellite group: Scientific satellites
N_("scientific"); N_("scientific");
// TRANSLATORS: Satellite group: Communication satellites // TRANSLATORS: Satellite group: Communication satellites
 End of changes. 9 change blocks. 
10 lines changed or deleted 211 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/