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


C++ GeoDataLatLonAltBox::contains方法代码示例

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


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

示例1: work

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

示例2: 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

示例3: testContains

void TestGeoDataLatLonAltBox::testContains()
{
    GeoDataLatLonAltBox const largeBox = GeoDataLatLonAltBox::fromLineString( GeoDataLineString()
            << GeoDataCoordinates( -20.0, +10.0, 15.0, GeoDataCoordinates::Degree )
            << GeoDataCoordinates( +20.0, -10.0, 25.0, GeoDataCoordinates::Degree ) );
    GeoDataLatLonAltBox const smallBox = GeoDataLatLonAltBox::fromLineString( GeoDataLineString()
            << GeoDataCoordinates( -2.0, +1.0, 18.0, GeoDataCoordinates::Degree )
            << GeoDataCoordinates( +2.0, -1.0, 22.0, GeoDataCoordinates::Degree ) );

    QVERIFY( largeBox.contains( GeoDataCoordinates( 5.0, 5.0, 20.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( largeBox.contains( smallBox ) );
    QVERIFY( largeBox.contains( largeBox ) );
    QVERIFY( !smallBox.contains( largeBox ) );
    QVERIFY(  smallBox.contains( GeoDataCoordinates(    0.0,   0.0, 20.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates(   5.0,   5.0, 30.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates(   5.0,   5.0, 10.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates(  35.0,   5.0, 20.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates( -35.0,   5.0, 20.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates(   5.0,  35.0, 20.0, GeoDataCoordinates::Degree ) ) );
    QVERIFY( !largeBox.contains( GeoDataCoordinates(   5.0, -35.0, 20.0, GeoDataCoordinates::Degree ) ) );
}
开发者ID:Earthwings,项目名称:marble,代码行数:21,代码来源:TestGeoDataLatLonAltBox.cpp


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