Ejemplo n.º 1
0
void SatellitesMSCItem::update()
{
    if( m_missionStart.isValid() ) {
        setVisible( ( m_clock->dateTime() > m_missionStart ) );
    }

    if( m_missionEnd.isValid() ) {
        setVisible( ( m_clock->dateTime() < m_missionEnd ) );
    }

    if( !isEnabled() || !isVisible() ) {
        return;
    }

    double period = 24  * 3600 / m_n0;
    QDateTime startTime = m_clock->dateTime().addSecs( - period / 2. );
    QDateTime endTime = startTime.addSecs( period );

    m_track->removeBefore( startTime );
    m_track->removeAfter( endTime );

    double step = period / 500.;

    // FIXME update track only if orbit is visible
    for( double i = startTime.toTime_t(); i < endTime.toTime_t(); i += step ) {

        if ( i >= m_track->firstWhen().toTime_t() ) {
            i = m_track->lastWhen().toTime_t() + step;
        }

        addTrackPointAt( QDateTime::fromTime_t( i ) );
    }

    addTrackPointAt( m_clock->dateTime() );
}
Ejemplo n.º 2
0
void SatellitesMSCItem::update()
{
    if( m_missionStart.isValid() ) {
        setVisible( ( m_clock->dateTime() > m_missionStart ) );
    }

    if( m_missionEnd.isValid() ) {
        setVisible( ( m_clock->dateTime() < m_missionEnd ) );
    }

    if( !isEnabled() || !isVisible() ) {
        return;
    }

    QDateTime t = m_clock->dateTime();
    QDateTime endTime = t;
    if( isTrackVisible() ) {
        t = t.addSecs( - m_period / 2. );
        endTime = t.addSecs( m_period );

        m_track->removeBefore( t );
        m_track->removeAfter( endTime );

        if( m_track->firstWhen().isValid() && m_track->firstWhen() < t) {
            t = m_track->firstWhen().addSecs( m_step_secs );
        }

        for(; t < endTime; t = t.addSecs(m_step_secs)) {
            addTrackPointAt( t );
        }
    } else {
        m_track->clear();
    }

    addTrackPointAt( m_clock->dateTime() );
}