Marble

RunnerTask.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <[email protected]>
4 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <[email protected]>
5 // SPDX-FileCopyrightText: 2012, 2013 Bernhard Beschow <[email protected]>
6 
7 #include "RunnerTask.h"
8 
9 #include "MarbleDebug.h"
10 #include "ParsingRunner.h"
11 #include "ParsingRunnerManager.h"
12 #include "SearchRunner.h"
13 #include "SearchRunnerManager.h"
14 #include "ReverseGeocodingRunner.h"
15 #include "ReverseGeocodingRunnerManager.h"
16 #include "RoutingRunner.h"
17 #include "RoutingRunnerManager.h"
18 #include "routing/RouteRequest.h"
19 
20 namespace Marble
21 {
22 
23 SearchTask::SearchTask( SearchRunner *runner, SearchRunnerManager *manager, const MarbleModel *model, const QString &searchTerm, const GeoDataLatLonBox &preferred ) :
24  QObject(),
25  m_runner( runner ),
26  m_searchTerm( searchTerm ),
27  m_preferredBbox( preferred )
28 {
29  connect( m_runner, SIGNAL(searchFinished(QVector<GeoDataPlacemark*>)),
30  manager, SLOT(addSearchResult(QVector<GeoDataPlacemark*>)) );
31  m_runner->setModel( model );
32 }
33 
35 {
36  m_runner->search( m_searchTerm, m_preferredBbox );
37  m_runner->deleteLater();
38 
39  emit finished( this );
40 }
41 
42 ReverseGeocodingTask::ReverseGeocodingTask( ReverseGeocodingRunner *runner, ReverseGeocodingRunnerManager *manager, const MarbleModel *model, const GeoDataCoordinates &coordinates ) :
43  QObject(),
44  m_runner( runner ),
45  m_coordinates( coordinates )
46 {
47  connect( m_runner, SIGNAL(reverseGeocodingFinished(GeoDataCoordinates,GeoDataPlacemark)),
48  manager, SLOT(addReverseGeocodingResult(GeoDataCoordinates,GeoDataPlacemark)) );
49  m_runner->setModel( model );
50 }
51 
53 {
54  m_runner->reverseGeocoding( m_coordinates );
55  m_runner->deleteLater();
56 
57  emit finished( this );
58 }
59 
60 RoutingTask::RoutingTask( RoutingRunner *runner, RoutingRunnerManager *manager, const RouteRequest* routeRequest ) :
61  QObject(),
62  m_runner( runner ),
63  m_routeRequest( routeRequest )
64 {
65  connect( m_runner, SIGNAL(routeCalculated(GeoDataDocument*)),
66  manager, SLOT(addRoutingResult(GeoDataDocument*)) );
67 }
68 
70 {
71  m_runner->retrieveRoute( m_routeRequest );
72  m_runner->deleteLater();
73 
74  emit finished( this );
75 }
76 
77 ParsingTask::ParsingTask( ParsingRunner *runner, ParsingRunnerManager *manager, const QString& fileName, DocumentRole role ) :
78  QObject(),
79  m_runner( runner ),
80  m_fileName( fileName ),
81  m_role( role ),
82  m_manager(manager)
83 {
84  connect(this, SIGNAL(parsed(GeoDataDocument*,QString)), m_manager, SLOT(addParsingResult(GeoDataDocument*,QString)));
85 }
86 
88 {
89  QString error;
90  GeoDataDocument* document = m_runner->parseFile( m_fileName, m_role, error );
91  emit parsed(document, error);
92  m_runner->deleteLater();
93  emit finished();
94 }
95 
96 }
97 
98 #include "moc_RunnerTask.cpp"
A 3d point representation.
void run() override
Definition: RunnerTask.cpp:69
void run() override
Definition: RunnerTask.cpp:34
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
A container for Features, Styles and in the future Schemas.
Binds a QML item to a specific geodetic location in screen coordinates.
a class representing a point of interest on the map
Points to be included in a route.
Definition: RouteRequest.h:26
void run() override
Definition: RunnerTask.cpp:87
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:86
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 03:59:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.