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
#ifndef WMSMAPADAPTER_H
27
#define WMSMAPADAPTER_H
28
 
29
#include "mapadapter.h"
30
 
31
namespace qmapcontrol
32
{
33
    //! MapAdapter for WMS servers
34
    /*!
35
     * Use this derived MapAdapter to display maps from WMS servers
36
     *  @author Kai Winter <kaiwinter@gmx.de>
37
     */
38
    class WMSMapAdapter : public MapAdapter
39
    {
40
    public:
41
        //! constructor
42
        /*!
43
         * Sample of a correct initialization of a MapAdapter:<br/>
44
         * MapAdapter* mapadapter = new WMSMapAdapter("www2.demis.nl", "/wms/wms.asp?wms=WorldMap[...]&BBOX=%1,%2,%3,%4&WIDTH=%5&HEIGHT=%5&TRANSPARENT=TRUE", 256);<br/>
45
         * The placeholders %1, %2, %3, %4 creates the bounding box, %5 is for the tilesize
46
         * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max)
47
         * @param host The servers URL
48
         * @param serverPath The path to the tiles with placeholders
49
         * @param tilesize the size of the tiles
50
         */
51
        WMSMapAdapter(QString host, QString serverPath, int tilesize = 256);
52
        virtual ~WMSMapAdapter();
53
 
54
        virtual QPoint coordinateToDisplay(const QPointF&) const;
55
        virtual QPointF displayToCoordinate(const QPoint&) const;
56
 
57
    protected:
58
        virtual void zoom_in();
59
        virtual void zoom_out();
60
        virtual QString query(int x, int y, int z) const;
61
        virtual bool isValid(int x, int y, int z) const;
62
 
63
    private:
64
        virtual QString getQ(qreal ux, qreal uy, qreal ox, qreal oy) const;
65
 
66
        qreal coord_per_x_tile;
67
        qreal coord_per_y_tile;
68
    };
69
}
70
#endif