Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
305 KeyOz 1
/*
2
*
3
* This file is part of QMapControl,
4
* an open-source cross-platform map widget
5
*
6
* Copyright (C) 2007 - 2008 Kai Winter
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program 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
16
* GNU Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
20
*
21
* Contact e-mail: kaiwinter@gmx.de
22
* Program URL   : http://qmapcontrol.sourceforge.net/
23
*
24
*/
25
 
26
#include "yahoomapadapter.h"
27
namespace qmapcontrol
28
{
29
    YahooMapAdapter::YahooMapAdapter()
30
        : TileMapAdapter("png.maps.yimg.com", "/png?v=3.1.0&x=%2&y=%3&z=%1", 256, 17,0)
31
    {
32
        int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom;
33
        numberOfTiles = pow(2, zoom+1);
34
    }
35
    YahooMapAdapter::YahooMapAdapter(QString host, QString url)
36
        : TileMapAdapter(host, url, 256, 17,0)
37
    {
38
        int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom;
39
        numberOfTiles = pow(2, zoom+1);
40
    }
41
    YahooMapAdapter::~YahooMapAdapter()
42
    {
43
    }
44
 
45
    bool YahooMapAdapter::isValid(int /*x*/, int /*y*/, int /*z*/) const
46
    {
47
        return true;
48
    }
49
 
50
    int YahooMapAdapter::tilesonzoomlevel(int zoomlevel) const
51
    {
52
        return int(pow(2, zoomlevel+1));
53
    }
54
 
55
    int YahooMapAdapter::yoffset(int y) const
56
    {
57
        int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom;
58
 
59
        int tiles = int(pow(2, zoom));
60
        y = y*(-1)+tiles-1;
61
        return int(y);
62
    }
63
}