mail[Wesnoth-commits] r37017 - in /website/stats.wesnoth.org: map_tiler.py wesstats/templates/killview.html


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by cornmander on July 19, 2009 - 05:11:
Author: cornmander
Date: Sun Jul 19 05:11:00 2009
New Revision: 37017

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37017&view=rev
Log:
Added zoom level support to the map tiler and to the google map. Still need 
to create a tileserver on the web backend so that non-existent 
tile locations can correctly be served up with black tiles


Modified:
    website/stats.wesnoth.org/map_tiler.py
    website/stats.wesnoth.org/wesstats/templates/killview.html

Modified: website/stats.wesnoth.org/map_tiler.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/map_tiler.py?rev=37017&r1=37016&r2=37017&view=diff
==============================================================================
--- website/stats.wesnoth.org/map_tiler.py (original)
+++ website/stats.wesnoth.org/map_tiler.py Sun Jul 19 05:11:00 2009
@@ -22,11 +22,16 @@
                width = im.size[0]
                height = im.size[1]
                filename_base = infile[0:len(infile)-3]
+               #generate fine zoom level, level 4
                for i in range(0,width/256):
                        for j in range(0,height/256):
-                               tile = Image.new(im.mode,(256,256))
                                tile_src = 
im.crop((i*256,j*256,(i+1)*256,(j+1)*256))
-                               tile.paste(tile_src,(0,0,256,256))
-                               tile.save("%s%d_%d.png" % 
(filename_base,i,j),"PNG")
+                               tile_src.save("%s%d_%d_4.png" % 
(filename_base,i,j),"PNG")
+               #generate coarse zoom level, level 3
+               for i in range(0,width/1024):
+                       for j in range(0,height/1024):
+                               tile_src = 
im.crop((i*1024,j*1024,(i+1)*1024,(j+1)*1024))
+                               tile_src = tile_src.resize((256,256))
+                               tile_src.save("%s%d_%d_3.png" % 
(filename_base,i,j),"PNG")
        except IOError:
                print IOError

Modified: website/stats.wesnoth.org/wesstats/templates/killview.html
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/templates/killview.html?rev=37017&r1=37016&r2=37017&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/templates/killview.html (original)
+++ website/stats.wesnoth.org/wesstats/templates/killview.html Sun Jul 19 
05:11:00 2009
@@ -11,7 +11,7 @@
 
    See the COPYING file for more details.
 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <!-- 
ABQIAAAAwlLuIjoG2_E7xGXPjpNRyRTY1qbTKsNyhuhE_ljh2mJHrFJMJRQgNuWe_yAXHi-7Ny4aJ3btOcCGnQ
 //google maps api key for http://cornmander.com -->
 <html xmlns:py="http://genshi.edgewall.org/"; 
xmlns="http://www.w3.org/1999/xhtml";>
 <head>
@@ -30,12 +30,20 @@
                                copyright.addCopyright(new 
GCopyright('test',new GLatLngBounds(new GLatLng(-90,-180), new 
GLatLng(90,180)) ,0,'Wesnoth Project'));
                                
                                var tilelayer = new GTileLayer(copyright);
-                               tilelayer.getTileUrl = function() { return 
"/wesstats/images/test_map.png"; };
+                               tilelayer.getTileUrl = function(tile,zoom) { 
console.info(tile.x); console.info(tile.y); return 
"/wesstats/images/test_map."+tile.x+"_"+tile.y+"_"+zoom+".png"; };
                                tilelayer.isPng = function() { return true; };
                                tilelayer.getOpacity = function() { return 
1.0; };
                                
                                var mytiles = new 
GTileLayerOverlay(tilelayer);
                                map.addOverlay(mytiles);
+                       
+                               var minMapScale = 3;
+                               var maxMapScale = 4;
+                               var mapTypes = map.getMapTypes();
+                               for (var i=0; mapTypes.length - i != 0; i++) 
{ <!-- genshi doesnt like the less than sign... -->
+                                       mapTypes[i].getMinimumResolution = 
function() { return minMapScale; }
+                                       mapTypes[i].getMaximumResolution = 
function() { return maxMapScale; }
+                               }
                        }
                }
        </script>




Related Messages


Powered by MHonArc, Updated Sun Jul 19 09:20:55 2009