本文整理汇总了C++中GeoDataLatLonAltBox::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataLatLonAltBox::isEmpty方法的具体用法?C++ GeoDataLatLonAltBox::isEmpty怎么用?C++ GeoDataLatLonAltBox::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataLatLonAltBox
的用法示例。
在下文中一共展示了GeoDataLatLonAltBox::isEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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();
}
示例3: latLonAltBox
GeoDataLatLonAltBox GeoDataContainer::latLonAltBox() const
{
Q_D(const GeoDataContainer);
GeoDataLatLonAltBox result;
QVector<GeoDataFeature*>::const_iterator it = d->m_vector.constBegin();
QVector<GeoDataFeature*>::const_iterator end = d->m_vector.constEnd();
for (; it != end; ++it) {
// Get all the placemarks from GeoDataContainer
if ( (*it)->nodeType() == GeoDataTypes::GeoDataPlacemarkType ) {
GeoDataPlacemark *placemark = static_cast<GeoDataPlacemark*>(*it);
// Only use visible placemarks for extracting their latLonAltBox and
// making an union with the global latLonAltBox Marble will fit its
// zoom to
if (placemark->isVisible())
{
if (result.isEmpty()) {
result = placemark->geometry()->latLonAltBox();
} else {
result |= placemark->geometry()->latLonAltBox();
}
}
}
else if ( (*it)->nodeType() == GeoDataTypes::GeoDataFolderType
|| (*it)->nodeType() == GeoDataTypes::GeoDataDocumentType ) {
GeoDataContainer *container = static_cast<GeoDataContainer*>(*it);
if (result.isEmpty()) {
result = container->latLonAltBox();
} else {
result |= container->latLonAltBox();
}
}
}
return result;
}
示例4: latLonAltBox
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;
}
示例5: testDefaultConstruction
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 ) );
}