libosmscout  1.1.1
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 #include <osmscout/Location.h>
31 
33 
34 namespace osmscout {
35 
42 class OSMSCOUT_CLIENT_QT_API LocationEntry : public QObject
43 {
44  Q_OBJECT
45  Q_PROPERTY(QString label READ getLabel CONSTANT)
46  Q_PROPERTY(QString type READ getTypeString CONSTANT)
47  Q_PROPERTY(QString objectType READ getObjectType CONSTANT)
48  Q_PROPERTY(double lat READ getLat CONSTANT)
49  Q_PROPERTY(double lon READ getLon CONSTANT)
50 
51 public:
52  enum Type {
55  typeCoordinate
56  };
57 
58 private:
59  Type type;
60  QString label;
61  QString objectType;
62  QStringList adminRegionList;
63  QString database;
64  QList<osmscout::ObjectFileRef> references;
65  osmscout::GeoCoord coord;
66  osmscout::GeoBox bbox;
67 
68 public:
69  LocationEntry(Type type,
70  const QString& label,
71  const QString& objectType,
72  const QStringList& 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(QObject* parent = nullptr);
83 
88  LocationEntry(const LocationEntry& other);
89  ~LocationEntry() override = default;
90 
91  void operator=(const LocationEntry&);
92 
93  void addReference(const osmscout::ObjectFileRef reference);
94 
95  void mergeWith(const LocationEntry &location);
96 
97  Q_INVOKABLE double distanceTo(double lat, double lon) const;
98 
99  Type getType() const;
100  QString getTypeString() const;
101  QString getObjectType() const;
102  QString getLabel() const;
103  QStringList getAdminRegionList() const;
104  QString getDatabase() const;
105  osmscout::GeoCoord getCoord() const;
106  osmscout::GeoBox getBBox() const;
107  const QList<osmscout::ObjectFileRef>& getReferences() const;
108  double getLat() const;
109  double getLon() const;
110 };
111 
112 using LocationEntryRef = std::shared_ptr<LocationEntry>;
113 
114 }
115 
116 Q_DECLARE_METATYPE(osmscout::LocationEntryRef)
117 
118 #endif
#define OSMSCOUT_CLIENT_QT_API
Definition: ClientQtImportExport.h:45
std::shared_ptr< LocationEntry > LocationEntryRef
Definition: LocationEntry.h:112
Definition: LocationEntry.h:54
Definition: Area.h:38
Definition: LocationEntry.h:53
Definition: LocationEntry.h:42
Type
Definition: LocationEntry.h:52