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

« back to all changes in this revision

Viewing changes to src/QMapControl/wmsmapadapter.cpp

  • 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
#include "wmsmapadapter.h"
 
21
 
 
22
WMSMapAdapter::WMSMapAdapter(WmsServer aServer)
 
23
 : theServer(aServer)
 
24
{
 
25
        loc = QLocale(QLocale::English);
 
26
        loc.setNumberOptions(QLocale::OmitGroupSeparator);
 
27
}
 
28
 
 
29
QString WMSMapAdapter::getName() const
 
30
{
 
31
        return theServer.WmsName;
 
32
}
 
33
 
 
34
QString WMSMapAdapter::getHost() const
 
35
{
 
36
        return theServer.WmsAdress;
 
37
}
 
38
 
 
39
IImageManager* WMSMapAdapter::getImageManager()
 
40
{
 
41
        return theImageManager;
 
42
}
 
43
 
 
44
void WMSMapAdapter::setImageManager(IImageManager* anImageManager)
 
45
{
 
46
        theImageManager = anImageManager;
 
47
}
 
48
 
 
49
QString WMSMapAdapter::projection() const
 
50
{
 
51
        return theServer.WmsProjections;
 
52
}
 
53
 
 
54
WMSMapAdapter::~WMSMapAdapter()
 
55
{
 
56
}
 
57
 
 
58
QUuid WMSMapAdapter::getId() const
 
59
{
 
60
        return QUuid("{E238750A-AC27-429e-995C-A60C17B9A1E0}");
 
61
}
 
62
 
 
63
IMapAdapter::Type WMSMapAdapter::getType() const
 
64
{
 
65
        return IMapAdapter::DirectBackground;
 
66
}
 
67
 
 
68
QString WMSMapAdapter::getQuery(const QRectF& /*wgs84Bbox*/, const QRectF& projBbox, const QRect& size) const
 
69
{
 
70
        return QString()
 
71
                                                .append(theServer.WmsPath)
 
72
                                                .append("SERVICE=WMS")
 
73
                                                .append("&VERSION=1.1.1")
 
74
                                                .append("&REQUEST=GetMap")
 
75
                                                .append("&TRANSPARENT=TRUE")
 
76
                                                .append("&LAYERS=").append(theServer.WmsLayers)
 
77
                                                .append("&SRS=").append(theServer.WmsProjections)
 
78
                                                .append("&STYLES=").append(theServer.WmsStyles)
 
79
                                                .append("&FORMAT=").append(theServer.WmsImgFormat)
 
80
                                                .append("&WIDTH=").append(QString::number(size.width()))
 
81
                                                .append("&HEIGHT=").append(QString::number(size.height()))
 
82
                                                .append("&BBOX=")
 
83
                                                .append(loc.toString(projBbox.bottomLeft().x(),'f',6)).append(",")
 
84
                                                 .append(loc.toString(projBbox.bottomLeft().y(),'f',6)).append(",")
 
85
                                                 .append(loc.toString(projBbox.topRight().x(),'f',6)).append(",")
 
86
                                                 .append(loc.toString(projBbox.topRight().y(),'f',6))
 
87
                                                 ;
 
88
}