示例#1
0
//Determine values for the orbital elements for the requested JD, then
//call KSAsteroid::findGeocentricPosition()
bool KSPluto::findGeocentricPosition( const KSNumbers *num, const KSPlanetBase *Earth ) {
    //First, set the orbital element values according to the current epoch
    double t = num->julianCenturies();
    set_a( a0 + a1*t );
    set_e( e0 + e1*t );
    set_i( i0.Degrees() + i1*t );
    set_N( N0.Degrees() + N1*t );
    set_M( M0.Degrees() + M1*t );
    set_P( 365.2568984 * pow((a0+a1*t), 1.5) ); //set period from Kepler's 3rd law
    setJD( num->julianDay() );

    return KSAsteroid::findGeocentricPosition( num, Earth );
}
示例#2
0
void SkServer::dataReady()
{
  QByteArray data;

  data = m_client->readAll();

  qDebug() << data;

  QStringList commands;
  QString str;

  for (int i = 0; i < data.count(); i++)
  {
    if ((data.mid(i, 3) == "\r\n\n") || (data.mid(i, 3) == "\r\n"))
    {
      commands.append(str);
      i += 2;
      str.clear();
    }
    else
    {
      str += data[i];
    }
  }

  if (commands.count() == 0)
  {
    sendData(SKS_INVALID);
    return;
  }

  foreach (const QString &command, commands)
  {
    if (command.startsWith("Echo ", Qt::CaseInsensitive))
    {
      sendData(command.mid(5).toLocal8Bit());
    }
    else
    if (command.startsWith("SetPos ", Qt::CaseInsensitive))
    {
      setRA_Dec(command.mid(6));
    }
    else
    if (!command.compare("GetPos", Qt::CaseInsensitive))
    {
      getPos();
    }
    else
    if (!command.compare("GetJD", Qt::CaseInsensitive))
    {
      getJD();
    }
    else
    if (command.startsWith("SetJD ", Qt::CaseInsensitive))
    {
      setJD(command.mid(5));
    }
    else
    if (!command.compare("ZoomIn", Qt::CaseInsensitive))
    {
      zoom(1);
    }
    else
    if (!command.compare("ZoomOut", Qt::CaseInsensitive))
    {
      zoom(-1);
    }
    else
    if (command.startsWith("SetMode ", Qt::CaseInsensitive))
    {
      setMode(command.mid(8));
    }
    else
    if (!command.compare("ServerVer", Qt::CaseInsensitive))
    {
      sendData(SK_SERVER_VERSION);
    }
    else
    if (!command.compare("SwVer", Qt::CaseInsensitive))
    {
      sendData(SK_VERSION);
    }
    else
    if (command.startsWith("SetExtFrame ", Qt::CaseInsensitive))
    {
      setExtFrame(command.mid(11));
    }
    else
    if (!command.compare("GetExtFrame", Qt::CaseInsensitive))
    {
      getExtFrame();
    }
    else
    if (command.startsWith("SetRTC ", Qt::CaseInsensitive))
    {
      setRTC(command.mid(7));
    }
    else
    if (!command.compare("GetRTC", Qt::CaseInsensitive))
    {
      getRTC();
    }
    else
    if (!command.compare("Redraw", Qt::CaseInsensitive))
    {
      m_mainWin->getView()->repaintMap();
      sendData(SKS_OK);
    }
    else
    {
      sendData(SKS_UNKNOWN);
    }
  }
}