REFACTORING : separate methods required on interactive maps
authorjaviplx <javiplx@gmail.com>
Sun, 1 May 2011 11:53:32 +0000 (11:53 +0000)
committerjaviplx <javiplx@gmail.com>
Sun, 1 May 2011 11:53:32 +0000 (11:53 +0000)
git-svn-id: file:///svnroot/wifihood/branches/cleaning@99 c51dfc6a-5949-4919-9c8e-f207a149c383

wifimap/view.py

index 8ec989a..6353744 100755 (executable)
@@ -31,17 +31,6 @@ class AbstractmapWidget :
     number = math.modf( ( 1 - math.log( math.tan( lat ) + 1 / math.cos( lat ) ) / math.pi ) / 2 * 2 ** zoom )
     return int( number[1] ) , int( self.tile_size * number[0] )
 
-  def tilex2lon ( self , ( tilex , pixx ) , zoom ) :
-    tilex = float(tilex)
-    pixx = float(pixx)
-    return ( tilex + pixx/self.tile_size ) / 2.0 ** zoom * 360.0 - 180.0
-
-  def tiley2lat ( self , ( tiley , pixy ) , zoom ) :
-    tiley = float(tiley)
-    pixy = float(pixy)
-    tiley = math.pi * ( 1 - 2 * ( tiley + pixy/self.tile_size ) / 2.0 ** zoom )
-    return math.degrees( math.atan( math.sinh( tiley ) ) )
-
   def gps2pix ( self , ( lat , lon ) , ( center_x , center_y ) ) :
 
     x_pos = self.lon2tilex( lon , self.conf.zoom )
@@ -82,6 +71,19 @@ class AbstractmapWidget :
       os.mkdir(rootsubdir)
     return "%s/%s.png" % ( rootsubdir , tiley )
 
+class interactiveMapWidget :
+
+  def tilex2lon ( self , ( tilex , pixx ) , zoom ) :
+    tilex = float(tilex)
+    pixx = float(pixx)
+    return ( tilex + pixx/self.tile_size ) / 2.0 ** zoom * 360.0 - 180.0
+
+  def tiley2lat ( self , ( tiley , pixy ) , zoom ) :
+    tiley = float(tiley)
+    pixy = float(pixy)
+    tiley = math.pi * ( 1 - 2 * ( tiley + pixy/self.tile_size ) / 2.0 ** zoom )
+    return math.degrees( math.atan( math.sinh( tiley ) ) )
+
   def Shift( self , dx , dy ) :
     self.hide()