/[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 1277 by jonathan, Fri Jun 20 17:46:45 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, wxYield,\
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
      wxImageFromBitmap, wxPlatform  
26    
27  # Export related stuff  # Export related stuff
28  if wxPlatform == '__WXMSW__':  if wxPlatform == '__WXMSW__':
# Line 44  from Thuban.Model.label import ALIGN_CEN Line 43  from Thuban.Model.label import ALIGN_CEN
43  from Thuban.Lib.connector import Publisher  from Thuban.Lib.connector import Publisher
44  from Thuban.Model.color import Color  from Thuban.Model.color import Color
45    
46    from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
47    
48  import resource  import resource
49    
50  from selection import Selection  from selection import Selection
# 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 383  class MapCanvas(wxWindow, Publisher): Line 383  class MapCanvas(wxWindow, Publisher):
383          dc = wxPaintDC(self)          dc = wxPaintDC(self)
384          clear = self.map is None or not self.map.HasLayers()          clear = self.map is None or not self.map.HasLayers()
385    
386          wxBeginBusyCursor()          ThubanBeginBusyCursor()
387          try:          try:
388              if not clear:              if not clear:
389                  self.do_redraw()                  self.do_redraw()
# Line 405  class MapCanvas(wxWindow, Publisher): Line 405  class MapCanvas(wxWindow, Publisher):
405                  dc.Clear()                  dc.Clear()
406                  dc.EndDrawing()                  dc.EndDrawing()
407          finally:          finally:
408              wxEndBusyCursor()              ThubanEndBusyCursor()
409    
410      def do_redraw(self):      def do_redraw(self):
411          # This should only be called if we have a non-empty map.          # This should only be called if we have a non-empty map.
# Line 653  class MapCanvas(wxWindow, Publisher): Line 653  class MapCanvas(wxWindow, Publisher):
653          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
654          center it in the window.          center it in the window.
655          """          """
656          bbox = self.map.ProjectedBoundingBox()          if self.map is not None:
657          if bbox is not None:              bbox = self.map.ProjectedBoundingBox()
658              self.FitRectToWindow(bbox)              if bbox is not None:
659                    self.FitRectToWindow(bbox)
660    
661      def FitLayerToWindow(self, layer):      def FitLayerToWindow(self, layer):
662          """Fit the given layer to the window.          """Fit the given layer to the window.
# Line 942  class MapCanvas(wxWindow, Publisher): Line 943  class MapCanvas(wxWindow, Publisher):
943              layer = layers[layer_index]              layer = layers[layer_index]
944    
945              # search only in visible layers              # search only in visible layers
946              if not layer.Visible():              if not layer.Visible() or not layer.HasShapes():
947                  continue                  continue
948    
949              filled = layer.GetClassification().GetDefaultFill() \              filled = layer.GetClassification().GetDefaultFill() \

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26