Marble

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

KDE's Doxygen guidelines are available online.