1 /**********************************************************************************************
2     Copyright (C) 2014 Oliver Eichler <oliver.eichler@gmx.de>
3 
4     This program is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 
17 **********************************************************************************************/
18 
19 #ifndef CMAPTMS_H
20 #define CMAPTMS_H
21 
22 #include "map/IMapOnline.h"
23 
24 class CDiskCache;
25 class QListWidgetItem;
26 class QNetworkAccessManager;
27 class QNetworkReply;
28 
29 class CMapTMS : public IMapOnline
30 {
31     Q_OBJECT
32 public:
33     CMapTMS(const QString& filename, CMapDraw* parent);
~CMapTMS()34     virtual ~CMapTMS() {}
35 
36     void draw(IDrawContext::buffer_t& buf) override;
37 
38     void getLayers(QListWidget& list) override;
39 
40     void saveConfig(QSettings& cfg) override;
41     void loadConfig(QSettings& cfg) override;
42 
43 private slots:
44     void slotLayersChanged(QListWidgetItem* item);
45 
46 private:
47     struct layer_t;
48     QString createUrl(const layer_t& layer, int x, int y, int z);
49 
50     struct layer_t
51     {
layer_tlayer_t52         layer_t() : enabled(true), minZoomLevel(0), maxZoomLevel(0)
53         {
54         }
55         bool enabled;
56         qint32 minZoomLevel;
57         qint32 maxZoomLevel;
58         QString title;
59         QString strUrl;
60         QString script;
61     };
62 
63     QVector<layer_t> layers;
64 
65     qint32 minZoomLevel = 1;
66     qint32 maxZoomLevel = 21;
67 };
68 
69 #endif //CMAPTMS_H
70 
71