- Timestamp:
- 07/26/08 08:52:19 (4 months ago)
- Files:
-
- trunk/py/wscompose/pinwin.py (modified) (1 diff)
- trunk/py/wscompose/plotting.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/py/wscompose/pinwin.py
r591 r637 233 233 234 234 # 235 236 for data in self.ctx['markers'] : 237 self.draw_shadow(img, data, bleed_x, bleed_y) 235 238 236 239 for data in self.ctx['markers'] : trunk/py/wscompose/plotting.py
r593 r637 9 9 10 10 import wscompose 11 import wscompose. markers11 import wscompose.pwmarker 12 12 import string 13 13 import random … … 75 75 76 76 mrk = self.load_marker(w, h, a) 77 78 77 pt = self.latlon_to_point(mrk_data['latitude'], mrk_data['longitude']) 79 78 … … 91 90 x1 = mrk_data['x'] - int(mrk.x_offset) 92 91 y1 = mrk_data['y'] - int(mrk.y_offset) 93 94 x2 = x1 + (w + mrk.padding)95 y2 = y1 + (h + mrk.padding)92 93 x2 = x1 + (w + (mrk.x_padding * 2)) 94 y2 = y1 + (h + (mrk.y_padding * 2)) 96 95 97 96 mrk_data['canvas'] = (x1, y1, x2, y2) … … 164 163 165 164 # print "does %s overlap %s" % (cur_label, test_label) 165 # print "current %s" % current 166 166 167 167 # first, ensure that some part of 'current' … … 232 232 233 233 for data in self.ctx['markers'] : 234 self.draw_shadow(img, data) 235 236 for data in self.ctx['markers'] : 234 237 self.draw_marker(img, data) 235 238 … … 237 240 238 241 # ########################################################## 239 240 def draw_ marker(self, img, mrk_data, bleed_x=0, bleed_y=0) :242 243 def draw_shadow (self, img, mrk_data, bleed_x=0, bleed_y=0) : 241 244 242 245 w = mrk_data['width'] … … 245 248 246 249 mrk = self.load_marker(w, h, a) 247 250 248 251 loc = ModestMaps.Geo.Location(mrk_data['latitude'], mrk_data['longitude']) 249 252 pt = self.ctx['map'].locationPoint(loc) … … 257 260 my = mrk_data['y'] - int(mrk.y_offset) 258 261 259 # note the +2 which is necessary once we 260 # paste the pinwin/alpha with an offset 261 # of (1,1) - see also : markers.py 262 263 dx = mx + mrk.x_padding + 2 264 dy = my + mrk.y_padding + 2 262 dx = mx + mrk.x_padding 263 dy = my + mrk.y_padding 265 264 266 265 # 267 266 268 img.paste(mrk.fh(), (mx, my), mrk.fh()) 267 shadow = mrk.fh('shadow') 268 img.paste(shadow, (mx, my), shadow) 269 269 270 270 mrk_data['x_fill'] = dx 271 271 mrk_data['y_fill'] = dy 272 273 # ########################################################## 274 275 def draw_marker (self, img, mrk_data, bleed_x=0, bleed_y=0) : 276 277 w = mrk_data['width'] 278 h = mrk_data['height'] 279 a = mrk_data['adjust_cone_height'] 280 281 mrk = self.load_marker(w, h, a) 282 283 loc = ModestMaps.Geo.Location(mrk_data['latitude'], mrk_data['longitude']) 284 pt = self.ctx['map'].locationPoint(loc) 285 286 # 287 288 mrk_data['x'] = int(pt.x) + bleed_x 289 mrk_data['y'] = int(pt.y) + bleed_y 290 291 mx = mrk_data['x'] - int(mrk.x_offset) 292 my = mrk_data['y'] - int(mrk.y_offset) 293 294 dx = mx + mrk.x_padding 295 dy = my + mrk.y_padding 296 297 # 298 299 pinwin = mrk.fh('pinwin') 300 img.paste(pinwin, (mx, my), pinwin) 301 302 mrk_data['x_fill'] = dx 303 mrk_data['y_fill'] = dy 304 272 305 273 306 # ########################################################## … … 291 324 292 325 key = "%s-%s-%s" % (w, h, a) 293 326 294 327 if not self.__markers__.has_key(key) : 295 self.__markers__[key] = wscompose.markers.pinwin(w, h, a) 296 328 mrk = wscompose.pwmarker.PinwinMarker(w, h, a) 329 mrk.draw() 330 331 self.__markers__[key] = mrk 332 297 333 return self.__markers__[key] 298 334
