mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-09 10:41:15 +00:00
created docstrings for maphelper
This commit is contained in:
@@ -5,17 +5,37 @@ class MapHelper(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new_image(width, height):
|
def new_image(width, height):
|
||||||
|
"""
|
||||||
|
Generates a new image using PIL.Image module
|
||||||
|
|
||||||
|
returns PIL.IMAGE OBJECT
|
||||||
|
"""
|
||||||
return PIL.Image.new('RGBA', (width, height))
|
return PIL.Image.new('RGBA', (width, height))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fast_round(value, precision):
|
def fast_round(value, precision):
|
||||||
|
"""
|
||||||
|
Function to round values instead of using python's
|
||||||
|
|
||||||
|
return INT
|
||||||
|
"""
|
||||||
return int(value * 10 ** precision) / 10. ** precision
|
return int(value * 10 ** precision) / 10. ** precision
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pixels_to_degrees(pixels, zoom):
|
def pixels_to_degrees(pixels, zoom):
|
||||||
|
"""
|
||||||
|
Generates pixels to be expected at zoom levels
|
||||||
|
|
||||||
|
returns INT
|
||||||
|
"""
|
||||||
return pixels * 2 ** (21-zoom)
|
return pixels * 2 ** (21-zoom)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pixels_to_meters(latitude, zoom):
|
def pixels_to_meters(latitude, zoom):
|
||||||
|
"""
|
||||||
|
Function generates how many pixels per meter it should be from the projecction
|
||||||
|
|
||||||
|
returns FLOAT
|
||||||
|
"""
|
||||||
# https://groups.google.com/forum/#!topic/google-maps-js-api-v3/hDRO4oHVSeM
|
# https://groups.google.com/forum/#!topic/google-maps-js-api-v3/hDRO4oHVSeM
|
||||||
return 2 ** zoom / (156543.03392 * math.cos(math.radians(latitude)))
|
return 2 ** zoom / (156543.03392 * math.cos(math.radians(latitude)))
|
||||||
Reference in New Issue
Block a user