Satellite.cpp   Satellite.cpp 
skipping to change at line 22 skipping to change at line 22
* 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.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Satellite.hpp" #include "Satellite.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp"
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "renderer/StelCircleArcRenderer.hpp"
#include "renderer/StelRenderer.hpp"
#include "renderer/StelTextureNew.hpp"
#include <QTextStream> #include <QTextStream>
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QtOpenGL>
#include <QSettings> #include <QSettings>
#include <QByteArray> #include <QByteArray>
#include "gsatellite/gTime.hpp" #include "gsatellite/gTime.hpp"
#include <cmath> #include <cmath>
// static data members - will be initialised in the Satallites class (the S telObjectMgr) // static data members - will be initialised in the Satallites class (the S telObjectMgr)
StelTextureSP Satellite::hintTexture;
float Satellite::showLabels = true; float Satellite::showLabels = true;
float Satellite::hintBrightness = 0.0; float Satellite::hintBrightness = 0.0;
float Satellite::hintScale = 1.f; float Satellite::hintScale = 1.f;
SphericalCap Satellite::viewportHalfspace = SphericalCap(); SphericalCap Satellite::viewportHalfspace = SphericalCap();
int Satellite::orbitLineSegments = 90; int Satellite::orbitLineSegments = 90;
int Satellite::orbitLineFadeSegments = 4; int Satellite::orbitLineFadeSegments = 4;
int Satellite::orbitLineSegmentDuration = 20; int Satellite::orbitLineSegmentDuration = 20;
bool Satellite::orbitLinesFlag = true; bool Satellite::orbitLinesFlag = true;
Satellite::Satellite(const QString& identifier, const QVariantMap& map) Satellite::Satellite(const QString& identifier, const QVariantMap& map)
skipping to change at line 241 skipping to change at line 240
.arg(id); .arg(id);
else else
catalogNumbers = QString("%1: %2; %3: %4") catalogNumbers = QString("%1: %2; %3: %4")
.arg(q_("Catalog #")) .arg(q_("Catalog #"))
.arg(id) .arg(id)
.arg(q_("International Designator") ) .arg(q_("International Designator") )
.arg(internationalDesignator); .arg(internationalDesignator);
oss << catalogNumbers << "<br/><br/>"; oss << catalogNumbers << "<br/><br/>";
} }
if (flags & Extra1)
{
oss << q_("Type: <b>%1</b>").arg(q_("artificial satellite"))
<< "<br/>";
}
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags & Extra1) if (flags & Extra1)
{ {
oss << "<br/>"; oss << "<br/>";
// TRANSLATORS: Slant range: distance between the satellite and the observer // TRANSLATORS: Slant range: distance between the satellite and the observer
oss << QString(q_("Range (km): %1")).arg(range, 5, 'f', 2); oss << QString(q_("Range (km): %1")).arg(range, 5, 'f', 2);
oss << "<br/>"; oss << "<br/>";
// TRANSLATORS: Rate at which the distance changes // TRANSLATORS: Rate at which the distance changes
skipping to change at line 399 skipping to change at line 403
latLongSubPointPosition = pSatWrapper->getSubPoint(); latLongSubPointPosition = pSatWrapper->getSubPoint();
height = latLongSubPointPosition[2]; height = latLongSubPointPosition[2];
if (height <= 0.0) if (height <= 0.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.
qWarning() << "Satellite has invalid orbit:" << name ; qWarning() << "Satellite has invalid orbit:" << name << id;
orbitValid = false; orbitValid = false;
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();
skipping to change at line 478 skipping to change at line 482
if (!ok) if (!ok)
return 1957; return 1957;
// 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)
return year + 2000; return year + 2000;
else else
return year + 1900; return year + 1900;
} }
void Satellite::draw(const StelCore* core, StelPainter& painter, float) void Satellite::draw(const StelCore* core, StelRenderer* renderer,
StelProjectorP projector, StelTextureNew* hintTexture)
{ {
if (core->getJDay() < jdLaunchYearJan1) return; 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, StelApp::getInstance().getVisionModeNight()
1.0) : glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBri ? renderer->setGlobalColor(0.6,0.0,0.0,1.0)
ghtness); : renderer->setGlobalColor(drawColor[0],drawColor[1],drawCol
or[2], Satellite::hintBrightness);
StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
Vec3d xy; Vec3d xy;
if (prj->project(XYZ,xy)) if (core->getProjection(StelCore::FrameJ2000)->project(XYZ,xy))
{ {
if (Satellite::showLabels) if (Satellite::showLabels)
{ {
painter.drawText(xy[0], xy[1], name, 0, 10, 10, fals renderer->drawText(TextParams(xy[0], xy[1], name).sh
e); ift(10, 10).useGravity());
Satellite::hintTexture->bind();
} }
painter.drawSprite2dMode(xy[0], xy[1], 11); renderer->drawTexturedRect(xy[0] - 11, xy[1] - 11, 22, 22);
if (orbitVisible && Satellite::orbitLinesFlag) drawOrbit(pai nter); if (orbitVisible && Satellite::orbitLinesFlag) {drawOrbit(re nderer, projector);}
} }
} }
void Satellite::drawOrbit(StelPainter& painter) void Satellite::drawOrbit(StelRenderer* renderer, StelProjectorP projector)
{ {
Vec3d position,previousPosition; Vec3d position,previousPosition;
glDisable(GL_TEXTURE_2D);
QList<Vec3d>::iterator it= orbitPoints.begin(); QList<Vec3d>::iterator it= orbitPoints.begin();
//First point projection calculation //First point projection calculation
previousPosition.set(it->operator [](0), it->operator [](1), it->ope rator [](2)); previousPosition.set(it->operator [](0), it->operator [](1), it->ope rator [](2));
it++; it++;
StelVertexArray vertexArray;
vertexArray.primitiveType=StelVertexArray::Lines;
QVector<Vec3d> orbitArcPoints;
StelCircleArcRenderer circleArcRenderer(renderer, projector);
//Rest of points //Rest of points
for (int i=1; i<orbitPoints.size(); i++) for (int i=1; i<orbitPoints.size(); i++)
{ {
position.set(it->operator [](0), it->operator [](1), it->ope rator [](2)); position.set(it->operator [](0), it->operator [](1), it->ope rator [](2));
it++; it++;
position.normalize(); position.normalize();
previousPosition.normalize(); previousPosition.normalize();
// Draw end (fading) parts of orbit lines one segment at a t ime. // Draw end (fading) parts of orbit lines one segment at a t ime.
if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitL ineFadeSegments) if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitL ineFadeSegments)
{ {
painter.setColor((*orbitColor)[0], (*orbitColor)[1], renderer->setGlobalColor((*orbitColor)[0], (*orbitCo
(*orbitColor)[2], hintBrightness * calculateOrbitSegmentIntensity(i)); lor)[1], (*orbitColor)[2],
painter.drawGreatCircleArc(previousPosition, positio hintBrightness * calculateO
n, &viewportHalfspace); rbitSegmentIntensity(i));
circleArcRenderer.drawGreatCircleArc(previousPositio
n, position, &viewportHalfspace);
} }
else else
{ {
vertexArray.vertex << previousPosition << position; orbitArcPoints << previousPosition << position;
} }
previousPosition = position; previousPosition = position;
} }
// Draw center section of orbit in one go // Draw center section of orbit in one go
painter.setColor((*orbitColor)[0], (*orbitColor)[1], (*orbitColor)[2 renderer->setGlobalColor((*orbitColor)[0], (*orbitColor)[1], (*orbit
], hintBrightness); Color)[2],
painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace); hintBrightness);
circleArcRenderer.drawGreatCircleArcs(orbitArcPoints, PrimitiveType_
glEnable(GL_TEXTURE_2D); Lines, &viewportHalfspace);
} }
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;
} }
else else
 End of changes. 20 change blocks. 
32 lines changed or deleted 36 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/