1
/***************************************************************************
2
* Copyright (C) 2007 by Kai Winter *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
20
#ifndef TILEMAPADAPTER_H
21
#define TILEMAPADAPTER_H
23
#include "mapadapter.h"
24
//! MapAdapter for servers with image tiles
26
* Use this derived MapAdapter to display maps from OpenStreetMap
27
* @author Kai Winter <kaiwinter@gmx.de>
29
class TileMapAdapter : public MapAdapter
34
* Sample of a correct initialization of a MapAdapter:<br/>
35
* TileMapAdapter* ta = new TileMapAdapter("192.168.8.1", "/img/img_cache.php/%1/%2/%3.png", 256, 0,17);<br/>
36
* The placeholders %1, %2, %3 stands for x, y, z<br/>
37
* The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max)
38
* @param host The servers URL
39
* @param serverPath The path to the tiles with placeholders
40
* @param tilesize the size of the tiles
41
* @param minZoom the minimum zoom level
42
* @param maxZoom the maximum zoom level
44
TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 17);
46
virtual ~TileMapAdapter();
48
virtual QPoint coordinateToDisplay(const QPointF&) const;
49
virtual QPointF displayToCoordinate(const QPoint&) const;
53
virtual void zoom_in();
54
virtual void zoom_out();
56
virtual bool isValid(int x, int y, int z) const;
57
virtual QString getQuery(int x, int y, int z) const;
58
virtual QString getQuery(const QRectF& , const QRect& ) const { return ""; }
60
virtual bool isTiled() const { return true; }
61
virtual QString projection() const { return ("EPSG:3785"); }
64
double rad_deg(double) const;
65
double deg_rad(double) const;
67
virtual int tilesonzoomlevel(int zoomlevel) const;
68
virtual int getxoffset(int x) const;
69
virtual int getyoffset(int y) const;