mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-09 02:31:14 +00:00
Make static functions and self reference for helper
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
import PIL.Image
|
import PIL.Image
|
||||||
|
|
||||||
class MapHelper(object):
|
class MapHelper(object):
|
||||||
def __init__(self):
|
|
||||||
return
|
|
||||||
|
|
||||||
def new_image(self, width, height):
|
@staticmethod
|
||||||
|
def new_image(width, height):
|
||||||
return PIL.Image.new('RGBA', (width, height))
|
return PIL.Image.new('RGBA', (width, height))
|
||||||
|
|
||||||
def fast_round(self, value, precision):
|
@staticmethod
|
||||||
|
def fast_round(value, precision):
|
||||||
return int(value * 10 ** precision) / 10. ** precision
|
return int(value * 10 ** precision) / 10. ** precision
|
||||||
|
|
||||||
def pixels_to_degrees(self, pixels, zoom):
|
@staticmethod
|
||||||
|
def pixels_to_degrees(pixels, zoom):
|
||||||
return pixels * 2 ** (21-zoom)
|
return pixels * 2 ** (21-zoom)
|
||||||
@@ -55,7 +55,7 @@ class GMapsStitcher(object):
|
|||||||
def __init__(self, width, height,
|
def __init__(self, width, height,
|
||||||
latitude, longitude, zoom,
|
latitude, longitude, zoom,
|
||||||
maptype, radius_meters=None, num_tiles=4, debug=False):
|
maptype, radius_meters=None, num_tiles=4, debug=False):
|
||||||
helper = MapHelper.MapHelper()
|
self.helper = MapHelper.MapHelper()
|
||||||
self.latitude = latitude
|
self.latitude = latitude
|
||||||
self.longitude = longitude
|
self.longitude = longitude
|
||||||
self.start_latitude = latitude
|
self.start_latitude = latitude
|
||||||
@@ -66,8 +66,9 @@ class GMapsStitcher(object):
|
|||||||
self.maptype = maptype
|
self.maptype = maptype
|
||||||
self.radius_meters = radius_meters
|
self.radius_meters = radius_meters
|
||||||
self.num_tiles = num_tiles
|
self.num_tiles = num_tiles
|
||||||
self.display_image = helper.new_image(width, height)
|
self.display_image = self.helper.new_image(width, height)
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
|
|
||||||
# Get the big image here
|
# Get the big image here
|
||||||
self._fetch()
|
self._fetch()
|
||||||
|
|||||||
Reference in New Issue
Block a user