本文整理汇总了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;
}
}
示例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 );
}
示例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 ) ) );
}