Remove unused method composeMap svn/mapview-redesign
authorJavier Palacios <javiplx@gmail.com>
Fri, 2 Nov 2012 15:08:31 +0000 (16:08 +0100)
committerJavier Palacios <javiplx@gmail.com>
Fri, 2 Nov 2012 15:08:31 +0000 (16:08 +0100)
view.py

diff --git a/view.py b/view.py
index 29dc86c..cc236af 100755 (executable)
--- a/view.py
+++ b/view.py
@@ -223,7 +223,7 @@ class AbstractmapWidget :
             self.reftile_x , self.refpix_x = self.lon2tilex( self.conf.lon , self.conf.zoom )
             self.reftile_y , self.refpix_y = self.lat2tiley( self.conf.lat , self.conf.zoom )
 
-            self.composeMap()
+            self.update_background(True)
 
   def tilex2lon ( self , ( tilex , pixx ) , zoom ) :
         tilex = float(tilex)
@@ -243,7 +243,7 @@ class AbstractmapWidget :
         self.reftile_x , self.refpix_x = self.lon2tilex( lon , zoom )
         self.reftile_y , self.refpix_y = self.lat2tiley( lat , zoom )
         self.conf.set_zoom( zoom )
-        self.composeMap()
+        self.update_background(True)
         self.show()
 
   def lon2tilex ( self , lon , zoom ) :
@@ -308,7 +308,9 @@ class simpleMapWidget ( AbstractmapWidget , gtk.Image ) :
 
         self.update_background()
     
-    def update_background( self ) :
+    def update_background( self , reload=False ) :
+        if reload :
+            self._bg.reload( self.conf )
         vport = self._bg.get_viewport()
         self.reftile_x , self.reftile_y = self._bg.tileloader.get_reftile()
         p = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, self.win_x , self.win_y )
@@ -331,56 +333,6 @@ class simpleMapWidget ( AbstractmapWidget , gtk.Image ) :
         self._bg.reload( self.config )
         self.update_background()
 
-    def composeMap( self ) :
-        center_x , center_y = self.center()
-
-        # Ranges should be long enough as to fill the screen
-        # Maybe they should be decided based on self.win_x, self.win_y
-        for i in range(-3,4) :
-            for j in range(-3,4) :
-                file = self.tilename( i , j , self.conf.zoom )
-                if file is None :
-                    pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, self.tile_size, self.tile_size )
-                    pixbuf.fill( 0x00000000 )
-                else :
-                    try :
-                        pixbuf = gtk.gdk.pixbuf_new_from_file( file )
-                    except gobject.GError , ex :
-                        print "Corrupted file %s" % ( file )
-                        os.unlink( file )
-                        #file = self.tilename( self.reftile_x + i , self.reftile_y + j , self.conf.zoom )
-                        file = self.tilename( i , j , self.conf.zoom )
-                        try :
-                            pixbuf = gtk.gdk.pixbuf_new_from_file( file )
-                        except :
-                            print "Total failure for tile for %s,%s" % ( self.reftile_x + i , self.reftile_y + j )
-                            pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, self.tile_size, self.tile_size )
-
-                dest_x = self.tile_size * i + center_x
-                dest_y = self.tile_size * j + center_y
-
-                init_x = 0
-                size_x = self.tile_size
-                if dest_x < 0 :
-                   init_x = abs(dest_x)
-                   size_x = self.tile_size + dest_x
-                   dest_x = 0
-                if dest_x + self.tile_size > self.win_x :
-                   size_x = self.win_x - dest_x
-    
-                init_y = 0
-                size_y = self.tile_size
-                if dest_y < 0 :
-                   init_y = abs(dest_y)
-                   size_y = self.tile_size + dest_y
-                   dest_y = 0
-                if dest_y + self.tile_size > self.win_y :
-                   size_y = self.win_y - dest_y
-
-                if ( size_x > 0 and size_y > 0 ) and ( init_x < self.tile_size and init_y < self.tile_size ) :
-                    pixbuf.copy_area( init_x, init_y, size_x, size_y, self.get_pixbuf(), dest_x , dest_y )
-                del(pixbuf)
-
     def center( self ) :
 
         vport = self._bg.get_vport_base()