/[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 798 by bh, Wed Apr 30 11:06:00 2003 UTC revision 799 by jonathan, Wed Apr 30 17:02:21 2003 UTC
# Line 11  Classes for display of a map and interac Line 11  Classes for display of a map and interac
11    
12  __version__ = "$Revision$"  __version__ = "$Revision$"
13    
14    import sys
15    
16  from math import hypot  from math import hypot
17    
18  from wxPython.wx import wxWindow,\  from wxPython.wx import wxWindow,\
# Line 353  class MapCanvas(wxWindow, Publisher): Line 355  class MapCanvas(wxWindow, Publisher):
355    
356      def OnPaint(self, event):      def OnPaint(self, event):
357          dc = wxPaintDC(self)          dc = wxPaintDC(self)
358          if self.map is not None and self.map.HasLayers():          clear = self.map is None or not self.map.HasLayers()
359              self.do_redraw()  
360          else:          if not clear:
361                try:
362                    self.do_redraw()
363                except:
364                    print "Error during drawing:", sys.exc_info()[0]
365                    clear = True
366    
367            if clear:
368              # 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
369              # the screen.              # the screen.
370    
# Line 383  class MapCanvas(wxWindow, Publisher): Line 392  class MapCanvas(wxWindow, Publisher):
392              dc.BeginDrawing()              dc.BeginDrawing()
393    
394              # clear the background              # clear the background
395              dc.SetBrush(wx.wxWHITE_BRUSH)              #dc.SetBrush(wx.wxWHITE_BRUSH)
396              dc.SetPen(wx.wxTRANSPARENT_PEN)              #dc.SetPen(wx.wxTRANSPARENT_PEN)
397              dc.DrawRectangle(0, 0, width, height)              #dc.DrawRectangle(0, 0, width, height)
398                dc.SetBackground(wx.wxWHITE_BRUSH)
399                dc.Clear()
400    
401              selected_layer = self.selection.SelectedLayer()              selected_layer = self.selection.SelectedLayer()
402              selected_shapes = self.selection.SelectedShapes()              selected_shapes = self.selection.SelectedShapes()
# Line 479  class MapCanvas(wxWindow, Publisher): Line 490  class MapCanvas(wxWindow, Publisher):
490          width, height = self.GetSizeTuple()          width, height = self.GetSizeTuple()
491          llx, lly, urx, ury = rect          llx, lly, urx, ury = rect
492          if llx == urx or lly == ury:          if llx == urx or lly == ury:
493              # zero with or zero height. Do Nothing              # zero width or zero height. Do Nothing
494              return              return
495          scalex = width / (urx - llx)          scalex = width / (urx - llx)
496          scaley = height / (ury - lly)          scaley = height / (ury - lly)
# Line 639  class MapCanvas(wxWindow, Publisher): Line 650  class MapCanvas(wxWindow, Publisher):
650          # Even when the window becomes larger some parts of the bitmap          # Even when the window becomes larger some parts of the bitmap
651          # could be reused.          # could be reused.
652          self.full_redraw()          self.full_redraw()
653            pass
654    
655      def shape_selected(self, layer, shape):      def shape_selected(self, layer, shape):
656          """Receiver for the SHAPES_SELECTED messages. Redraw the map."""          """Receiver for the SHAPES_SELECTED messages. Redraw the map."""

Legend:
Removed from v.798  
changed lines
  Added in v.799

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26