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_DATABASEQUERY_H
0008 #define MARBLE_DATABASEQUERY_H
0009 
0010 #include "GeoDataCoordinates.h"
0011 #include "OsmPlacemark.h"
0012 
0013 #include <QString>
0014 
0015 namespace Marble {
0016 
0017 class MarbleModel;
0018 class GeoDataLatLonBox;
0019 
0020 /**
0021   * Parse result of a user's search term
0022   */
0023 class DatabaseQuery
0024 {
0025 public:
0026     enum QueryType { 
0027         AddressSearch,  /// precise search for an address
0028         CategorySearch, /// search which contains a poi category
0029         BroadSearch     /// any other non specific search
0030     };
0031 
0032     enum ResultFormat {
0033         AddressFormat, /// display results with location information
0034         DistanceFormat /// display results with distance information
0035     };
0036 
0037     DatabaseQuery( const MarbleModel* model, const QString &searchTerm, const GeoDataLatLonBox &preferred );
0038 
0039     QueryType queryType() const;
0040 
0041     ResultFormat resultFormat() const;
0042 
0043     QString street() const;
0044 
0045     QString houseNumber() const;
0046 
0047     QString region() const;
0048 
0049     QString searchTerm() const;
0050 
0051     OsmPlacemark::OsmCategory category() const;
0052 
0053     GeoDataCoordinates position() const;
0054 
0055 private:
0056     bool isPointOfInterest( const QString &category );
0057 
0058     QueryType m_queryType;
0059     ResultFormat m_resultFormat;
0060 
0061     QString m_street;
0062     QString m_houseNumber;
0063     QString m_region;
0064 
0065     QString m_searchTerm;
0066 
0067     GeoDataCoordinates m_position;
0068 
0069     OsmPlacemark::OsmCategory m_category;
0070 };
0071 
0072 }
0073 
0074 #endif // MARBLE_DATABASEQUERY_H