File indexing completed on 2024-07-14 10:58:40

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com>
0004 
0005 #include "LatLonRunner.h"
0006 
0007 #include "GeoDataPlacemark.h"
0008 #include "GeoDataCoordinates.h"
0009 
0010 #include "MarbleDebug.h"
0011 #include <QVector>
0012 
0013 #include <QtDebug>
0014 
0015 namespace Marble
0016 {
0017 
0018 LatLonRunner::LatLonRunner(QObject *parent) :
0019     SearchRunner(parent)
0020 {
0021 }
0022 
0023 
0024 LatLonRunner::~LatLonRunner()
0025 {
0026 }
0027 
0028 void LatLonRunner::search( const QString &searchTerm, const GeoDataLatLonBox & )
0029 {
0030     QVector<GeoDataPlacemark*> vector;
0031 
0032     bool successful = false;
0033     const GeoDataCoordinates coord = GeoDataCoordinates::fromString( searchTerm, successful );
0034 
0035     if( successful ) {
0036         GeoDataPlacemark *placemark = new GeoDataPlacemark;
0037         placemark->setName( searchTerm );
0038         qreal lon, lat;
0039         coord.geoCoordinates( lon, lat );
0040         placemark->setCoordinate( lon, lat );
0041         placemark->setVisualCategory(GeoDataPlacemark::Coordinate);
0042         placemark->setPopularity( 1000000000 );
0043         placemark->setZoomLevel( 1 );
0044         vector.append( placemark );
0045     }
0046 
0047     emit searchFinished( vector );
0048 }
0049 
0050 }
0051 
0052 #include "moc_LatLonRunner.cpp"