~ubuntu-branches/ubuntu/saucy/merkaartor/saucy

« back to all changes in this revision

Viewing changes to plugins/background/MYahooBackground/tilemapadapter.h

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2009-09-13 00:52:12 UTC
  • mto: (1.2.7 upstream) (0.1.3 upstream) (3.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090913005212-pjecal8zxm07x0fj
ImportĀ upstreamĀ versionĀ 0.14+svnfixes~20090912

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2007 by Kai Winter   *
 
3
 *   kaiwinter@gmx.de   *
 
4
 *                                                                         *
 
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.                                   *
 
9
 *                                                                         *
 
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.                          *
 
14
 *                                                                         *
 
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
 
22
 
 
23
#include "mapadapter.h"
 
24
//! MapAdapter for servers with image tiles
 
25
/*!
 
26
 * Use this derived MapAdapter to display maps from OpenStreetMap
 
27
 *      @author Kai Winter <kaiwinter@gmx.de>
 
28
*/
 
29
class TileMapAdapter : public MapAdapter
 
30
{
 
31
public:
 
32
        //! constructor
 
33
        /*!
 
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
 
43
         */
 
44
        TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 17);
 
45
        
 
46
        virtual ~TileMapAdapter();
 
47
        
 
48
        virtual QPoint          coordinateToDisplay(const QPointF&) const;
 
49
        virtual QPointF         displayToCoordinate(const QPoint&) const;
 
50
        
 
51
        double PI;
 
52
        
 
53
        virtual void zoom_in();
 
54
        virtual void zoom_out();
 
55
 
 
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 ""; }
 
59
 
 
60
        virtual bool isTiled() const { return true; }
 
61
        virtual QString projection() const { return ("EPSG:3785"); }
 
62
 
 
63
protected:
 
64
        double rad_deg(double) const;
 
65
        double deg_rad(double) const;
 
66
        
 
67
        virtual int tilesonzoomlevel(int zoomlevel) const;
 
68
        virtual int getxoffset(int x) const;
 
69
        virtual int getyoffset(int y) const;
 
70
};
 
71
 
 
72
#endif