/[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 1221 by jonathan, Tue Jun 17 15:24:45 2003 UTC revision 1285 by jonathan, Mon Jun 23 10:30:53 2003 UTC
# Line 19  import os.path Line 19  import os.path
19    
20  from math import hypot  from math import hypot
21    
22  from wxPython.wx import wxWindow,\  from wxPython.wx import wxWindow, \
23       wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\       wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\
24       EVT_PAINT, EVT_LEFT_DOWN, EVT_LEFT_UP, EVT_MOTION, EVT_LEAVE_WINDOW, \       EVT_PAINT, EVT_LEFT_DOWN, EVT_LEFT_UP, EVT_MOTION, EVT_LEAVE_WINDOW, \
25       wxBITMAP_TYPE_XPM, wxBeginBusyCursor, wxEndBusyCursor, wxCursor, \       wxBITMAP_TYPE_XPM, wxCursor, wxImageFromBitmap, wxPlatform, \
26       wxImageFromBitmap, wxPlatform       wxBeginBusyCursor, wxEndBusyCursor
27    
28    
29  # Export related stuff  # Export related stuff
30  if wxPlatform == '__WXMSW__':  if wxPlatform == '__WXMSW__':
# Line 274  class MapPrintout(wx.wxPrintout): Line 275  class MapPrintout(wx.wxPrintout):
275                             self.selected_layer, self.selected_shapes)                             self.selected_layer, self.selected_shapes)
276          return True          return True
277    
   
278  class MapCanvas(wxWindow, Publisher):  class MapCanvas(wxWindow, Publisher):
279    
280      """A widget that displays a map and offers some interaction"""      """A widget that displays a map and offers some interaction"""
# Line 381  class MapCanvas(wxWindow, Publisher): Line 381  class MapCanvas(wxWindow, Publisher):
381    
382      def OnPaint(self, event):      def OnPaint(self, event):
383          dc = wxPaintDC(self)          dc = wxPaintDC(self)
384    
385          clear = self.map is None or not self.map.HasLayers()          clear = self.map is None or not self.map.HasLayers()
386    
387          wxBeginBusyCursor()          wxBeginBusyCursor()
388          try:          try:
389              if not clear:              if not clear:
390                  self.do_redraw()                  self.do_redraw()
391                  try:              else:
                     pass  
                 except:  
                     print "Error during drawing:", sys.exc_info()[0]  
                     clear = True  
   
             if clear:  
392                  # 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
393                  # the screen.                  # the screen.
394    
# Line 653  class MapCanvas(wxWindow, Publisher): Line 648  class MapCanvas(wxWindow, Publisher):
648          Set the scale so that the map fits exactly into the window and          Set the scale so that the map fits exactly into the window and
649          center it in the window.          center it in the window.
650          """          """
651          bbox = self.map.ProjectedBoundingBox()          if self.map is not None:
652          if bbox is not None:              bbox = self.map.ProjectedBoundingBox()
653              self.FitRectToWindow(bbox)              if bbox is not None:
654                    self.FitRectToWindow(bbox)
655    
656      def FitLayerToWindow(self, layer):      def FitLayerToWindow(self, layer):
657          """Fit the given layer to the window.          """Fit the given layer to the window.
# Line 942  class MapCanvas(wxWindow, Publisher): Line 938  class MapCanvas(wxWindow, Publisher):
938              layer = layers[layer_index]              layer = layers[layer_index]
939    
940              # search only in visible layers              # search only in visible layers
941              if not layer.Visible():              if not layer.Visible() or not layer.HasShapes():
942                  continue                  continue
943    
944              filled = layer.GetClassification().GetDefaultFill() \              filled = layer.GetClassification().GetDefaultFill() \

Legend:
Removed from v.1221  
changed lines
  Added in v.1285

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26