Added some documentation
authorjaviplx <javiplx@gmail.com>
Mon, 16 May 2011 08:26:52 +0000 (08:26 +0000)
committerjaviplx <javiplx@gmail.com>
Mon, 16 May 2011 08:26:52 +0000 (08:26 +0000)
git-svn-id: file:///svnroot/wifihood/branches/mapview-redesign@196 c51dfc6a-5949-4919-9c8e-f207a149c383

view.py

diff --git a/view.py b/view.py
index 1444b8d..f9ce2fa 100755 (executable)
--- a/view.py
+++ b/view.py
@@ -9,6 +9,17 @@ import math
 import os
 
 class background_map ( gtk.gdk.Pixmap ) :
+    """Pixmap to hold a background map big enough for screen size
+The minimal pixmap is calculated to hold an integer number of tiles as large
+as required to cover the requested screen size. The number of tiles is rounded
+up to an odd number, to clearly know which one is the central tile.
+Although not strictly required for visualization, a tiles border is added,
+whose primary purpose is to keep elements drawn in the pixmap when they get
+scrolled out, to get better visualization if they are later scrolled in.
+The object also stores a reference pixel that can be retrieved with method
+get_viewport(), and gives the topleft/base pixel to extract the viewable
+area (the reference pixel is actually encapsulated in the inner tile loader).
+"""
 
     def __init__ ( self , map_size , tileloader ) :
         bordersize = 1
@@ -36,6 +47,7 @@ class background_map ( gtk.gdk.Pixmap ) :
     def index ( self , x , y ) :
         return x + y * self.size[0]
 
+    # FIXME : This implementation does not account for the requested screen size, so don't give the right pixel
     def get_viewport ( self ) :
         refpix = self.tileloader.get_refpix()
         return self.__vport_base[0] + refpix[0] , self.__vport_base[1] + refpix[1]