Permalink
Browse files

Add ability to simplify maps

  • Loading branch information...
1 parent 7cd272a commit 654ef157ae2b83336d3bc504438d9234d1aa947d @cnorthwood cnorthwood committed Jul 28, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 molly/maps/__init__.py
View
@@ -1,5 +1,7 @@
from urllib import urlencode
+from django.contrib.gis.geos import Point
+
from molly.maps.osm import fit_to_map
from molly.maps.models import GeneratedMap
@@ -120,6 +122,21 @@ def __init__(self, centre_point, points, min_points, zoom, width, height,
self.lon_centre, self.lat_centre = lon_center, lat_center
self.markers = markers
+
+ def simplify_for_render(self, simplify_value, simplify_model):
+ return {
+ 'hash': simplify_value(self.static_map_hash),
+ 'centre_point': simplify_value(self.centre_point),
+ 'extra_points': simplify_value(self.extra_points),
+ 'points': simplify_value(self.points),
+ 'paths': simplify_value(self.paths),
+ 'width': simplify_value(self.width),
+ 'height': simplify_value(self.height),
+ 'map_centre': simplify_value(Point(self.lon_centre, self.lat_centre)),
+ 'zoom': simplify_value(self.zoom),
+ 'markers': simplify_value(self.markers),
+ }
+
def map_from_point(point, width, height, colour='green', title='', zoom=16):
"""

0 comments on commit 654ef15

Please sign in to comment.