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 "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
20namespace Marble
21{
22
23SearchTask::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
34void SearchTask::run()
35{
36 m_runner->search( m_searchTerm, m_preferredBbox );
37 m_runner->deleteLater();
38
39 emit finished( this );
40}
41
42ReverseGeocodingTask::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
60RoutingTask::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
77ParsingTask::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.
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:87
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.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
T qobject_cast(QObject *object)
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 Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.