File indexing completed on 2024-07-14 14:25:04

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0005 //
0006 
0007 #ifndef MARBLE_OSMDATABASE_H
0008 #define MARBLE_OSMDATABASE_H
0009 
0010 #include "OsmPlacemark.h"
0011 
0012 #include <QString>
0013 #include <QStringList>
0014 
0015 namespace Marble {
0016 
0017 class DatabaseQuery;
0018 class GeoDataCoordinates;
0019 
0020 class OsmDatabase
0021 {
0022 public:
0023     explicit OsmDatabase( const QStringList &databaseFiles );
0024 
0025     // Methods for read access
0026 
0027     /** Search the database for matching regions and placemarks */
0028     QVector<OsmPlacemark> find( const DatabaseQuery &userQuery );
0029 
0030 private:
0031     static QString wildcardQuery( const QString &term );
0032 
0033     static void makeUnique( QVector<OsmPlacemark> &placemarks );
0034 
0035     QStringList m_databaseFiles;
0036 
0037     static QString formatDistance( const GeoDataCoordinates &a, const GeoDataCoordinates &b );
0038 
0039     static qreal bearing( const GeoDataCoordinates &a, const GeoDataCoordinates &b );
0040 
0041     Q_DISABLE_COPY( OsmDatabase )
0042 };
0043 
0044 }
0045 
0046 #endif // MARBLE_OSMDATABASE_H