libosmscout  1.1.1
OnlineTileProvider.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_CLIENT_QT_ONLINETILEPROVIDER_H
2 #define OSMSCOUT_CLIENT_QT_ONLINETILEPROVIDER_H
3 
4 /*
5  OSMScout - a Qt backend for libosmscout and libosmscout-map
6  Copyright (C) 2016 Lukas Karas
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22 
23 #include <QObject>
24 #include <QDebug>
25 
26 #include <QJsonDocument>
27 #include <QJsonArray>
28 #include <QJsonObject>
29 
31 
32 namespace osmscout {
33 
40 {
41  Q_OBJECT
42 
43 public:
44  OnlineTileProvider() = default;
45 
47  QObject(o.parent()),
48  valid(o.valid), id(o.id), name(o.name), servers(o.servers),
49  maximumZoomLevel(o.maximumZoomLevel), copyright(o.copyright){};
50 
51  inline OnlineTileProvider(const QString &id, const QString &name, const QStringList &servers, int maximumZoomLevel,
52  QString copyright):
53  valid(true), id(id), name(name), servers(servers), maximumZoomLevel(maximumZoomLevel),
54  copyright(copyright){};
55 
56  ~OnlineTileProvider() override = default;
57 
59  {
60  valid = o.valid;
61  id = o.id;
62  name = o.name;
63  servers = o.servers;
64  maximumZoomLevel = o.maximumZoomLevel;
65  copyright = o.copyright;
66 
67  return *this;
68  }
69 
70  inline QString getId() const {
71  return id;
72  }
73 
74  inline int getMaximumZoomLevel() const {
75  return maximumZoomLevel;
76  }
77 
78  inline QString getName() const {
79  return name;
80  }
81 
82  inline QStringList getServers() const {
83  return servers;
84  }
85 
86  inline bool isValid() const {
87  return valid;
88  }
89 
90  QString getCopyright() const
91  {
92  return copyright;
93  }
94 
95  static OnlineTileProvider fromJson(QJsonValue obj);
96 
97 private:
98  bool valid{false};
99  QString id;
100  QString name;
101  QStringList servers;
102  int maximumZoomLevel{-1};
103  QString copyright;
104 };
105 
106 }
107 
108 #endif /* OSMSCOUT_CLIENT_QT_ONLINETILEPROVIDER_H */
Definition: OnlineTileProvider.h:39
OnlineTileProvider(const OnlineTileProvider &o)
Definition: OnlineTileProvider.h:46
#define OSMSCOUT_CLIENT_QT_API
Definition: ClientQtImportExport.h:45
QStringList getServers() const
Definition: OnlineTileProvider.h:82
QString getId() const
Definition: OnlineTileProvider.h:70
QString getName() const
Definition: OnlineTileProvider.h:78
Definition: Area.h:38
bool isValid() const
Definition: OnlineTileProvider.h:86
QString getCopyright() const
Definition: OnlineTileProvider.h:90
int getMaximumZoomLevel() const
Definition: OnlineTileProvider.h:74
OnlineTileProvider(const QString &id, const QString &name, const QStringList &servers, int maximumZoomLevel, QString copyright)
Definition: OnlineTileProvider.h:51
OnlineTileProvider & operator=(const OnlineTileProvider &o)
Definition: OnlineTileProvider.h:58