TelescopeClient.cpp   TelescopeClient.cpp 
skipping to change at line 258 skipping to change at line 258
//! For the data format of the command see the //! For the data format of the command see the
//! "Stellarium telescope control protocol" text file //! "Stellarium telescope control protocol" text file
void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos) void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos)
{ {
if (!isConnected()) if (!isConnected())
return; return;
Vec3d position = j2000Pos; Vec3d position = j2000Pos;
if (equinox == EquinoxJNow) if (equinox == EquinoxJNow)
{ {
const StelNavigator* navigator = StelApp::getInstance().getC const StelCore* core = StelApp::getInstance().getCore();
ore()->getNavigator(); position = core->j2000ToEquinoxEqu(j2000Pos);
position = navigator->j2000ToEquinoxEqu(j2000Pos);
} }
if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeBuffer)) if (writeBufferEnd - writeBuffer + 20 < (int)sizeof(writeBuffer))
{ {
const double ra_signed = atan2(position[1], position[0]); const double ra_signed = atan2(position[1], position[0]);
//Workaround for the discrepancy in precision between Window s/Linux/PPC Macs and Intel Macs: //Workaround for the discrepancy in precision between Window s/Linux/PPC Macs and Intel Macs:
const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI); const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI);
const double dec = atan2(position[2], sqrt(position[0]*posit ion[0]+position[1]*position[1])); const double dec = atan2(position[2], sqrt(position[0]*posit ion[0]+position[1]*position[1]));
unsigned int ra_int = (unsigned int)floor(0.5 + ra*(((unsign ed int)0x80000000)/M_PI)); unsigned int ra_int = (unsigned int)floor(0.5 + ra*(((unsign ed int)0x80000000)/M_PI));
int dec_int = (int)floor(0.5 + dec*(((unsigned int)0x8000000 0)/M_PI)); int dec_int = (int)floor(0.5 + dec*(((unsigned int)0x8000000 0)/M_PI));
skipping to change at line 425 skipping to change at line 425
(((unsigned int)(unsign ed char)(p[22])) << 16) | (((unsigned int)(unsign ed char)(p[22])) << 16) |
(((unsigned int)(unsign ed char)(p[23])) << 24)); (((unsigned int)(unsign ed char)(p[23])) << 24));
const double ra = ra_int * (M_PI/( unsigned int)0x80000000); const double ra = ra_int * (M_PI/( unsigned int)0x80000000);
const double dec = dec_int * (M_PI/( unsigned int)0x80000000); const double dec = dec_int * (M_PI/( unsigned int)0x80000000);
const double cdec = cos(dec); const double cdec = cos(dec);
Vec3d position(cos(ra)*cdec, sin(ra) *cdec, sin(dec)); Vec3d position(cos(ra)*cdec, sin(ra) *cdec, sin(dec));
Vec3d j2000Position = position; Vec3d j2000Position = position;
if (equinox == EquinoxJNow) if (equinox == EquinoxJNow)
{ {
const StelNavigator* navigat const StelCore* core = StelA
or = StelApp::getInstance().getCore()->getNavigator(); pp::getInstance().getCore();
j2000Position = navigator->e j2000Position = core->equino
quinoxEquToJ2000(position); xEquToJ2000(position);
} }
interpolatedPosition.add(j2000Positi on, getNow(), server_micros, status); interpolatedPosition.add(j2000Positi on, getNow(), server_micros, status);
} }
break; break;
default: default:
qDebug() << "TelescopeTCP(" << name << ")::performReading: " << "ignoring unknown packet, type: " << type; qDebug() << "TelescopeTCP(" << name << ")::performReading: " << "ignoring unknown packet, type: " << type;
break; break;
} }
p += size; p += size;
} }
skipping to change at line 453 skipping to change at line 453
{ {
// partly handled // partly handled
memmove(readBuffer, p, readBufferEnd - p); memmove(readBuffer, p, readBufferEnd - p);
readBufferEnd -= (p - readBuffer); readBufferEnd -= (p - readBuffer);
} }
} }
} }
//! estimates where the telescope is by interpolation in the stored //! estimates where the telescope is by interpolation in the stored
//! telescope positions: //! telescope positions:
Vec3d TelescopeTCP::getJ2000EquatorialPos(const StelNavigator*) const Vec3d TelescopeTCP::getJ2000EquatorialPos(const StelCore*) const
{ {
const qint64 now = getNow() - time_delay; const qint64 now = getNow() - time_delay;
return interpolatedPosition.get(now); return interpolatedPosition.get(now);
} }
//! checks if the socket is connected, tries to connect if it is not //! checks if the socket is connected, tries to connect if it is not
//@return true if the socket is connected //@return true if the socket is connected
bool TelescopeTCP::prepareCommunication() bool TelescopeTCP::prepareCommunication()
{ {
if(tcpSocket->state() == QAbstractSocket::ConnectedState) if(tcpSocket->state() == QAbstractSocket::ConnectedState)
 End of changes. 3 change blocks. 
8 lines changed or deleted 7 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/