284 |
# To force a redraw call full_redraw(). |
# To force a redraw call full_redraw(). |
285 |
self.redraw_on_idle = 0 |
self.redraw_on_idle = 0 |
286 |
|
|
|
# The region to update when idle |
|
|
self.update_region = wx.wxRegion() |
|
|
|
|
287 |
# the bitmap serving as backing store |
# the bitmap serving as backing store |
288 |
self.bitmap = None |
self.bitmap = None |
289 |
|
|
314 |
if self.map is not None and self.map.HasLayers(): |
if self.map is not None and self.map.HasLayers(): |
315 |
# We have a non-empty map. Redraw it in idle time |
# We have a non-empty map. Redraw it in idle time |
316 |
self.redraw_on_idle = 1 |
self.redraw_on_idle = 1 |
|
# update the region that has to be redrawn |
|
|
self.update_region.UnionRegion(self.GetUpdateRegion()) |
|
317 |
else: |
else: |
318 |
# If we've got no map or if the map is empty, simply clear |
# If we've got no map or if the map is empty, simply clear |
319 |
# the screen. |
# the screen. |
326 |
dc.Clear() |
dc.Clear() |
327 |
dc.EndDrawing() |
dc.EndDrawing() |
328 |
|
|
|
# clear the region |
|
|
self.update_region = wx.wxRegion() |
|
|
|
|
329 |
def do_redraw(self): |
def do_redraw(self): |
330 |
# This should only be called if we have a non-empty map. |
# This should only be called if we have a non-empty map. |
331 |
|
|
|
# get the update region and reset it. We're not actually using |
|
|
# it anymore, though. |
|
|
update_box = self.update_region.GetBox() |
|
|
self.update_region = wx.wxRegion() |
|
|
|
|
332 |
# Get the window size. |
# Get the window size. |
333 |
width, height = self.GetSizeTuple() |
width, height = self.GetSizeTuple() |
334 |
|
|
356 |
# draw the map into the bitmap |
# draw the map into the bitmap |
357 |
renderer = ScreenRenderer(dc, self.scale, self.offset) |
renderer = ScreenRenderer(dc, self.scale, self.offset) |
358 |
|
|
359 |
# Pass the entire bitmap as update_region to the renderer. |
# Pass the entire bitmap as update region to the renderer. |
360 |
# We're redrawing the whole bitmap, after all. |
# We're redrawing the whole bitmap, after all. |
361 |
renderer.RenderMap(self.map, (0, 0, width, height), |
renderer.RenderMap(self.map, (0, 0, width, height), |
362 |
selected_layer, selected_shape) |
selected_layer, selected_shape) |