Satellite.cpp   Satellite.cpp 
skipping to change at line 20 skipping to change at line 20
* 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.
* *
* 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.
*/ */
//#define IRIDIUM_SAT_TEXT_DEBUG
#include "Satellite.hpp" #include "Satellite.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelPainter.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 "StelTexture.hpp"
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QTextStream> #include <QTextStream>
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QSettings> #include <QSettings>
#include <QByteArray> #include <QByteArray>
#include <QVector3D>
#include <QMatrix4x4>
#include "gsatellite/gTime.hpp" #include "gsatellite/gTime.hpp"
#include "gsatellite/stdsat.h"
#include <cmath> #include <cmath>
#define sqr(a) ((a)*(a))
// 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; 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;
bool Satellite::realisticModeFlag = false; bool Satellite::realisticModeFlag = false;
Vec3f Satellite::invisibleSatelliteColor = Vec3f(0.2,0.2,0.2);
#ifdef IRIDIUM_SAT_TEXT_DEBUG
QString Satellite::myText = "";
#endif
double Satellite::sunReflAngle = 180.;
double Satellite::timeShift = 0.;
Satellite::Satellite(const QString& identifier, const QVariantMap& map) Satellite::Satellite(const QString& identifier, const QVariantMap& map)
: initialized(false), : initialized(false),
displayed(true), displayed(true),
orbitDisplayed(false), orbitDisplayed(false),
userDefined(false), userDefined(false),
newlyAdded(false), newlyAdded(false),
orbitValid(false), orbitValid(false),
jdLaunchYearJan1(0), jdLaunchYearJan1(0),
stdMag(99.), stdMag(99.),
skipping to change at line 260 skipping to change at line 275
} }
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 r(getVMagnitude(core), 'f', 2)) << "<br/>"; oss << q_("Approx. magnitude: <b>%1</b>").arg(QString::numbe r(getVMagnitude(core), 'f', 2)) << "<br/>";
#ifdef IRIDIUM_SAT_TEXT_DEBUG
oss << myText << "<br/>";
#endif
} }
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags & Extra) if (flags & Extra)
{ {
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);
skipping to change at line 303 skipping to change at line 321
oss << "<br/>"; oss << "<br/>";
QString temeVel = QString(xyz) QString temeVel = QString(xyz)
.arg(velocity[0], 5, 'f', 2) .arg(velocity[0], 5, 'f', 2)
.arg(velocity[1], 5, 'f', 2) .arg(velocity[1], 5, 'f', 2)
.arg(velocity[2], 5, 'f', 2); .arg(velocity[2], 5, 'f', 2);
// TRANSLATORS: TEME is an Earth-centered inertial coordinat e system // TRANSLATORS: TEME is an Earth-centered inertial coordinat e system
oss << QString(q_("TEME velocity (km/s): %1")).arg(temeVel); oss << QString(q_("TEME velocity (km/s): %1")).arg(temeVel);
oss << "<br/>"; oss << "<br/>";
if (sunReflAngle>0)
{ // Iridium
oss << QString(q_("Sun reflection angle: %1%2"))
.arg(sunReflAngle,0,'f',1)
.arg(QChar(0x00B0)); // Degree sign
oss << "<br/>";
}
//Visibility: Full text //Visibility: Full text
//TODO: Move to a more prominent place. //TODO: Move to a more prominent place.
switch (visibility) switch (visibility)
{ {
case RADAR_SUN: case RADAR_SUN:
oss << q_("The satellite and the observer ar e in sunlight.") << "<br/>"; oss << q_("The satellite and the observer ar e in sunlight.") << "<br/>";
break; break;
case VISIBLE: case VISIBLE:
oss << q_("The satellite is visible.") << "< br/>"; oss << q_("The satellite is visible.") << "< br/>";
break; break;
skipping to change at line 372 skipping to change at line 398
return hintColor; return hintColor;
} }
float Satellite::getVMagnitude(const StelCore* core) const float Satellite::getVMagnitude(const StelCore* core) const
{ {
Q_UNUSED(core); Q_UNUSED(core);
float vmag = 7.f; // Optimistic value of magnitude for artificial sa tellite without data for standard magnitude float vmag = 7.f; // Optimistic value of magnitude for artificial sa tellite without data for standard magnitude
if (!realisticModeFlag) if (!realisticModeFlag)
vmag = 5.0; vmag = 5.0;
if (realisticModeFlag && visibility != VISIBLE)
vmag = 17.f; // Artificial satellite is invisible and 17 is
hypothetical value of magnitude
if (stdMag!=99.f) if (stdMag!=99.f)
{ {
sunReflAngle = -1.;
// OK, artificial satellite has value for standard magnitude // OK, artificial satellite has value for standard magnitude
if (visibility==VISIBLE) if (visibility==VISIBLE)
{ {
// Calculation of approx. visual magnitude for artif icial satellites // Calculation of approx. visual magnitude for artif icial satellites
// described here: http://www.prismnet.com/~mmccants /tles/mccdesc.html // described here: http://www.prismnet.com/~mmccants /tles/mccdesc.html
double fracil = calculateIlluminatedFraction(); double fracil = calculateIlluminatedFraction();
if (fracil==0) if (fracil==0)
fracil = 0.000001; fracil = 0.000001;
vmag = stdMag - 15.75 + 2.5 * std::log10(range * ran if (pSatWrapper && name.startsWith("IRIDIUM"))
ge / fracil); {
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText = "";
#endif
Vec3d Sun3d = pSatWrapper->getSunECIPos();
QVector3D sun(Sun3d.data()[0],Sun3d.data()[1
],Sun3d.data()[2]);
QVector3D sunN = sun; sunN.normalize();
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "Sun3d = " + QString("[%1 %2 %3]")
.arg(sunN.x())
.arg(sunN.y())
.arg(sunN.z())
+ "<br>\n";
#endif
//static double sin1 = sin(40*M_PI/180);
//static double cos1 = cos(40*M_PI/180);
//static double sin2 = sin(120*M_PI/180);
//static double cos2 = cos(120*M_PI/180);
// position, velocity are known
QVector3D Vx(velocity.data()[0],velocity.dat
a()[1],velocity.data()[2]); Vx.normalize();
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "Vx = " + QString("[%1 %2 %3]")
.arg(Vx.x())
.arg(Vx.y())
.arg(Vx.z())
+ "<br>\n";
#endif
QVector3D SatPos(position.data()[0],position
.data()[1],position.data()[2]);
Vec3d vy = (position^velocity);
QVector3D Vy(vy.data()[0],vy.data()[1],vy.da
ta()[2]); Vy.normalize();
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "Vy = " + QString("[%1 %2 %3]")
.arg(Vy.x())
.arg(Vy.y())
.arg(Vy.z())
+ "<br>\n";
#endif
QVector3D Vz = QVector3D::crossProduct(Vx,Vy
); Vz.normalize();
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "Vz = " + QString("[%1 %2 %3]")
.arg(Vz.x())
.arg(Vz.y())
.arg(Vz.z())
+ "<br>\n";
#endif
// move this to constructor for optimizing
QMatrix4x4 m0;
m0.rotate(40, Vy);
QVector3D Vx0 = m0.mapVector(Vx);
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "mirror0 = " + QString("[%1 %2 %3]
")
.arg(Vx0.x())
.arg(Vx0.y())
.arg(Vx0.z())
+ "<br>\n";
#endif
QMatrix4x4 m[3];
//m[2] = m[1] = m[0];
m[0].rotate(0, Vz);
m[1].rotate(120, Vz);
m[2].rotate(-120, Vz);
QVector3D mirror;
sunReflAngle = 180.;
for (int i = 0; i<3; i++)
{
mirror = m[i].mapVector(Vx0);
mirror.normalize();
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "mirror = " + QString("[%1
%2 %3]")
.arg(mirror.x())
.arg(mirror.y())
.arg(mirror.z())
+ "<br>\n";
#endif
// reflection R = 2*(V dot N)*N - V
QVector3D rsun = 2*QVector3D::dotPr
oduct(sun,mirror)*mirror - sun;
rsun = -rsun;
Vec3d rSun(rsun.x(),rsun.y(),rsun.z(
));
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "rSun = " + rSun.toString(
) + "<br>\n";
#endif
///////////////////////////////////////////////////////////////////////////
/////////////////////////
StelLocation loc = StelApp::getIns
tance().getCore()->getCurrentLocation();
Vec3d topoRSunPos;
Vec3d observerECIPos;
Vec3d observerECIVel;
double radLatitude = loc.latitud
e * KDEG2RAD;
double theta = pSatWrapper
->getEpoch().toThetaLMST(loc.longitude * KDEG2RAD);
pSatWrapper->calcObserverECIPosition
(observerECIPos, observerECIVel);
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "ObsPos = " + observerECIP
os.toString() + " (" + observerECIPos.toStringLonLat() + ")<br>\n";
myText += "ObsVel = " + observerECIV
el.toString() + " (" + observerECIVel.toStringLonLat() + ")<br>\n";
#endif
//Vec3d satECIPos = getTEMEPos();
Vec3d slantRange = rSun - observerEC
IPos;
//top_s
topoRSunPos[0] = (sin(radLatitude) *
cos(theta) * slantRange[0]
+ sin(radLatitude) *
sin(theta) * slantRange[1]
- cos(radLatitude) *
slantRange[2]);
//top_e
topoRSunPos[1] = ((-1.0) * sin(theta
) * slantRange[0]
+ cos(theta) * slant
Range[1]);
//top_z
topoRSunPos[2] = (cos(radLatitude) *
cos(theta) * slantRange[0]
+ cos(radLatitude) *
sin(theta) * slantRange[1]
+ sin(radLatitude) *
slantRange[2]);
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += "SunRefl = " + topoRSunPos
.toString() + " (" + topoRSunPos.toStringLonLat() + ")<br>\n";
#endif
sunReflAngle = qMin(elAzPosition.ang
le(topoRSunPos) * KRAD2DEG, sunReflAngle) ;
#ifdef IRIDIUM_SAT_TEXT_DEBUG
myText += QString("Angle = %1").arg(
QString::number(sunReflAngle, 'f', 1)) + "<br>";
#endif
///////////////////////////////////////////////////////////////////////////
/////////////////////////
}
// very simple flare model
double iridiumFlare = 100;
if (sunReflAngle<0.5)
{
iridiumFlare = -8.92 + sunReflAngle*
6;
}
else
if (sunReflAngle<0.7)
{
iridiumFlare = -5.92 + (sunReflAngle
-0.5)*10;
}
else
{
iridiumFlare = -3.92 + (sunReflAngle
-0.7)*5;
}
vmag = qMin(stdMag, iridiumFlare);
}
else // not Iridium
{
sunReflAngle = -1;
vmag = stdMag;
}
vmag = vmag - 15.75 + 2.5 * std::log10(range * range
/ fracil);
} }
else
vmag = 17.f; // Artificial satellite is invisible an
d 17 is hypothetical value of magnitude
} }
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 + cos(phaseAngle))/2;
} }
skipping to change at line 417 skipping to change at line 602
delete old; delete old;
} }
tleElements.first.clear(); tleElements.first.clear();
tleElements.first.append(tle1); tleElements.first.append(tle1);
tleElements.second.clear(); tleElements.second.clear();
tleElements.second.append(tle2); tleElements.second.append(tle2);
pSatWrapper = new gSatWrapper(id, tle1, tle2); pSatWrapper = new gSatWrapper(id, tle1, tle2);
orbitPoints.clear(); orbitPoints.clear();
visibilityPoints.clear();
parseInternationalDesignator(tle1); parseInternationalDesignator(tle1);
} }
void Satellite::update(double) void Satellite::update(double)
{ {
if (pSatWrapper && orbitValid) if (pSatWrapper && orbitValid)
{ {
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
double JD = core->getJDay(); epochTime = core->getJD() + timeShift; // We have "true" JD
epochTime = JD - core->getDeltaT(JD)/86400; // Delta T anti- from core, satellites don't need JDE!
correction for artificial satellites
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];
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
skipping to change at line 471 skipping to change at line 656
{ {
double result; double result;
double f = freq * 1000000; double f = freq * 1000000;
result = -f*((rangeRate*1000.0)/SPEED_OF_LIGHT); result = -f*((rangeRate*1000.0)/SPEED_OF_LIGHT);
return result/1000000; return result/1000000;
} }
void Satellite::recalculateOrbitLines(void) void Satellite::recalculateOrbitLines(void)
{ {
orbitPoints.clear(); orbitPoints.clear();
visibilityPoints.clear();
} }
SatFlags Satellite::getFlags() SatFlags Satellite::getFlags()
{ {
// There's also a faster, but less readable way: treating them as ui nt. // There's also a faster, but less readable way: treating them as ui nt.
SatFlags flags; SatFlags flags;
if (displayed) if (displayed)
flags |= SatDisplayed; flags |= SatDisplayed;
else else
flags |= SatNotDisplayed; flags |= SatNotDisplayed;
skipping to change at line 542 skipping to change at line 728
// If the names are the same, compare IDs, i.e. NORAD numbers. // If the names are the same, compare IDs, i.e. NORAD numbers.
if (id < another.id) if (id < another.id)
return true; return true;
else else
return false; return false;
} }
void Satellite::draw(StelCore* core, StelPainter& painter, float) void Satellite::draw(StelCore* core, StelPainter& painter, float)
{ {
if (core->getJDay()<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(0.2f,0.2f,0.2f); Vec3f drawColor = invisibleSatelliteColor;
if (visibility != RADAR_NIGHT) 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);
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);
StelProjectorP origP = painter.getProjector(); // Sa ve projector state StelProjectorP origP = painter.getProjector(); // Sa ve projector state
painter.setProjector(prj); painter.setProjector(prj);
// Draw the satellite
sd->preDrawPointSource(&painter); sd->preDrawPointSource(&painter);
if (mag <= sd->getLimitMagnitude()) if (mag <= sd->getLimitMagnitude())
{ {
sd->computeRCMag(mag, &rcMag); sd->computeRCMag(mag, &rcMag);
sd->drawPointSource(&painter, Vec3f(XYZ[0],X YZ[1],XYZ[2]), rcMag, color, true); sd->drawPointSource(&painter, Vec3f(XYZ[0],X YZ[1],XYZ[2]), rcMag, color, true);
painter.setColor(color[0], color[1], color[2 }
], 1); sd->postDrawPointSource(&painter);
if (Satellite::showLabels)
painter.drawText(XYZ, name, 0, 10, 1
0, false);
float txtMag = mag;
if (visibility != VISIBLE)
{
txtMag = mag - 10.f; // Oops... Artificial s
atellite is invisible, but let's make the label visible
painter.setColor(invisibleSatelliteColor[0],
invisibleSatelliteColor[1], invisibleSatelliteColor[2], 1);
} }
else
painter.setColor(color[0], color[1], color[2
], 1);
sd->postDrawPointSource(&painter); // Draw the label of the satellite when it enabled
if (txtMag <= sd->getLimitMagnitude() && Satellite::
showLabels)
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);
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,previousPosition; Vec3d position;
Vec3f drawColor;
int size = orbitPoints.size();
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
QList<Vec3d>::iterator it= orbitPoints.begin(); QList<Vec3d>::iterator it= orbitPoints.begin();
it++;
//First point projection calculation QVector<Vec3d> vertexArray;
previousPosition.set(it->operator [](0), it->operator [](1), it->ope QVector<Vec4f> colorArray;
rator [](2));
it++; vertexArray.resize(size);
StelVertexArray vertexArray; colorArray.resize(size);
vertexArray.primitiveType=StelVertexArray::Lines;
//Rest of points //Rest of points
for (int i=1; i<orbitPoints.size(); i++) for (int i=1; i<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();
// Draw end (fading) parts of orbit lines one segment at a t vertexArray[i] = position;
ime. drawColor = invisibleSatelliteColor;
if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitL if (visibilityPoints[i] == VISIBLE)
ineFadeSegments) drawColor = orbitColor;
{ colorArray[i] = Vec4f(drawColor[0], drawColor[1], drawColor[
painter.setColor(orbitColor[0], orbitColor[1], orbit 2], hintBrightness * calculateOrbitSegmentIntensity(i));
Color[2], hintBrightness * calculateOrbitSegmentIntensity(i));
painter.drawGreatCircleArc(previousPosition, positio
n, &viewportHalfspace);
}
else
{
vertexArray.vertex << previousPosition << position;
}
previousPosition = position;
} }
// Draw center section of orbit in one go painter.drawPath(vertexArray, colorArray);
painter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], hintBr
ightness);
painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
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;
skipping to change at line 669 skipping to change at line 860
if (orbitPoints.isEmpty())//Setup orbitPoins if (orbitPoints.isEmpty())//Setup orbitPoins
{ {
epochTm = epoch - orbitSpan; epochTm = epoch - orbitSpan;
for (int i=0; i<=orbitLineSegments; i++) for (int i=0; i<=orbitLineSegments; i++)
{ {
pSatWrapper->setEpoch(epochTm.getGmtTm()); pSatWrapper->setEpoch(epochTm.getGmtTm());
elAzVector = pSatWrapper->getAltAz(); elAzVector = pSatWrapper->getAltAz();
orbitPoints.append(elAzVector); orbitPoints.append(elAzVector);
visibilityPoints.append(pSatWrapper->getVisibilityPr edict());
epochTm += computeInterval; epochTm += computeInterval;
} }
lastEpochCompForOrbit = epochTime; lastEpochCompForOrbit = epochTime;
} }
else if (epochTime > lastEpochCompForOrbit) else if (epochTime > lastEpochCompForOrbit)
{ // compute next orbit point when clock runs forward { // compute next orbit point when clock runs forward
gTimeSpan diffTime = epoch - lastEpochComp; gTimeSpan diffTime = epoch - lastEpochComp;
diffSlots = (int)(diffTime.getDblSeconds()/orbitLin eSegmentDuration); diffSlots = (int)(diffTime.getDblSeconds()/orbitLin eSegmentDuration);
skipping to change at line 695 skipping to change at line 887
} }
else else
{ {
epochTm = lastEpochComp + orbitSpan + comp uteInterval; epochTm = lastEpochComp + orbitSpan + comp uteInterval;
} }
for (int i=0; i<diffSlots; i++) for (int i=0; i<diffSlots; i++)
{ {
//remove points at beginning of list and add points at end. //remove points at beginning of list and add points at end.
orbitPoints.removeFirst(); orbitPoints.removeFirst();
visibilityPoints.removeFirst();
pSatWrapper->setEpoch(epochTm.getGmtTm()); pSatWrapper->setEpoch(epochTm.getGmtTm());
elAzVector = pSatWrapper->getAltAz(); elAzVector = pSatWrapper->getAltAz();
orbitPoints.append(elAzVector); orbitPoints.append(elAzVector);
visibilityPoints.append(pSatWrapper->getVisi bilityPredict());
epochTm += computeInterval; epochTm += computeInterval;
} }
lastEpochCompForOrbit = epochTime; lastEpochCompForOrbit = epochTime;
} }
} }
else if (epochTime < lastEpochCompForOrbit) else if (epochTime < lastEpochCompForOrbit)
{ // compute next orbit point when clock runs backward { // compute next orbit point when clock runs backward
gTimeSpan diffTime = lastEpochComp - epoch; gTimeSpan diffTime = lastEpochComp - epoch;
diffSlots = (int)(diffTime.getDblSeconds()/orbitLin eSegmentDuration); diffSlots = (int)(diffTime.getDblSeconds()/orbitLin eSegmentDuration);
skipping to change at line 723 skipping to change at line 917
diffSlots = orbitLineSegments + 1; diffSlots = orbitLineSegments + 1;
epochTm = epoch + orbitSpan; epochTm = epoch + orbitSpan;
} }
else else
{ {
epochTm = epoch - orbitSpan - computeInter val; epochTm = epoch - orbitSpan - computeInter val;
} }
for (int i=0; i<diffSlots; i++) for (int i=0; i<diffSlots; i++)
{ //remove points at end of list and add points at b eginning. { //remove points at end of list and add points at b eginning.
orbitPoints.removeLast(); orbitPoints.removeLast();
visibilityPoints.removeLast();
pSatWrapper->setEpoch(epochTm.getGmtTm()); pSatWrapper->setEpoch(epochTm.getGmtTm());
elAzVector = pSatWrapper->getAltAz(); elAzVector = pSatWrapper->getAltAz();
orbitPoints.push_front(elAzVector); orbitPoints.push_front(elAzVector);
visibilityPoints.push_front(pSatWrapper->get VisibilityPredict());
epochTm -= computeInterval; epochTm -= computeInterval;
} }
lastEpochCompForOrbit = epochTime; lastEpochCompForOrbit = epochTime;
} }
} }
} }
bool operator <(const SatelliteP& left, const SatelliteP& right) bool operator <(const SatelliteP& left, const SatelliteP& right)
{ {
 End of changes. 36 change blocks. 
46 lines changed or deleted 274 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/