Satellite.cpp   Satellite.cpp 
skipping to change at line 174 skipping to change at line 174
orbitValid = true; orbitValid = true;
initialized = true; initialized = true;
update(0.); update(0.);
} }
Satellite::~Satellite() Satellite::~Satellite()
{ {
if (pSatWrapper != NULL) if (pSatWrapper != NULL)
{ {
delete pSatWrapper; delete pSatWrapper;
pSatWrapper = NULL; pSatWrapper = NULL;
} }
} }
// TODO: REMOVE THIS FUNCTION! It is used for string formatting only.
double Satellite::roundToDp(float n, int dp) double Satellite::roundToDp(float n, int dp)
{ {
// round n to dp decimal places // round n to dp decimal places
return floor(n * pow(10., dp) + .5) / pow(10., dp); return floor(n * pow(10., dp) + .5) / pow(10., dp);
} }
QString Satellite::getNameI18n() const QString Satellite::getNameI18n() const
{ {
return q_(name); return q_(name);
} }
skipping to change at line 281 skipping to change at line 281
oss << catalogNumbers << "<br/><br/>"; oss << catalogNumbers << "<br/><br/>";
} }
if (flags & ObjectType) if (flags & ObjectType)
{ {
oss << q_("Type: <b>%1</b>").arg(q_("artificial satellite")) << "<br/>"; oss << q_("Type: <b>%1</b>").arg(q_("artificial satellite")) << "<br/>";
} }
if ((flags & Magnitude) && (stdMag!=99.f)) if ((flags & Magnitude) && (stdMag!=99.f))
{ {
oss << q_("Approx. magnitude: <b>%1</b>").arg(QString::numbe float mag = getVMagnitude(core);
r(getVMagnitude(core), 'f', 2)) << "<br/>"; if (core->getSkyDrawer()->getFlagHasAtmosphere())
oss << q_("Approx. magnitude: <b>%1</b> (extincted t
o: <b>%2</b>)").arg(QString::number(mag, 'f', 2),
QString::number(getVMagnitudeWithExtinction(core), 'f',
2)) << "<br>";
else
oss << q_("Approx. magnitude: <b>%1</b>").arg(QStrin
g::number(mag, 'f', 2)) << "<br/>";
#ifdef IRIDIUM_SAT_TEXT_DEBUG #ifdef IRIDIUM_SAT_TEXT_DEBUG
oss << myText << "<br/>"; oss << myText << "<br/>";
#endif #endif
} }
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags & Extra) if (flags & Extra)
{ {
skipping to change at line 391 skipping to change at line 397
.arg(ddop, 6, 'f', 3); .arg(ddop, 6, 'f', 3);
oss << "<br/>"; oss << "<br/>";
} }
} }
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
QVariantMap Satellite::getInfoMap(const StelCore *core) const
{
QVariantMap map = StelObject::getInfoMap(core);
map.insert("description", QString(description).replace("\n", " - "))
;
map.insert("catalog", id);
if (!internationalDesignator.isEmpty())
map.insert("international-designator", internationalDesignat
or);
if (stdMag==99.f) // replace whatever has been computed
{
map.insert("vmag", "?");
map.insert("vmage", "?");
}
map.insert("range", range);
map.insert("rangerate", rangeRate);
map.insert("height", height);
map.insert("subpoint-lat", latLongSubPointPosition[0]);
map.insert("subpoint-long", latLongSubPointPosition[1]);
map.insert("TEME-km-X", position[0]);
map.insert("TEME-km-Y", position[1]);
map.insert("TEME-km-Z", position[2]);
map.insert("TEME-speed-X", velocity[0]);
map.insert("TEME-speed-Y", velocity[1]);
map.insert("TEME-speed-Z", velocity[2]);
if (sunReflAngle>0)
{ // Iridium
map.insert("sun-reflection-angle", sunReflAngle);
}
map.insert("operational-status", getOperationalStatus());
//TODO: Move to a more prominent place.
QString visibilityState;
switch (visibility)
{
case RADAR_SUN:
visibilityState = "The satellite and the observer ar
e in sunlight.";
break;
case VISIBLE:
visibilityState = "The satellite is visible.";
break;
case RADAR_NIGHT:
visibilityState = "The satellite is eclipsed.";
break;
case NOT_VISIBLE:
visibilityState = "The satellite is not visible";
break;
default:
break;
}
map.insert("visibility", visibilityState);
if (comms.size() > 0)
{
foreach(const CommLink &c, comms)
{
double dop = getDoppler(c.frequency);
double ddop = dop;
char sign;
if (dop<0.)
{
sign='-';
ddop*=-1;
}
else
sign='+';
QString commModDesc;
if (!c.modulation.isEmpty() && c.modulation != "") c
ommModDesc=c.modulation;
if ((!c.modulation.isEmpty() && c.modulation != "")
|| (!c.description.isEmpty() && c.description != "")) commModDesc.append("
");
if (!c.description.isEmpty() && c.description != "")
commModDesc.append(c.description);
if ((!c.modulation.isEmpty() && c.modulation != "")
|| (!c.description.isEmpty() && c.description != "")) commModDesc.append(":
");
map.insertMulti("comm", QString("%1%2 MHz (%3%4 kHz)
")
.arg(commModDesc)
.arg(c.frequency, 8, 'f', 5)
.arg(sign)
.arg(ddop, 6, 'f', 3));
}
}
return map;
}
Vec3d Satellite::getJ2000EquatorialPos(const StelCore* core) const Vec3d Satellite::getJ2000EquatorialPos(const StelCore* core) const
{ {
return core->altAzToJ2000(elAzPosition);; // Bugfix LP:1654331. I assume the elAzPosition has been computed wi
thout refraction! We must say this definitely.
return core->altAzToJ2000(elAzPosition, StelCore::RefractionOff);
} }
Vec3f Satellite::getInfoColor(void) const Vec3f Satellite::getInfoColor(void) const
{ {
return hintColor; return hintColor;
} }
float Satellite::getVMagnitude(const StelCore* core) const float Satellite::getVMagnitude(const StelCore* core) const
{ {
Q_UNUSED(core); Q_UNUSED(core);
skipping to change at line 588 skipping to change at line 678
vmag = vmag - 15.75 + 2.5 * std::log10(range * range / fracil); vmag = vmag - 15.75 + 2.5 * std::log10(range * range / fracil);
} }
} }
return vmag; return vmag;
} }
// Calculate illumination fraction of artifical satellite // Calculate illumination fraction of artifical satellite
float Satellite::calculateIlluminatedFraction() const float Satellite::calculateIlluminatedFraction() const
{ {
return (1 + cos(phaseAngle))/2; return (1.f + cos(phaseAngle))*0.5f;
} }
QString Satellite::getOperationalStatus() const QString Satellite::getOperationalStatus() const
{ {
QString statusStr = qc_("unknown", "operational status"); QString statusStr = qc_("unknown", "operational status");
switch (status) switch (status)
{ {
case StatusOperational: case StatusOperational:
statusStr = qc_("operational", "operational status") ; statusStr = qc_("operational", "operational status") ;
break; break;
skipping to change at line 662 skipping to change at line 752
{ {
if (pSatWrapper && orbitValid) if (pSatWrapper && orbitValid)
{ {
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
epochTime = core->getJD() + timeShift; // We have "true" JD from core, satellites don't need JDE! epochTime = core->getJD() + timeShift; // We have "true" JD from core, satellites don't need JDE!
pSatWrapper->setEpoch(epochTime); pSatWrapper->setEpoch(epochTime);
position = pSatWrapper->getTEMEPos(); position = pSatWrapper->getTEMEPos();
velocity = pSatWrapper->getTEMEVel(); velocity = pSatWrapper->getTEMEVel();
latLongSubPointPosition = pSatWrapper->getSubPoint(); latLongSubPointPosition = pSatWrapper->getSubPoint();
height = latLongSubPointPosition[2]; height = latLongSubPointPosition[2]; // km
if (height <= 0.0) if (height <= 50.0)
{ {
// The orbit is no longer valid. Causes include ver y out of date // The orbit is no longer valid. Causes include ver y out of date
// TLE, system date and time out of a reasonable ran ge, and orbital // TLE, system date and time out of a reasonable ran ge, and orbital
// degradation and re-entry of a satellite. In any of these cases // degradation and re-entry of a satellite. In any of these cases
// we might end up with a problem - usually a crash of Stellarium // we might end up with a problem - usually a crash of Stellarium
// because of a div/0 or something. To prevent this , we turn off // because of a div/0 or something. To prevent this , we turn off
// the satellite. // the satellite when the computed height is 50km. ( We can assume bogus at 250km or so...)
qWarning() << "Satellite has invalid orbit:" << name << id; qWarning() << "Satellite has invalid orbit:" << name << id;
orbitValid = false; orbitValid = false;
displayed = false; // He shouldn't be displayed! displayed = false; // It shouldn't be displayed!
return; return;
} }
elAzPosition = pSatWrapper->getAltAz(); elAzPosition = pSatWrapper->getAltAz();
elAzPosition.normalize(); elAzPosition.normalize();
pSatWrapper->getSlantRange(range, rangeRate); pSatWrapper->getSlantRange(range, rangeRate);
visibility = pSatWrapper->getVisibilityPredict(); visibility = pSatWrapper->getVisibilityPredict();
phaseAngle = pSatWrapper->getPhaseAngle(); phaseAngle = pSatWrapper->getPhaseAngle();
// Compute orbit points to draw orbit line. // Compute orbit points to draw orbit line.
if (orbitDisplayed) computeOrbitPoints(); if (orbitDisplayed) computeOrbitPoints();
} }
} }
skipping to change at line 782 skipping to change at line 872
if (core->getJD()<jdLaunchYearJan1 || !displayed) if (core->getJD()<jdLaunchYearJan1 || !displayed)
return; return;
XYZ = getJ2000EquatorialPos(core); XYZ = getJ2000EquatorialPos(core);
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f drawColor = invisibleSatelliteColor; Vec3f drawColor = invisibleSatelliteColor;
if (visibility == VISIBLE) // Use hintColor for visible satellites o nly if (visibility == VISIBLE) // Use hintColor for visible satellites o nly
drawColor = hintColor; drawColor = hintColor;
painter.setColor(drawColor[0], drawColor[1], drawColor[2], hintBrigh tness); painter.setColor(drawColor[0], drawColor[1], drawColor[2], hintBrigh tness);
StelProjectorP prj = core->getProjection(StelCore::FrameJ2000); StelProjectorP prj = core->getProjection(StelCore::FrameJ2000, StelC ore::RefractionAuto);
Vec3d xy; Vec3d xy;
if (prj->projectCheck(XYZ,xy)) if (prj->projectCheck(XYZ,xy))
{ {
if (realisticModeFlag) if (realisticModeFlag)
{ {
double mag = getVMagnitude(core); double mag = getVMagnitude(core);
RCMag rcMag; RCMag rcMag;
Vec3f color = Vec3f(1.f,1.f,1.f); Vec3f color = Vec3f(1.f,1.f,1.f);
skipping to change at line 826 skipping to change at line 916
if (txtMag <= sd->getLimitMagnitude() && Satellite:: showLabels) if (txtMag <= sd->getLimitMagnitude() && Satellite:: showLabels)
painter.drawText(XYZ, name, 0, 10, 10, false ); painter.drawText(XYZ, name, 0, 10, 10, false );
painter.setProjector(origP); // Restrore projector s tate painter.setProjector(origP); // Restrore projector s tate
} }
else else
{ {
if (Satellite::showLabels) if (Satellite::showLabels)
painter.drawText(xy[0], xy[1], name, 0, 10, 10, false); painter.drawText(xy[0], xy[1], name, 0, 10, 10, false);
glEnable(GL_BLEND); painter.setBlending(true, GL_ONE, GL_ONE);
glBlendFunc(GL_ONE, GL_ONE);
Satellite::hintTexture->bind(); Satellite::hintTexture->bind();
painter.drawSprite2dMode(xy[0], xy[1], 11); painter.drawSprite2dMode(xy[0], xy[1], 11);
} }
} }
if (orbitDisplayed && Satellite::orbitLinesFlag && orbitValid) drawO rbit(painter); if (orbitDisplayed && Satellite::orbitLinesFlag && orbitValid) drawO rbit(painter);
} }
void Satellite::drawOrbit(StelPainter& painter) void Satellite::drawOrbit(StelPainter& painter)
{ {
Vec3d position, onscreen; Vec3d position, onscreen;
Vec3f drawColor; Vec3f drawColor;
int size = orbitPoints.size(); int size = orbitPoints.size();
glDisable(GL_TEXTURE_2D);
QList<Vec3d>::iterator it= orbitPoints.begin(); QList<Vec3d>::iterator it= orbitPoints.begin();
it++; it++;
QVector<Vec3d> vertexArray; QVector<Vec3d> vertexArray;
QVector<Vec4f> colorArray; QVector<Vec4f> colorArray;
StelProjectorP prj = painter.getProjector(); StelProjectorP prj = painter.getProjector();
vertexArray.resize(size); vertexArray.resize(size);
colorArray.resize(size); colorArray.resize(size);
skipping to change at line 872 skipping to change at line 959
if (prj->project(position, onscreen)) // check position on t he screen if (prj->project(position, onscreen)) // check position on t he screen
{ {
vertexArray.append(position); vertexArray.append(position);
drawColor = invisibleSatelliteColor; drawColor = invisibleSatelliteColor;
if (visibilityPoints[i] == VISIBLE) if (visibilityPoints[i] == VISIBLE)
drawColor = orbitColor; drawColor = orbitColor;
colorArray.append(Vec4f(drawColor[0], drawColor[1], drawColor[2], hintBrightness * calculateOrbitSegmentIntensity(i))); colorArray.append(Vec4f(drawColor[0], drawColor[1], drawColor[2], hintBrightness * calculateOrbitSegmentIntensity(i)));
} }
} }
painter.drawPath(vertexArray, colorArray); painter.drawPath(vertexArray, colorArray);
glEnable(GL_TEXTURE_2D);
painter.enableClientStates(false); painter.enableClientStates(false);
} }
float Satellite::calculateOrbitSegmentIntensity(int segNum) float Satellite::calculateOrbitSegmentIntensity(int segNum)
{ {
int endDist = (orbitLineSegments/2) - abs(segNum-1 - (orbitLineSegme nts/2) % orbitLineSegments); int endDist = (orbitLineSegments/2) - abs(segNum-1 - (orbitLineSegme nts/2) % orbitLineSegments);
if (endDist > orbitLineFadeSegments) if (endDist > orbitLineFadeSegments)
{ {
return 1.0; return 1.0;
} }
 End of changes. 14 change blocks. 
17 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/