mail[Wesnoth-commits] r37093 - in /website/stats.wesnoth.org: map_tiler.py wesstats/controllers/root.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 20, 2009 - 08:57:
Author: cornmander
Date: Mon Jul 20 08:57:13 2009
New Revision: 37093

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37093&view=rev
Log:
Fixed scaling bug in map tiler, updated GMap code to use a black background 
for nice effect


Modified:
    website/stats.wesnoth.org/map_tiler.py
    website/stats.wesnoth.org/wesstats/controllers/root.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=37093&r1=37092&r2=37093&view=diff
==============================================================================
--- website/stats.wesnoth.org/map_tiler.py (original)
+++ website/stats.wesnoth.org/map_tiler.py Mon Jul 20 08:57:13 2009
@@ -5,6 +5,9 @@
 
 def multiple_256(n):
        return n + (256 - (n%256))
+
+def multiple_1024(n):
+       return n + (1024 - (n%1024))
 
 for infile in sys.argv[1:]:
        try:
@@ -27,6 +30,18 @@
                        for j in range(0,height/256):
                                tile_src = 
im.crop((i*256,j*256,(i+1)*256,(j+1)*256))
                                tile_src.save("%s%d_%d_4.png" % 
(filename_base,i,j),"PNG")
+               
+               #pad width and height to the nearest multiples of 1024
+               img_width = im.size[0]
+               img_height = im.size[1]
+               img_width_r = multiple_1024(img_width)  
+               img_height_r = multiple_1024(img_height)        
+               im_resized = Image.new(im.mode,(img_width_r,img_height_r))
+               im_resized.paste(im,(0,0,img_width,img_height))
+               im = im_resized
+               width = im.size[0]
+               height = im.size[1]
+
                #generate coarse zoom level, level 3
                for i in range(0,width/1024):
                        for j in range(0,height/1024):

Modified: website/stats.wesnoth.org/wesstats/controllers/root.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/controllers/root.py?rev=37093&r1=37092&r2=37093&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/controllers/root.py (original)
+++ website/stats.wesnoth.org/wesstats/controllers/root.py Mon Jul 20 
08:57:13 2009
@@ -27,6 +27,7 @@
 from wesstats.controllers.barview import BarGraphController
 from wesstats.controllers.lineview import LineGraphController
 from wesstats.controllers.killview import KillGraphController
+from wesstats.controllers.tileserver import TileServerController
 
 __all__ = ['RootController']
 
@@ -66,6 +67,8 @@
        
        @expose()
        def lookup(self,url,*remainder):
+               if url == "servetile":
+                       return TileServerController(), remainder        
                #check if view exists
                conn = 
MySQLdb.connect(configuration.DB_HOSTNAME,configuration.DB_USERNAME,configuration.DB_PASSWORD,configuration.DB_NAME,use_unicode=True)
                curs = conn.cursor()

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=37093&r1=37092&r2=37093&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/templates/killview.html (original)
+++ website/stats.wesnoth.org/wesstats/templates/killview.html Mon Jul 20 
08:57:13 2009
@@ -34,7 +34,7 @@
                
                                var wmap_type = new GMapType( [tilelayer], 
new GMercatorProjection(18), "KillMap", {errorMessage:"No data"});
                                
-                               var map = new 
GMap2(document.getElementById("map_canvas"),{mapTypes:[wmap_type]});
+                               var map = new 
GMap2(document.getElementById("map_canvas"),{mapTypes:[wmap_type],backgroundColor:"#000000"});
                                map.setCenter(new GLatLng(80, -135), 3, 
wmap_type);
                                map.addControl(new GLargeMapControl());
                        }




Related Messages


Powered by MHonArc, Updated Mon Jul 20 10:21:10 2009