Example #1
0
unsigned long TAddrClient::getLastTimestamp() {

    unsigned long ts = 0;
    SPtr<TAddrIA> ptr;

    IAsLst.first();
    while ( ptr = IAsLst.get() ) {
        if (ts < ptr->getTimestamp())
            ts = ptr->getTimestamp();
    }

    firstTA();
    while ( ptr = getTA() ) {
        if (ts < ptr->getTimestamp())
            ts = ptr->getTimestamp();
    }


    PDLst.first();
    while ( ptr = PDLst.get() ) {
        if (ts > ptr->getTimestamp())
            ts = ptr->getTimestamp();
    }
    
    return ts;
}
Example #2
0
float PolarDiagram::getTA(const float & speed, const float & angle){
    if(!contains(speed)){
        int i = 0;
        // List of ALL the speeds avilable in de diagram
        // given in ASC order
        QList<float> speeds = diagram.keys();

        while(speeds.at(i) < speed && i < speeds.size() - 1)
            ++i;

        float ta;

        // input speed is bigger than any available
        if(i == speeds.size() - 1)
            ta = getTA(speeds.last(), angle);
        // input speed is smaller than any available
        else if(i == 0)
            ta = getTA(speeds.first(), angle);
        // input speed is between other available speeds
        else
            ta = (getTA(speeds.at(i - 1), angle) + getTA(speeds.at(i), angle)) / 2;

        return ta;
    }

    // input speed is contained in our diagram
    Angles aux = getAngles(speed);

    // List of available angles for this speed
    // List is in ASC order
    QList<float> angles = aux.keys();

    int i = 0;

    while(angles.at(i) < angle && i < angles.size() - 1)
        ++i;

    // input angle is bigger than any available
    if(i == angles.size() - 1)
        return aux.value(angles.last());
    // input angle is smaller than any available
    else if(i == 0)
        return aux.value(angles.first());
    // input angle is between other available angles
    else
        return (aux.value(angles.at(i - 1)) + aux.value(angles.at(i))) / 2;
}