File gmaps.diff of Package merkaartor
Index: Custom.pri
===================================================================
--- Custom.pri (revision 13159)
+++ Custom.pri (working copy)
@@ -0,0 +1 @@
+DEFINES += GOOGLE_ILLEGAL
Index: gmap.html
===================================================================
--- gmap.html (revision 0)
+++ gmap.html (revision 0)
@@ -0,0 +1,62 @@
+<html>
+ <head>
+ <script type="text/javascript">
+ // Parse query string and set variables
+ var url = location.href;
+
+ var queryStringPos = url.indexOf("?");
+ if( queryStringPos != -1 )
+ {
+ url = url.substring(queryStringPos + 1);
+ var variables = url.split ("&");
+ for (i = 0; i < variables.length; i++)
+ {
+ if( !variables[i] )
+ continue;
+ var keyValue = variables[i].split("=");
+ eval ('var '+keyValue[0].toLowerCase()+'="'+keyValue[1]+'"');
+ }
+ }
+ else
+ {
+ dump("GMAP ERROR: no queryString\n");
+ }
+ </script>
+ <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA7YYzBQmyxt8WNKD2NqSUWRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRGTqRreYB2Chvc3b39K-9SmxOylg";></script>
+ </head>
+
+ <body style="margin: 0px">
+ <div id="map" style="width: 512px; height: 512px"></div>
+ <script type="text/javascript">
+ if( !bbox || !width || !height)
+ {
+ alert("GM ERROR: invalid parameters\n");
+ }
+ else
+ {
+ var coords = bbox.split(",");
+
+ var Psw = new GLatLng( Number(coords[3]), Number(coords[0]) ),
+ Pne = new GLatLng( Number(coords[1]), Number(coords[2]) );
+ var bounds = new GLatLngBounds(Psw,Pne);
+
+
+ var map = new GMap2(document.getElementById("map"));
+ map.setMapType(G_SATELLITE_MAP);
+ map.setCenter( bounds.getCenter(), map.getBoundsZoomLevel(bounds));
+
+ alert("Size 0 0 512 512\n");
+
+ window.moveTo(0,0);
+ window.resizeTo(512,512);
+
+// var cPT2 = new GLatLng(coords[1], coords[0]);
+// var cPT3 = new GLatLng(coords[1], coords[2]);
+// var cPT4 = new GLatLng(coords[3], coords[2]);
+// var cPT5 = new GLatLng(coords[3], coords[0]);
+// var polyline = new GPolyline([cPT2,cPT3,cPT4,cPT5,cPT2], "#ff0000",2 );
+// map.addOverlay(polyline);
+ }
+ </script>
+ </body>
+</html>
Index: Icons/AllIcons.qrc
===================================================================
Index: QMapControl/googlesatmapadapter.cpp
===================================================================
--- QMapControl/googlesatmapadapter.cpp (revision 0)
+++ QMapControl/googlesatmapadapter.cpp (revision 0)
@@ -0,0 +1,86 @@
+/***************************************************************************
+ * Copyright (C) 2008, 2009 by Chris Browet, Aleksandar Topuzovic *
+ * c...@semperpax.com, aleksandar.topuzo...@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "googlesatmapadapter.h"
+
+GoogleSatMapAdapter::GoogleSatMapAdapter()
+: TileMapAdapter("", "qrc:/Html/gmap.html?", 512, 17, 0)
+{
+ int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom;
+ numberOfTiles = pow(2, zoom+1.0);
+}
+
+
+GoogleSatMapAdapter::~GoogleSatMapAdapter()
+{
+}
+
+bool GoogleSatMapAdapter::isValid(int /* x */, int /* y */, int /* z */) const
+{
+ return true;
+}
+
+//bool GoogleSatMapAdapter::isValid(int x, int y, int z) const
+//{
+// if (x<0 || y<0 || z<0)
+// return false;
+//
+// if ( (((x+1)*coord_per_x_tile) > 360) || (((y+1)*coord_per_y_tile) > 180) )
+// return false;
+//
+// return true;
+//}
+
+int GoogleSatMapAdapter::tilesonzoomlevel(int zoomlevel) const
+{
+ return int(pow(2, zoomlevel+1.0));
+}
+
+QString GoogleSatMapAdapter::getQuery(int i, int j, int /* z */) const
+{
+ QPointF ul = displayToCoordinate(QPoint(i*tilesize, j*tilesize));
+ QPointF br = displayToCoordinate(QPoint((i+1)*tilesize, (j+1)*tilesize));
+ return getQ(ul, br);
+}
+QString GoogleSatMapAdapter::getQ(QPointF ul, QPointF br) const
+{
+ return QString().append(serverPath)
+ .append("WIDTH=").append(QString().setNum(tilesize))
+ .append("&HEIGHT=").append(QString().setNum(tilesize))
+ .append("&BBOX=")
+ .append(loc.toString(ul.x(),'f',6)).append(",")
+ .append(loc.toString(ul.y(),'f',6)).append(",")
+ .append(loc.toString(br.x(),'f',6)).append(",")
+ .append(loc.toString(br.y(),'f',6));
+}
+
+int GoogleSatMapAdapter::getyoffset(int y) const
+{
+ int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom;
+
+ int tiles = int(pow(2, zoom+0.0));
+ y = y*(-1)+tiles-1;
+ return int(y);
+}
+
+IImageManager* GoogleSatMapAdapter::getImageManager()
+{
+ return BrowserImageManager::instance();
+}
+
Index: QMapControl/googlesatmapadapter.h
===================================================================
--- QMapControl/googlesatmapadapter.h (revision 0)
+++ QMapControl/googlesatmapadapter.h (revision 0)
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2008, 2009 by Chris Browet, Aleksandar Topuzovic *
+ * c...@semperpax.com, aleksandar.topuzo...@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef GOOGLESATMAPADAPTER_H
+#define GOOGLESATMAPADAPTER_H
+
+#include "tilemapadapter.h"
+
+#include "browserimagemanager.h"
+
+//! MapAdapter for WMS servers
+/*!
+ * Use this derived MapAdapter to display maps from WMS servers
+ * @author Kai Winter <kaiwin...@gmx.de>
+*/
+class GoogleSatMapAdapter : public TileMapAdapter
+{
+ Q_OBJECT
+ public:
+ //! constructor
+ /*!
+ * This constructs a Google Adapter
+ */
+ GoogleSatMapAdapter();
+ GoogleSatMapAdapter(QString host, QString url);
+ virtual ~GoogleSatMapAdapter();
+ bool isValid(int x, int y, int z) const;
+ IImageManager* getImageManager();
+
+ protected:
+ virtual QString getQuery(int x, int y, int z) const;
+ virtual int tilesonzoomlevel(int zoomlevel) const;
+ virtual int getyoffset(int y) const;
+
+ private:
+ virtual QString getQ(QPointF ul, QPointF br) const;
+
+};
+
+#endif
diff -u -r ../merkaartor-0.12.orig//Icons/AllIcons.qrc ./Icons/AllIcons.qrc
--- ../merkaartor-0.12.orig//Icons/AllIcons.qrc 2009-02-11 03:47:49.000000000 +0100
+++ ./Icons/AllIcons.qrc 2009-02-11 03:48:37.000000000 +0100
@@ -330,6 +330,7 @@
</qresource>
<qresource prefix="/Html">
<file alias="ymap.html">../ymap.html</file>
+ <file alias="gmap.html">../gmap.html</file>
</qresource>
<qresource prefix="/Gps">
<file alias="Gps_Marker.svg">Gps_Marker.svg</file>
--- Merkaartor.pro.orig 2009-04-26 22:13:19.000000000 +0200
+++ Merkaartor.pro 2009-04-26 22:28:22.000000000 +0200
@@ -154,8 +154,8 @@
# SOURCES += QMapControl/browserimagemanagerthreaded.cpp
# HEADERS += QMapControl/browserimagemanagerthreaded.h
# }
- SOURCES += QMapControl/yahoolegalmapadapter.cpp
- HEADERS += QMapControl/yahoolegalmapadapter.h
+ SOURCES += QMapControl/yahoolegalmapadapter.cpp QMapControl/googlesatmapadapter.cpp
+ HEADERS += QMapControl/yahoolegalmapadapter.h QMapControl/googlesatmapadapter.h
QT += webkit
}
}