Satellites.cpp   Satellites.cpp 
/* /*
* Copyright (C) 2009, 2012 Matthew Gates * Copyright (C) 2009, 2012 Matthew Gates
* Copyright (C) 2015 Nick Fedoseev (Iridium flares)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 516 skipping to change at line 517
// delete all existing Satellite settings... // delete all existing Satellite settings...
conf->remove(""); conf->remove("");
conf->setValue("show_satellite_hints", true); conf->setValue("show_satellite_hints", true);
conf->setValue("show_satellite_labels", false); conf->setValue("show_satellite_labels", false);
conf->setValue("updates_enabled", true); conf->setValue("updates_enabled", true);
conf->setValue("auto_add_enabled", true); conf->setValue("auto_add_enabled", true);
conf->setValue("auto_remove_enabled", true); conf->setValue("auto_remove_enabled", true);
conf->setValue("hint_color", "0.0,0.4,0.6"); conf->setValue("hint_color", "0.0,0.4,0.6");
conf->setValue("invisible_satellite_color", "0.2,0.2,0.2");
conf->setValue("hint_font_size", 10); conf->setValue("hint_font_size", 10);
conf->setValue("update_frequency_hours", 72); conf->setValue("update_frequency_hours", 72);
conf->setValue("orbit_line_flag", false); conf->setValue("orbit_line_flag", false);
conf->setValue("orbit_line_segments", 90); conf->setValue("orbit_line_segments", 90);
conf->setValue("orbit_fade_segments", 5); conf->setValue("orbit_fade_segments", 5);
conf->setValue("orbit_segment_duration", 20); conf->setValue("orbit_segment_duration", 20);
conf->setValue("realistic_mode_enabled", true); conf->setValue("realistic_mode_enabled", true);
conf->endGroup(); // saveTleSources() opens it for itself conf->endGroup(); // saveTleSources() opens it for itself
skipping to change at line 682 skipping to change at line 684
// 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();
Satellite::invisibleSatelliteColor = StelUtils::strToVec3f(conf->val
ue("invisible_satellite_color", "0.2,0.2,0.2").toString());
// realistic mode // realistic mode
setFlagRelisticMode(conf->value("realistic_mode_enabled", true).toBo ol()); setFlagRelisticMode(conf->value("realistic_mode_enabled", true).toBo ol());
conf->endGroup(); conf->endGroup();
} }
void Satellites::saveSettings() void Satellites::saveSettings()
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
conf->beginGroup("Satellites"); conf->beginGroup("Satellites");
skipping to change at line 1693 skipping to change at line 1697
return false; return false;
} }
return true; return true;
} }
bool Satellites::isValidRangeDates() const bool Satellites::isValidRangeDates() const
{ {
bool ok; bool ok;
double tJD = StelApp::getInstance().getCore()->getJDay(); double tJD = StelApp::getInstance().getCore()->getJD();
double uJD = StelUtils::getJulianDayFromISO8601String(lastUpdate.toS tring(Qt::ISODate), &ok); double uJD = StelUtils::getJulianDayFromISO8601String(lastUpdate.toS tring(Qt::ISODate), &ok);
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;
} }
IridiumFlaresPredictionList Satellites::getIridiumFlaresPrediction()
{
StelCore* pcore = StelApp::getInstance().getCore();
double currentJD = pcore->getJD(); // save current JD
bool isTimeNow = pcore->getIsTimeNow();
long iJD =currentJD;
double JDMidnight = iJD + 0.5 - pcore->getCurrentLocation().longitud
e / 360.f;
double delta = currentJD - JDMidnight;
pcore->setJD(iJD + 0.5 - pcore->getCurrentLocation().longitude / 360
.f);
pcore->update(10); // force update to get new coordinates
IridiumFlaresPredictionList predictions;
predictions.clear();
foreach(const SatelliteP& sat, satellites)
{
if (sat->initialized && sat.data()->getEnglishName().startsW
ith("IRIDIUM"))
{
double dt = 0;
double angle0 = 100;
double lat0 = -1;
while (dt<1)
{
Satellite::timeShift = dt+delta;
sat.data()->update(0);
Vec3d pos = sat.data()->getAltAzPosApparent(
pcore);
double lat = pos.latitude();
double lon = M_PI - pos.longitude();
double v = sat.data()->getVMagnitude(pcore
);
double angle = sat.data()->sunReflAngle;
if (angle>0 && angle<2)
{
if (angle>angle0 && (v<1) && lat>5*M
_PI/180)
{
IridiumFlaresPrediction flar
e;
flare.datetime = StelUtils::
julianDayToISO8601String(currentJD+dt+StelUtils::getGMTShiftFromQT(currentJ
D+dt)/24.f);
flare.satellite = sat.data()
->getEnglishName();
flare.azimuth = lon;
flare.altitude = lat;
flare.magnitude = v;
predictions.append(flare);
dt +=0.005;
}
angle0 = angle;
}
if (angle>0)
dt+=0.000002*angle*angle;
else
{
if (lat0>0 && lat<0)
dt+=0.05;
else
dt+=0.0002;
}
lat0 = lat;
}
}
}
Satellite::timeShift = 0.;
if (isTimeNow)
pcore->setTimeNow();
else
pcore->setJD(currentJD);
return predictions;
}
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
N_("communications"); N_("communications");
 End of changes. 5 change blocks. 
1 lines changed or deleted 87 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/