gSatWrapper.cpp   gSatWrapper.cpp 
skipping to change at line 48 skipping to change at line 48
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include <QDebug> #include <QDebug>
#include <QByteArray> #include <QByteArray>
gSatWrapper::gSatWrapper(QString designation, QString tle1,QString tle2) gSatWrapper::gSatWrapper(QString designation, QString tle1,QString tle2)
{ {
// The TLE library actually modifies the TLE strings, which is annoy ing (because // The TLE library actually modifies the TLE strings, which is annoy ing (because
// when we get updates, we want to check if there has been a change by using == // when we get updates, we want to check if there has been a change by using ==
// with the original. Thus we make a copy to send to the TLE librar y. // with the original. Thus we make a copy to send to the TLE librar y.
QByteArray t1(tle1.toAscii().data()), t2(tle2.toAscii().data()); QByteArray t1(tle1.toLatin1().data()), t2(tle2.toLatin1().data());
// Also, the TLE library expects no more than 130 characters length input. We // Also, the TLE library expects no more than 130 characters length input. We
// shouldn't have sane input with a TLE longer than about 80, but ju st in case // shouldn't have sane input with a TLE longer than about 80, but ju st in case
// we have a mal-formed input, we will truncate here to be safe // we have a mal-formed input, we will truncate here to be safe
t1.truncate(130); t1.truncate(130);
t2.truncate(130); t2.truncate(130);
pSatellite = new gSatTEME(designation.toAscii().data(), pSatellite = new gSatTEME(designation.toLatin1().data(),
t1.data(), t1.data(),
t2.data()); t2.data());
updateEpoch(); updateEpoch();
} }
gSatWrapper::~gSatWrapper() gSatWrapper::~gSatWrapper()
{ {
if (pSatellite != NULL) if (pSatellite != NULL)
delete pSatellite; delete pSatellite;
} }
skipping to change at line 205 skipping to change at line 205
Vec3d satECIPos = getTEMEPos(); Vec3d satECIPos = getTEMEPos();
Vec3d satECIVel = getTEMEVel(); Vec3d satECIVel = getTEMEVel();
Vec3d slantRange = satECIPos - observerECIPos; Vec3d slantRange = satECIPos - observerECIPos;
Vec3d slantRangeVelocity = satECIVel - observerECIVel; Vec3d slantRangeVelocity = satECIVel - observerECIVel;
ao_slantRange = slantRange.length(); ao_slantRange = slantRange.length();
ao_slantRangeRate = slantRange.dot(slantRangeVelocity)/ao_slantRang e; ao_slantRangeRate = slantRange.dot(slantRangeVelocity)/ao_slantRang e;
} }
// Operation getVisibilityPredict Vec3d gSatWrapper::getSunECIPos()
// @brief This operation predicts the satellite visibility contidions.
int gSatWrapper::getVisibilityPredict()
{ {
// All positions in ECI system are positions referenced in a StelCor e::EquinoxEq system centered in the earth centre // All positions in ECI system are positions referenced in a StelCor e::EquinoxEq system centered in the earth centre
Vec3d observerECIPos; Vec3d observerECIPos;
Vec3d observerECIVel; Vec3d observerECIVel;
Vec3d sunECIPos;
Vec3d sunEquinoxEqPos;
calcObserverECIPosition(observerECIPos, observerECIVel);
SolarSystem *solsystem = (SolarSystem*)StelApp::getInstance().getMod
uleMgr().getModule("SolarSystem");
sunEquinoxEqPos = solsystem->getSun()->getEquinoxEquatorialPo
s(StelApp::getInstance().getCore());
//sunEquinoxEqPos is measured in AU. we need meassure it in Km
sunECIPos.set(sunEquinoxEqPos[0]*AU, sunEquinoxEqPos[1]*AU, sunEquin
oxEqPos[2]*AU);
sunECIPos = sunECIPos + observerECIPos; //Change ref system centre
return sunECIPos;
}
// Operation getVisibilityPredict
// @brief This operation predicts the satellite visibility contidions.
int gSatWrapper::getVisibilityPredict()
{
Vec3d satECIPos; Vec3d satECIPos;
Vec3d satAltAzPos; Vec3d satAltAzPos;
Vec3d sunECIPos; Vec3d sunECIPos;
Vec3d sunEquinoxEqPos;
Vec3d sunAltAzPos; Vec3d sunAltAzPos;
double sunSatAngle, Dist; double sunSatAngle, Dist;
int visibility; int visibility;
satAltAzPos = getAltAz(); satAltAzPos = getAltAz();
if (satAltAzPos[2] > 0) if (satAltAzPos[2] > 0)
{ {
calcObserverECIPosition(observerECIPos, observerECIVel);
satECIPos = getTEMEPos(); satECIPos = getTEMEPos();
SolarSystem *solsystem = (SolarSystem*)StelApp::getInstance( ).getModuleMgr().getModule("SolarSystem"); SolarSystem *solsystem = (SolarSystem*)StelApp::getInstance( ).getModuleMgr().getModule("SolarSystem");
sunEquinoxEqPos = solsystem->getSun()->getEquinoxEqua torialPos(StelApp::getInstance().getCore());
sunAltAzPos = solsystem->getSun()->getAltAzPosGeometr ic(StelApp::getInstance().getCore()); sunAltAzPos = solsystem->getSun()->getAltAzPosGeometr ic(StelApp::getInstance().getCore());
//sunEquinoxEqPos is measured in AU. we need meassure it in sunECIPos = getSunECIPos();
Km
sunECIPos.set(sunEquinoxEqPos[0]*AU, sunEquinoxEqPos[1]*AU,
sunEquinoxEqPos[2]*AU);
sunECIPos = sunECIPos + observerECIPos; //Change ref system
centre
if (sunAltAzPos[2] > 0.0) if (sunAltAzPos[2] > 0.0)
{ {
visibility = RADAR_SUN; visibility = RADAR_SUN;
} }
else else
{ {
sunSatAngle = sunECIPos.angle(satECIPos); sunSatAngle = sunECIPos.angle(satECIPos);
Dist = satECIPos.length()*cos(sunSatAngle - (M_PI/2) ); Dist = satECIPos.length()*cos(sunSatAngle - (M_PI/2) );
skipping to change at line 261 skipping to change at line 271
{ {
visibility = RADAR_NIGHT; visibility = RADAR_NIGHT;
} }
} }
} }
else else
visibility = NOT_VISIBLE; visibility = NOT_VISIBLE;
return visibility; //TODO: put correct return return visibility; //TODO: put correct return
} }
double gSatWrapper::getPhaseAngle()
{
Vec3d sunECIPos = getSunECIPos();
return sunECIPos.angle(getTEMEPos());
}
 End of changes. 10 change blocks. 
16 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/