/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/view.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/view.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 125 by bh, Thu May 2 18:55:33 2002 UTC revision 145 by bh, Tue May 7 14:58:05 2002 UTC
# Line 267  class MapCanvas(wxWindow, Publisher): Line 267  class MapCanvas(wxWindow, Publisher):
267          # if the mouse is outside the window.          # if the mouse is outside the window.
268          self.current_position = None          self.current_position = None
269    
   
270          # If true, OnIdle will call do_redraw to do the actual          # If true, OnIdle will call do_redraw to do the actual
271          # redrawing. Set by OnPaint to avoid some unnecessary redraws.          # redrawing. Set by OnPaint to avoid some unnecessary redraws.
272          # To force a redraw call full_redraw().          # To force a redraw call full_redraw().
273          self.redraw_on_idle = 0          self.redraw_on_idle = 0
274    
275            # The region to update when idle
276            self.update_region = wx.wxRegion()
277    
278          # the bitmap serving as backing store          # the bitmap serving as backing store
279          self.bitmap = None          self.bitmap = None
280    
# Line 298  class MapCanvas(wxWindow, Publisher): Line 300  class MapCanvas(wxWindow, Publisher):
300          if self.map is not None and self.map.HasLayers():          if self.map is not None and self.map.HasLayers():
301              # We have a non-empty map. Redraw it in idle time              # We have a non-empty map. Redraw it in idle time
302              self.redraw_on_idle = 1              self.redraw_on_idle = 1
303                # update the region that has to be redrawn
304                self.update_region.UnionRegion(self.GetUpdateRegion())
305          else:          else:
306              # 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
307              # the screen.              # the screen.
# Line 310  class MapCanvas(wxWindow, Publisher): Line 314  class MapCanvas(wxWindow, Publisher):
314              dc.Clear()                          dc.Clear()            
315              dc.EndDrawing()              dc.EndDrawing()
316    
317                # clear the region
318                self.update_region = wx.wxRegion()
319    
320      def do_redraw(self):      def do_redraw(self):
321          # This should only be called if we have a non-empty map. We draw          # This should only be called if we have a non-empty map.
322          # it into a memory DC and then blit it to the screen.  
323            # get the update region and reset it.
324            update_box = self.update_region.GetBox()
325            self.update_region = wx.wxRegion()
326    
327            # Get the window size.
328          width, height = self.GetSizeTuple()          width, height = self.GetSizeTuple()
329    
330          # If self.bitmap's still there, reuse it. Otherwise redraw it          # If self.bitmap's still there, reuse it. Otherwise redraw it
# Line 339  class MapCanvas(wxWindow, Publisher): Line 350  class MapCanvas(wxWindow, Publisher):
350    
351              # draw the map into the bitmap              # draw the map into the bitmap
352              renderer = ScreenRenderer(dc, self.scale, self.offset)              renderer = ScreenRenderer(dc, self.scale, self.offset)
353              renderer.RenderMap(self.map, selected_layer, selected_shape)              renderer.RenderMap(self.map, update_box,
354                                   selected_layer, selected_shape)
355    
356              dc.EndDrawing()              dc.EndDrawing()
357              dc.SelectObject(wx.wxNullBitmap)              dc.SelectObject(wx.wxNullBitmap)

Legend:
Removed from v.125  
changed lines
  Added in v.145

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26