Ticket #10480: dynamic_icons.diff
File dynamic_icons.diff, 1.9 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/maps/google/gmap.py
71 71 else: 72 72 getattr(self, varname).append(overlay_class(overlay)) 73 73 74 # Pulling any icons from the markers.75 self.icons = [marker.icon for marker in self.markers if marker.icon]76 77 74 # If GMarker, GPolygons, and/or GPolylines are used the zoom will be 78 75 # automatically calculated via the Google Maps API. If both a zoom 79 76 # level and a center coordinate are provided with polygons/polylines, … … 143 140 "Returns XHTML information needed for IE VML overlays." 144 141 return mark_safe('<html xmlns="http://www.w3.org/1999/xhtml" %s>' % self.xmlns) 145 142 143 @property 144 def icons(self): 145 "Returns a sequence of GIcon objects in this map." 146 return [marker.icon for marker in self.markers if marker.icon] 147 146 148 class GoogleMapSet(GoogleMap): 147 149 148 150 def __init__(self, *args, **kwargs): … … 173 175 else: 174 176 self.maps = args 175 177 176 # Creating the icons sequence from every map in this set.177 self.icons = []178 for map in self.maps:179 self.icons.extend(map.icons)180 181 178 # Generating DOM ids for each of the maps in the set. 182 179 self.dom_ids = ['map%d' % i for i in xrange(len(self.maps))] 183 180 … … 220 217 # `google-multi.js`, which calls the load routines for 221 218 # each one of the individual maps in the set. 222 219 return mark_safe('onload="%s.load()"' % self.js_module) 220 221 @property 222 def icons(self): 223 "Returns a sequence of all icons in each map of the set." 224 icons = [] 225 for map in self.maps: icons.extend(map.icons) 226 return icons 227