Пример #1
0
bool GeoDataLatLonAltBox::intersects( const GeoDataLatLonAltBox &other ) const
{
            // Case 1: maximum altitude of other box intersects:
    if (    ( d->m_maxAltitude >= other.maxAltitude() && d->m_minAltitude <= other.maxAltitude() )
            // Case 2: maximum altitude of this box intersects:
         || ( other.maxAltitude() >= d->m_maxAltitude && other.minAltitude() <= d->m_maxAltitude )
            // Case 3: minimum altitude of other box intersects:
         || ( d->m_maxAltitude >= other.minAltitude() && d->m_minAltitude <= other.minAltitude() ) 
            // Case 4: minimum altitude of this box intersects:
         || ( other.maxAltitude() >= d->m_minAltitude && other.minAltitude() <= d->m_minAltitude ) ) {

        if ( GeoDataLatLonBox::intersects( other ) )
            return true;

    }

    return false;
}
Пример #2
0
void TestGeoDataLatLonAltBox::testAltitude() 
{
    QFETCH(qreal, alt);

    GeoDataLatLonAltBox box;
    box.setMinAltitude(alt);
    QCOMPARE(box.minAltitude(), alt);

    box.setMaxAltitude(alt);
    QCOMPARE(box.maxAltitude(), alt);
}
Пример #3
0
bool GeoDataLatLonAltBox::contains( const GeoDataLatLonAltBox &other ) const
{
    // check the contain criterion for the altitude first as this is trivial:

    // mDebug() << "this " << this->toString(GeoDataCoordinates::Degree);
    // mDebug() << "other" << other.toString(GeoDataCoordinates::Degree);

    if ( d->m_maxAltitude >= other.maxAltitude() && d->m_minAltitude <= other.minAltitude() ) {
        return GeoDataLatLonBox::contains( other );
    }

    return false;
}
Пример #4
0
void TestGeoDataLatLonAltBox::testPack() {
    QFETCH(GeoDataCoordinates, coordinates);

    GeoDataLatLonAltBox const original = GeoDataLatLonAltBox(coordinates);

    QBuffer buffer;
    bool const isOpenForWriting = buffer.open(QBuffer::WriteOnly);

    QVERIFY(isOpenForWriting);

    QDataStream out(&buffer);
    original.pack(out);
    buffer.close();

    bool const isOpenForReading = buffer.open(QBuffer::ReadOnly);

    QVERIFY(isOpenForReading);

    QDataStream in(&buffer);

    GeoDataLatLonAltBox unpacked;
    unpacked.unpack(in);

    buffer.close();

#if 0
    QCOMPARE(unpacked.north(), original.north());
    QCOMPARE(unpacked.south(), original.south());
    QCOMPARE(unpacked.east(), original.east());
    QCOMPARE(unpacked.west(), original.west());
#endif

    QCOMPARE(unpacked.maxAltitude(), original.maxAltitude());
    QCOMPARE(unpacked.minAltitude(), original.minAltitude());
    QCOMPARE(unpacked.altitudeMode(), original.altitudeMode());
}
Пример #5
0
void TestGeoDataLatLonAltBox::testDefaultConstruction()
{
    GeoDataLatLonBox const latLonBox;

    QCOMPARE( latLonBox.north(), 0.0 );
    QCOMPARE( latLonBox.south(), 0.0 );
    QCOMPARE( latLonBox.east(), 0.0 );
    QCOMPARE( latLonBox.west(), 0.0 );
    QCOMPARE( latLonBox.rotation(), 0.0 );
    QCOMPARE( latLonBox.width(), 0.0 );
    QCOMPARE( latLonBox.height(), 0.0 );
    QVERIFY( !latLonBox.crossesDateLine() );
    QCOMPARE( latLonBox.center(), GeoDataCoordinates( 0, 0 ) );
    QVERIFY( latLonBox.isNull() );
    QVERIFY( latLonBox.isEmpty() );

    QVERIFY( (latLonBox|latLonBox).isNull() );
    QVERIFY( (latLonBox|latLonBox).isEmpty() );
    QVERIFY( !latLonBox.intersects( latLonBox ) );


    GeoDataLatLonAltBox const latLonAltBox;

    QCOMPARE( latLonAltBox.north(), 0.0 );
    QCOMPARE( latLonAltBox.south(), 0.0 );
    QCOMPARE( latLonAltBox.east(), 0.0 );
    QCOMPARE( latLonAltBox.west(), 0.0 );
    QCOMPARE( latLonAltBox.rotation(), 0.0 );
    QCOMPARE( latLonAltBox.width(), 0.0 );
    QCOMPARE( latLonAltBox.height(), 0.0 );
    QVERIFY( !latLonAltBox.crossesDateLine() );
    QCOMPARE( latLonAltBox.center(), GeoDataCoordinates( 0, 0, 0 ) );
    QVERIFY( latLonAltBox.isNull() );
    QVERIFY( latLonAltBox.isEmpty() );
    QCOMPARE( latLonAltBox.minAltitude(), 0.0 );
    QCOMPARE( latLonAltBox.maxAltitude(), 0.0 );
    QCOMPARE( latLonAltBox.altitudeMode(), ClampToGround );

    QVERIFY( (latLonAltBox|latLonAltBox).isNull() );
    QVERIFY( (latLonAltBox|latLonAltBox).isEmpty() );
    QVERIFY( !latLonAltBox.intersects( latLonAltBox ) );
}
Пример #6
0
bool ViewportParams::resolves ( const GeoDataLatLonAltBox &latLonAltBox ) const
{
    return    latLonAltBox.width() + latLonAltBox.height() > 2.0 * angularResolution()
           || latLonAltBox.maxAltitude() - latLonAltBox.minAltitude() > 10000;
           
}