StelObserver.cpp   StelObserver.cpp 
skipping to change at line 43 skipping to change at line 43
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QStringList> #include <QStringList>
class ArtificialPlanet : public Planet class ArtificialPlanet : public Planet
{ {
public: public:
ArtificialPlanet(const PlanetP& orig); ArtificialPlanet(const PlanetP& orig);
void setDest(const PlanetP& dest); void setDest(const PlanetP& dest);
void computeAverage(double f1); void computeAverage(double f1);
virtual void computePosition(const double dateJDE);
private: private:
void setRot(const Vec3d &r); void setRot(const Vec3d &r);
static Vec3d getRot(const Planet* p); static Vec3d getRot(const Planet* p);
PlanetP dest; PlanetP dest;
const QString orig_name; const QString orig_name;
const QString orig_name_i18n; const QString orig_name_i18n;
}; };
ArtificialPlanet::ArtificialPlanet(const PlanetP& orig) : ArtificialPlanet::ArtificialPlanet(const PlanetP& orig) :
Planet("art", 0, 0, Vec3f(0,0,0), 0, 0, "", "", "", Q_NULLPT R, Q_NULLPTR, Q_NULLPTR, false, true, false, true, "artificial"), Planet("art", 0, 0, Vec3f(0,0,0), 0, 0, "", "", "", Q_NULLPT R, Q_NULLPTR, Q_NULLPTR, false, true, false, true, "artificial"),
skipping to change at line 140 skipping to change at line 141
r[0] = atan2(m.r[9],m.r[10]); r[0] = atan2(m.r[9],m.r[10]);
} }
else else
{ {
r[0] = atan2(-m.r[6],m.r[5]); r[0] = atan2(-m.r[6],m.r[5]);
r[2] = atan2( m.r[8],m.r[0]); r[2] = atan2( m.r[8],m.r[0]);
} }
return r; return r;
} }
void ArtificialPlanet::computePosition(const double dateJDE)
{
Q_UNUSED(dateJDE)
// This does nothing, but avoids a crash.
}
void ArtificialPlanet::computeAverage(double f1) void ArtificialPlanet::computeAverage(double f1)
{ {
const double f2 = 1.0 - f1; const double f2 = 1.0 - f1;
// position // position
setHeliocentricEclipticPos(getHeliocentricEclipticPos()*f1 + dest->g etHeliocentricEclipticPos()*f2); setHeliocentricEclipticPos(getHeliocentricEclipticPos()*f1 + dest->g etHeliocentricEclipticPos()*f2);
// 3 Euler angles // 3 Euler angles
Vec3d a1(getRot(this)); Vec3d a1(getRot(this));
const Vec3d a2(getRot(dest.data())); const Vec3d a2(getRot(dest.data()));
if (a1[0]-a2[0] > M_PI) if (a1[0]-a2[0] > M_PI)
skipping to change at line 314 skipping to change at line 321
bool SpaceShipObserver::update(double deltaTime) bool SpaceShipObserver::update(double deltaTime)
{ {
if (timeToGo <= 0.) return false; // Already over. if (timeToGo <= 0.) return false; // Already over.
timeToGo -= deltaTime; timeToGo -= deltaTime;
// If move is over // If move is over
if (timeToGo <= 0.) if (timeToGo <= 0.)
{ {
timeToGo = 0.; timeToGo = 0.;
currentLocation = moveTargetLocation; currentLocation = moveTargetLocation;
LandscapeMgr* ls = GETSTELMODULE(LandscapeMgr); LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr);
SolarSystem* ss = GETSTELMODULE(SolarSystem); SolarSystem* ss = GETSTELMODULE(SolarSystem);
if (ls->getFlagLandscapeAutoSelection())
// we have to avoid auto-select landscape in case the select
ed new landscape is on our target planet (true if landscape sets location).
(LP:#1700199)
if ( (lmgr->getFlagLandscapeAutoSelection()) && !(lmgr->getF
lagLandscapeSetsLocation()) )
{ {
QString pType = ss->getPlanetType(currentLocation.pl anetName); QString pType = ss->getPlanetType(currentLocation.pl anetName);
// If we have a landscape for target planet then set it or check and use // If we have a landscape for target planet then set it or check and use
// landscape type of target planet, otherwise use de fault landscape // landscape type of target planet, otherwise use de fault landscape
if (ls->getAllLandscapeNames().indexOf(currentLocati if (lmgr->getAllLandscapeNames().indexOf(currentLoca
on.planetName)>0) tion.planetName)>0)
ls->setCurrentLandscapeName(currentLocation. lmgr->setCurrentLandscapeName(currentLocatio
planetName); n.planetName);
else if (ls->getAllLandscapeIDs().indexOf(pType)>0) else if (lmgr->getAllLandscapeIDs().indexOf(pType)>0
ls->setCurrentLandscapeID(pType); )
lmgr->setCurrentLandscapeID(pType);
else else
ls->setCurrentLandscapeID(ls->getDefaultLand scapeID()); lmgr->setCurrentLandscapeID(lmgr->getDefault LandscapeID());
} }
} }
else else
{ {
if (artificialPlanet) if (artificialPlanet)
{ {
// Update SpaceShip position // Update SpaceShip position
static_cast<ArtificialPlanet*>(artificialPlanet.data ())->computeAverage(timeToGo/(timeToGo + deltaTime)); static_cast<ArtificialPlanet*>(artificialPlanet.data ())->computeAverage(timeToGo/(timeToGo + deltaTime));
currentLocation.planetName = "SpaceShip"; currentLocation.planetName = "SpaceShip";
const StelTranslator& trans = StelApp::getInstance() .getLocaleMgr().getSkyTranslator(); const StelTranslator& trans = StelApp::getInstance() .getLocaleMgr().getSkyTranslator();
 End of changes. 6 change blocks. 
9 lines changed or deleted 22 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/