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 ) ); }
void PostalCodeModel::getAdditionalItems( const GeoDataLatLonAltBox& box, const MarbleModel *model, qint32 number ) { Q_UNUSED( number ); if( model->planetId() != "earth" ) { return; } double const lat = box.center().latitude( GeoDataCoordinates::Degree ); double const lon = box.center().longitude( GeoDataCoordinates::Degree ); double const radius = qMin<double>( 30.0, box.height() * model->planet()->radius() * METER2KM ); QUrl geonamesUrl( "http://ws.geonames.org/findNearbyPostalCodesJSON" ); geonamesUrl.addQueryItem( "lat", QString::number( lat ) ); geonamesUrl.addQueryItem( "lng", QString::number( lon ) ); geonamesUrl.addQueryItem( "radius", QString::number( radius ) ); geonamesUrl.addQueryItem( "maxRows", QString::number( numberOfItemsOnScreen ) ); downloadDescriptionFile( QUrl( geonamesUrl ) ); }
bool ViewportParams::resolves ( const GeoDataLatLonAltBox &latLonAltBox ) const { return latLonAltBox.width() + latLonAltBox.height() > 2.0 * angularResolution() || latLonAltBox.maxAltitude() - latLonAltBox.minAltitude() > 10000; }