Satellite.cpp   Satellite.cpp 
skipping to change at line 136 skipping to change at line 136
{ {
if (!groupIDs.contains(group.toString())) if (!groupIDs.contains(group.toString()))
groupIDs << group.toString(); groupIDs << group.toString();
} }
} }
QString line1 = map.value("tle1").toString(); QString line1 = map.value("tle1").toString();
QString line2 = map.value("tle2").toString(); QString line2 = map.value("tle2").toString();
setNewTleElements(line1, line2); setNewTleElements(line1, line2);
internationalDesignator = extractInternationalDesignator(line1); internationalDesignator = extractInternationalDesignator(line1);
StelUtils::getJDFromDate(&jdLaunchYearJan1, extractLaunchYear(line1) , 1, 1, 0, 0, 0);
if (map.contains("lastUpdated")) if (map.contains("lastUpdated"))
{ {
lastUpdated = QDateTime::fromString(map.value("lastUpdated") .toString(), lastUpdated = QDateTime::fromString(map.value("lastUpdated") .toString(),
Qt::ISODate); Qt::ISODate);
} }
orbitValid = true; orbitValid = true;
initialized = true; initialized = true;
update(0.); update(0.);
skipping to change at line 454 skipping to change at line 455
// Y2K bug :) I wonder what NORAD will do in 2057. :) // Y2K bug :) I wonder what NORAD will do in 2057. :)
if (year < 57) if (year < 57)
year += 2000; year += 2000;
else else
year += 1900; year += 1900;
result = QString::number(year) + "-" + rawString.right(4); result = QString::number(year) + "-" + rawString.right(4);
return result; return result;
} }
int Satellite::extractLaunchYear(const QString& tle1)
{
if (tle1.isEmpty())
return 1957;
// The designator is encoded as the 3rd group on the first line
QString rawString = tle1.split(' ').at(2);
if (rawString.isEmpty())
return 1957;
//TODO: Use a regular expression?
bool ok;
int year = rawString.left(2).toInt(&ok);
if (!ok)
return 1957;
// Y2K bug :) I wonder what NORAD will do in 2057. :)
if (year < 57)
return year + 2000;
else
return year + 1900;
}
void Satellite::draw(const StelCore* core, StelPainter& painter, float) void Satellite::draw(const StelCore* core, StelPainter& painter, float)
{ {
if (core->getJDay() < jdLaunchYearJan1) return;
XYZ = getJ2000EquatorialPos(core); XYZ = getJ2000EquatorialPos(core);
Vec3f drawColor; Vec3f drawColor;
(visibility==RADAR_NIGHT) ? drawColor = Vec3f(0.2f,0.2f,0.2f) : draw Color = hintColor; (visibility==RADAR_NIGHT) ? drawColor = Vec3f(0.2f,0.2f,0.2f) : draw Color = hintColor;
StelApp::getInstance().getVisionModeNight() ? glColor4f(0.6,0.0,0.0, 1.0) : glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBri ghtness); StelApp::getInstance().getVisionModeNight() ? glColor4f(0.6,0.0,0.0, 1.0) : glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBri ghtness);
StelProjectorP prj = core->getProjection(StelCore::FrameJ2000); StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
Vec3d xy; Vec3d xy;
if (prj->project(XYZ,xy)) if (prj->project(XYZ,xy))
{ {
 End of changes. 3 change blocks. 
0 lines changed or deleted 26 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/