当前位置: 首页>>代码示例>>C++>>正文


C++ GeoDataLatLonAltBox类代码示例

本文整理汇总了C++中GeoDataLatLonAltBox的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataLatLonAltBox类的具体用法?C++ GeoDataLatLonAltBox怎么用?C++ GeoDataLatLonAltBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GeoDataLatLonAltBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: randomLon

void GeoDataLatLonAltBoxTest::fromLineStringTest()
{
    qreal west = randomLon();
    qreal east = randomLon();
    qreal lat1 = randomLat();
    qreal lat2 = randomLat();
    GeoDataLatLonAltBox sourceBox;

    if ( lat1 >= lat2 ) {
        sourceBox = GeoDataLatLonBox( lat1, lat2, east, west, GeoDataCoordinates::Degree );
    }
    else {
        sourceBox = GeoDataLatLonBox( lat2, lat1, east, west, GeoDataCoordinates::Degree );
    }

    GeoDataLinearRing ring;
    // SouthWest
    ring << GeoDataCoordinates( sourceBox.west(), sourceBox.south() );
    // SouthEast
    ring << GeoDataCoordinates( sourceBox.east(), sourceBox.south() );
    // NorthEast
    ring << GeoDataCoordinates( sourceBox.east(), sourceBox.north() );
    // NorthWest
    ring << GeoDataCoordinates( sourceBox.west(), sourceBox.north() );

    QCOMPARE( GeoDataLatLonAltBox::fromLineString( ring ).toString(), sourceBox.toString() );

}
开发者ID:Earthwings,项目名称:marble,代码行数:28,代码来源:GeoDataLatLonAltBoxTest.cpp

示例2: getAdditionalItems

void OpenCachingComModel::getAdditionalItems( const GeoDataLatLonAltBox& box, qint32 number )
{
    if( marbleModel()->planetId() != "earth" )
    {
        return;
    }

    if ( m_previousbox.contains( box ) )
    {
        return;
    }

    QString url("http://www.opencaching.com/api/geocache/?Authorization=");
    url += AUTHKEY + QString("&bbox=%1,%2,%3,%4")
        .arg( box.south( GeoDataCoordinates::Degree ) )
        .arg( box.west(GeoDataCoordinates::Degree ) )
        .arg( box.north(GeoDataCoordinates::Degree ) )
        .arg( box.east(GeoDataCoordinates::Degree ) );
    if(!m_previousbox.isNull())
    {
        url += QString("&exclude_bbox=%1,%2,%3,%4")
            .arg( m_previousbox.south( GeoDataCoordinates::Degree ) )
            .arg( m_previousbox.west(GeoDataCoordinates::Degree ) )
            .arg( m_previousbox.north(GeoDataCoordinates::Degree ) )
            .arg( m_previousbox.east(GeoDataCoordinates::Degree ) );
    }
    url += "&limit=" + QString::number( number );
    // TODO Limit to user set tags/types/difficulty - when there is a config dialog...

    m_previousbox = box;

//     qDebug()<<"Fetching more caches: "<<url;
    downloadDescriptionFile( QUrl( url ) );
}
开发者ID:Earthwings,项目名称:marble,代码行数:34,代码来源:OpenCachingComModel.cpp

示例3: search

void OsmNominatimRunner::search( const QString &searchTerm, const GeoDataLatLonAltBox &preferred )
{    
    QString base = "http://nominatim.openstreetmap.org/search?";
    QString query = "q=%1&format=xml&addressdetails=1&accept-language=%2";
    QString url = QString(base + query).arg(searchTerm).arg(MarbleLocale::languageCode());
    if( !preferred.isEmpty() ) {
        GeoDataCoordinates::Unit deg = GeoDataCoordinates::Degree;
        QString viewbox( "&viewbox=%1,%2,%3,%4&bounded=1" ); // left, top, right, bottom
        url += viewbox.arg(preferred.west(deg))
                      .arg(preferred.north(deg))
                      .arg(preferred.east(deg))
                      .arg(preferred.south(deg));

    }
    m_request.setUrl(QUrl(url));
    m_request.setRawHeader("User-Agent", TinyWebBrowser::userAgent("Browser", "OsmNominatimRunner") );

    QEventLoop eventLoop;

    QTimer timer;
    timer.setSingleShot( true );
    timer.setInterval( 15000 );

    connect( &timer, SIGNAL(timeout()),
             &eventLoop, SLOT(quit()));
    connect( this, SIGNAL(searchFinished(QVector<GeoDataPlacemark*>)),
             &eventLoop, SLOT(quit()) );

    // @todo FIXME Must currently be done in the main thread, see bug 257376
    QTimer::singleShot( 0, this, SLOT(startSearch()) );
    timer.start();

    eventLoop.exec();
}
开发者ID:AsherBond,项目名称:marble,代码行数:34,代码来源:OsmNominatimSearchRunner.cpp

