libosmscout 1.1.1
Loading...
Searching...
No Matches
LocationEntry.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_LOCATIONENTRY_H
2#define OSMSCOUT_CLIENT_QT_LOCATIONENTRY_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2014 Tim Teulings
7 Copyright (C) 2016 Lukáš Karas
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <QObject>
25#include <QStringList>
26
27#include <osmscout/GeoCoord.h>
28
32
33#include <osmscoutclient/LocationInfo.h>
34#include <osmscoutclient/AdminRegionInfo.h>
35
37
38namespace osmscout {
39
47{
48 Q_OBJECT
49 Q_PROPERTY(QString label READ getLabel CONSTANT)
50 Q_PROPERTY(QString altName READ getAltName CONSTANT)
51 Q_PROPERTY(QString type READ getTypeString CONSTANT)
52 Q_PROPERTY(QString objectType READ getObjectType CONSTANT)
53 Q_PROPERTY(double lat READ getLat CONSTANT)
54 Q_PROPERTY(double lon READ getLon CONSTANT)
55
56private:
57 LocationInfo::Type type;
58 QString label;
59 QString altName; // name in alternative language
60 QString objectType;
61 QList<AdminRegionInfoRef> adminRegionList;
62 QString database;
63 QList<osmscout::ObjectFileRef> references;
64 osmscout::GeoCoord coord;
65 osmscout::GeoBox bbox;
66
67public:
68 LocationEntry(LocationInfo::Type type,
69 const QString& label,
70 const QString& altName,
71 const QString& objectType,
72 const QList<AdminRegionInfoRef>& adminRegionList,
73 const QString database,
74 const osmscout::GeoCoord coord,
75 const osmscout::GeoBox bbox,
76 QObject* parent = nullptr);
77
78 LocationEntry(const QString& label,
79 const osmscout::GeoCoord& coord,
80 QObject* parent = nullptr);
81
82 explicit LocationEntry(const LocationInfo &info);
83
84 explicit LocationEntry(QObject* parent = nullptr);
85
90
91 ~LocationEntry() override = default;
92
94 LocationEntry& operator=(const LocationEntry& other);
96 LocationEntry& operator=(LocationEntry&& other);
97
98 void addReference(const osmscout::ObjectFileRef reference);
99
100 void mergeWith(const LocationEntry &location);
101
102 Q_INVOKABLE double distanceTo(double lat, double lon) const;
103
104 LocationInfo::Type getType() const;
105 QString getTypeString() const;
106 QString getObjectType() const;
107 QString getLabel() const;
108 QString getDebugString() const;
109 QString getAltName() const;
110 QList<AdminRegionInfoRef> getAdminRegionList() const;
111 QString getDatabase() const;
112 osmscout::GeoCoord getCoord() const;
113 osmscout::GeoBox getBBox() const;
114 const QList<osmscout::ObjectFileRef>& getReferences() const;
115 double getLat() const;
116 double getLon() const;
117};
118
119using LocationEntryRef = std::shared_ptr<LocationEntry>;
120
121}
122
123Q_DECLARE_METATYPE(osmscout::LocationEntryRef)
124
125#endif
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Definition LocationEntry.h:47
osmscout::GeoBox getBBox() const
LocationInfo::Type getType() const
double getLat() const
double lat
Definition LocationEntry.h:53
const QList< osmscout::ObjectFileRef > & getReferences() const
QString getTypeString() const
QString getDatabase() const
osmscout::GeoCoord getCoord() const
QString getDebugString() const
QString label
Definition LocationEntry.h:49
void addReference(const osmscout::ObjectFileRef reference)
double lon
Definition LocationEntry.h:54
QString type
Definition LocationEntry.h:51
QString getAltName() const
Q_INVOKABLE double distanceTo(double lat, double lon) const
QString altName
Definition LocationEntry.h:50
LocationEntry(LocationInfo::Type type, const QString &label, const QString &altName, const QString &objectType, const QList< AdminRegionInfoRef > &adminRegionList, const QString database, const osmscout::GeoCoord coord, const osmscout::GeoBox bbox, QObject *parent=nullptr)
void mergeWith(const LocationEntry &location)
QString getLabel() const
QString getObjectType() const
QList< AdminRegionInfoRef > getAdminRegionList() const
double getLon() const
QString objectType
Definition LocationEntry.h:52
Definition Area.h:39
std::shared_ptr< LocationEntry > LocationEntryRef
Definition LocationEntry.h:119
STL namespace.