File indexing completed on 2024-04-28 03:50:29

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0005 //
0006 
0007 #include "GosmoreRoutingPlugin.h"
0008 #include "GosmoreRoutingRunner.h"
0009 #include "MarbleDirs.h"
0010 
0011 #include <QDir>
0012 #include <QFileInfo>
0013 
0014 namespace Marble
0015 {
0016 
0017 GosmorePlugin::GosmorePlugin( QObject *parent ) :
0018     RoutingRunnerPlugin( parent )
0019 {
0020     setSupportedCelestialBodies(QStringList(QStringLiteral("earth")));
0021     setCanWorkOffline( true );
0022 }
0023 
0024 QString GosmorePlugin::name() const
0025 {
0026     return tr( "Gosmore Routing" );
0027 }
0028 
0029 QString GosmorePlugin::guiString() const
0030 {
0031     return tr( "Gosmore" );
0032 }
0033 
0034 QString GosmorePlugin::nameId() const
0035 {
0036     return QStringLiteral("gosmore-routing");
0037 }
0038 
0039 QString GosmorePlugin::version() const
0040 {
0041     return QStringLiteral("1.0");
0042 }
0043 
0044 QString GosmorePlugin::description() const
0045 {
0046     return tr( "Offline route retrieval using Gosmore" );
0047 }
0048 
0049 QString GosmorePlugin::copyrightYears() const
0050 {
0051     return QStringLiteral("2010, 2012");
0052 }
0053 
0054 QVector<PluginAuthor> GosmorePlugin::pluginAuthors() const
0055 {
0056     return QVector<PluginAuthor>()
0057             << PluginAuthor(QStringLiteral("Dennis Nienhüser"), QStringLiteral("nienhueser@kde.org"))
0058             << PluginAuthor(QStringLiteral("Bernhard Beschow"), QStringLiteral("bbeschow@cs.tu-berlin.de"));
0059 }
0060 
0061 RoutingRunner *GosmorePlugin::newRunner() const
0062 {
0063     return new GosmoreRunner;
0064 }
0065 
0066 bool GosmorePlugin::canWork() const
0067 {
0068     QDir mapDir(MarbleDirs::localPath() + QLatin1String("/maps/earth/gosmore/"));
0069     QFileInfo mapFile = QFileInfo ( mapDir, "gosmore.pak" );
0070     return mapFile.exists();
0071 }
0072 
0073 bool GosmorePlugin::supportsTemplate( RoutingProfilesModel::ProfileTemplate profileTemplate ) const
0074 {
0075     return profileTemplate == RoutingProfilesModel::CarFastestTemplate;
0076 }
0077 
0078 }
0079 
0080 #include "moc_GosmoreRoutingPlugin.cpp"