示例4: sleep

void BBCItemGetter::work()
{
    if ( m_items.isEmpty() ) {
        sleep( 1 );
        return;
    }

    m_scheduleMutex.lock();
    GeoDataLatLonAltBox box = m_scheduledBox;
    qint32 number = m_scheduledNumber;
    m_scheduledBox = GeoDataLatLonAltBox();
    m_scheduledNumber = 0;
    m_scheduleMutex.unlock();

    qint32 fetched = 0;
    QList<BBCStation>::ConstIterator it = m_items.constBegin();
    QList<BBCStation>::ConstIterator end = m_items.constEnd();

    while ( fetched < number && it != end ) {
        if ( box.contains( it->coordinate() ) ) {
            emit foundStation( (*it) );
            fetched++;
        }
        ++it;
    }
}
开发者ID:Earthwings,项目名称:marble,代码行数:26,代码来源:BBCItemGetter.cpp

示例5: search

void LocalDatabaseRunner::search( const QString &searchTerm, const GeoDataLatLonAltBox &preferred )
{
    QVector<GeoDataPlacemark*> vector;

    if (model()) {
        const QAbstractItemModel * placemarkModel = model()->placemarkModel();

        if (placemarkModel) {
            QModelIndexList resultList;
            QModelIndex firstIndex = placemarkModel->index( 0, 0 );
            resultList = placemarkModel->match( firstIndex,
                                    Qt::DisplayRole, searchTerm, -1,
                                    Qt::MatchStartsWith );

            foreach ( const QModelIndex& index, resultList )
            {
                if( !index.isValid() ) {
                    mDebug() << "invalid index!!!";
                    continue;
                }
                GeoDataPlacemark *placemark = dynamic_cast<GeoDataPlacemark*>(qvariant_cast<GeoDataObject*>( index.data( MarblePlacemarkModel::ObjectPointerRole )));
                if ( placemark &&
                     ( preferred.isEmpty() || preferred.contains( placemark->coordinate() ) ) ) {
                    vector.append( new GeoDataPlacemark( *placemark ));
                }
            }
        }
    }

    emit searchFinished( vector );
}
开发者ID:Earthwings,项目名称:marble,代码行数:31,代码来源:LocalDatabaseRunner.cpp

示例6: QFETCH

void TestGeoDataLatLonAltBox::testFromLineString() {
    QFETCH(GeoDataLineString, string);
    QFETCH(GeoDataLatLonBox, expected);

    GeoDataLatLonAltBox const result = GeoDataLatLonAltBox::fromLineString(string);

    QCOMPARE(result.north(), expected.north());
    QCOMPARE(result.south(), expected.south());
    QCOMPARE(result.east(), expected.east());
    QCOMPARE(result.west(), expected.west());
}
开发者ID:Earthwings,项目名称:marble,代码行数:11,代码来源:TestGeoDataLatLonAltBox.cpp

示例7: contains

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;
}
开发者ID:AndreiDuma,项目名称:marble,代码行数:13,代码来源:GeoDataLatLonAltBox.cpp

示例8: getAdditionalItems

void GeoNamesWeatherService::getAdditionalItems( const GeoDataLatLonAltBox& box,
                                            qint32 number )
{
    if( marbleModel()->planetId() != "earth" ) {
        return;
    }

    QUrl geonamesUrl( "http://ws.geonames.org/weatherJSON" );
#if QT_VERSION < 0x050000
    geonamesUrl.addQueryItem( "north", QString::number( box.north( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "south", QString::number( box.south( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "east", QString::number( box.east( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "west", QString::number( box.west( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "maxRows", QString::number( number ) );
    geonamesUrl.addQueryItem( "username", "marble" );
#else
    QUrlQuery urlQuery;
    urlQuery.addQueryItem( "north", QString::number( box.north( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "south", QString::number( box.south( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "east", QString::number( box.east( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "west", QString::number( box.west( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "maxRows", QString::number( number ) );
    urlQuery.addQueryItem( "username", "marble" );
    geonamesUrl.setQuery( urlQuery );
#endif

    emit downloadDescriptionFileRequested( geonamesUrl );
}
开发者ID:calincru,项目名称:marble,代码行数:28,代码来源:GeoNamesWeatherService.cpp

示例9: getAdditionalItems

void EarthquakeModel::getAdditionalItems( const GeoDataLatLonAltBox& box, qint32 number )
{
    if (marbleModel()->planetId() != QLatin1String("earth")) {
        return;
    }

    const QString geonamesUrl( QLatin1String("http://ws.geonames.org/earthquakesJSON") +
        QLatin1String("?north=")   + QString::number(box.north() * RAD2DEG) +
        QLatin1String("&south=")   + QString::number(box.south() * RAD2DEG) +
        QLatin1String("&east=")    + QString::number(box.east() * RAD2DEG) +
        QLatin1String("&west=")    + QString::number(box.west() * RAD2DEG) +
        QLatin1String("&date=")    + m_endDate.toString("yyyy-MM-dd") +
        QLatin1String("&maxRows=") + QString::number(number) +
        QLatin1String("&username=marble") +
        QLatin1String("&formatted=true"));
    downloadDescriptionFile( QUrl( geonamesUrl ) );
}
开发者ID:KDE,项目名称:marble,代码行数:17,代码来源:EarthquakeModel.cpp

示例10: getAdditionalItems

void GeoNamesWeatherService::getAdditionalItems( const GeoDataLatLonAltBox& box,
                                            const MarbleModel *model,
                                            qint32 number )
{
    if( model->planetId() != "earth" ) {
        return;
    }

    QUrl geonamesUrl( "http://ws.geonames.org/weatherJSON" );
    geonamesUrl.addQueryItem( "north", QString::number( box.north( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "south", QString::number( box.south( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "east", QString::number( box.east( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "west", QString::number( box.west( GeoDataCoordinates::Degree ) ) );
    geonamesUrl.addQueryItem( "maxRows", QString::number( number ) );

    emit downloadDescriptionFileRequested( geonamesUrl );
}
开发者ID:ashish173,项目名称:marble,代码行数:17,代码来源:GeoNamesWeatherService.cpp

示例11: getAdditionalItems

void FoursquareModel::getAdditionalItems( const GeoDataLatLonAltBox& box, qint32 number )
{
    if( marbleModel()->planetId() != "earth" ) {
        return;
    }
    
    QString clientId = "YPRWSYFW1RVL4PJQ2XS5G14RTOGTHOKZVHC1EP5KCCCYQPZF";
    QString clientSecret = "5L2JDCAYQCEJWY5FNDU4A1RWATE4E5FIIXXRM41YBTFSERUH";
    
    QString apiUrl( "https://api.foursquare.com/v2/venues/search" );
    qreal const distanceLon = marbleModel()->planetRadius() * distanceSphere( box.west(), box.north(), box.east(), box.north() );
    qreal const distanceLat = marbleModel()->planetRadius() * distanceSphere( box.west(), box.north(), box.west(), box.south() );
    qreal const area = distanceLon * distanceLat;
    if ( area > 10 * 1000 * KM2METER * KM2METER ) {
        // Large area (> 10.000 km^2) => too large for bbox queries
        apiUrl += "?ll=" + QString::number( box.center().latitude(Marble::GeoDataCoordinates::Degree) );
        apiUrl += ',' + QString::number( box.center().longitude(Marble::GeoDataCoordinates::Degree) );
        apiUrl += "&intent=checkin";
    } else {
        apiUrl += "?ne=" + QString::number( box.north(Marble::GeoDataCoordinates::Degree) );
        apiUrl += ',' + QString::number( box.east(Marble::GeoDataCoordinates::Degree) );
        apiUrl += "&sw=" + QString::number( box.south(Marble::GeoDataCoordinates::Degree) );
        apiUrl += ',' + QString::number( box.west(Marble::GeoDataCoordinates::Degree) );
        apiUrl += "&intent=browse";
    }
    apiUrl += "&limit=" + QString::number( number );
    apiUrl += "&client_id=" + clientId;
    apiUrl += "&client_secret=" + clientSecret;
    apiUrl += "&v=20120601";
    downloadDescriptionFile( QUrl( apiUrl ) );
}
开发者ID:Earthwings,项目名称:marble,代码行数:31,代码来源:FoursquareModel.cpp

示例12: getAdditionalItems

void OpenCachingModel::getAdditionalItems( const GeoDataLatLonAltBox& box, const MarbleModel *model, qint32 number )
{
    Q_UNUSED( number );

    if( model->planetId() != "earth" ) {
        return;
    }

    // http://www.opencaching.de/doc/xml/xml11.htm
    QString openCachingUrl( "http://www.opencaching.de/xml/ocxml11.php" );
    openCachingUrl += "?modifiedsince=" + m_startDate.toString( "yyyyMMddhhmmss" );
    openCachingUrl += "&cache=1&cachedesc=1&picture=0&cachelog=1&removedobject=0";
    openCachingUrl += "&lat=" + QString::number( box.center().latitude() * RAD2DEG );
    openCachingUrl += "&lon=" + QString::number( box.center().longitude() * RAD2DEG );
    openCachingUrl += "&distance=" + QString::number( m_maxDistance );
    openCachingUrl += "&charset=utf-8&cdata=0&session=0&zip=0";
    downloadDescriptionFile( QUrl( openCachingUrl ) );
}
开发者ID:MChemodanov,项目名称:marble,代码行数:18,代码来源:OpenCachingModel.cpp

示例13: p

GeoDataLatLonAltBox GeoDataMultiGeometry::latLonAltBox() const
{
    QVector<GeoDataGeometry*>::const_iterator it = p()->m_vector.constBegin();
    QVector<GeoDataGeometry*>::const_iterator end = p()->m_vector.constEnd();

    GeoDataLatLonAltBox box;
    for (; it != end; ++it) {
        if ( !(*it)->latLonAltBox().isEmpty() ) {
            if ( box.isEmpty() ) {
                box = (*it)->latLonAltBox();
            }
            else {
                box |= (*it)->latLonAltBox();
            }
        }
    }
    return box;
}
开发者ID:MChemodanov,项目名称:marble,代码行数:18,代码来源:GeoDataMultiGeometry.cpp

示例14: getAdditionalItems

void WikipediaModel::getAdditionalItems( const GeoDataLatLonAltBox& box,
                                         qint32 number )
{
    // Geonames only supports wikipedia articles for earth
    if (marbleModel()->planetId() != QLatin1String("earth")) {
        return;
    }
        
    QUrl geonamesUrl( "http://ws.geonames.org/wikipediaBoundingBox" );
    QUrlQuery urlQuery;
    urlQuery.addQueryItem( "north", QString::number( box.north( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "south", QString::number( box.south( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "east", QString::number( box.east( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "west", QString::number( box.west( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "maxRows", QString::number( number ) );
    urlQuery.addQueryItem( "lang", m_languageCode );
    urlQuery.addQueryItem( "username", "marble" );
    geonamesUrl.setQuery( urlQuery );

    downloadDescriptionFile( geonamesUrl );
}
开发者ID:KDE,项目名称:marble,代码行数:21,代码来源:WikipediaModel.cpp

示例15: getAdditionalItems

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 ) );
}
开发者ID:snowy97,项目名称:marble,代码行数:22,代码来源:PostalCodeModel.cpp


注:本文中的GeoDataLatLonAltBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。