/[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 799 by jonathan, Wed Apr 30 17:02:21 2003 UTC revision 822 by jonathan, Mon May 5 18:20:28 2003 UTC
# Line 17  from math import hypot Line 17  from math import hypot
17    
18  from wxPython.wx import wxWindow,\  from wxPython.wx import wxWindow,\
19       wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\       wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\
20       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, \
21         wxBITMAP_TYPE_XPM, wxBeginBusyCursor, wxEndBusyCursor, wxCursor, \
22         wxImageFromBitmap
23    
24    
25  from wxPython import wx  from wxPython import wx
# Line 34  from Thuban.Model.label import ALIGN_CEN Line 36  from Thuban.Model.label import ALIGN_CEN
36  from Thuban.Lib.connector import Publisher  from Thuban.Lib.connector import Publisher
37  from Thuban.Model.color import Color  from Thuban.Model.color import Color
38    
39    import resource
40    
41  from selection import Selection  from selection import Selection
42  from renderer import ScreenRenderer, PrinterRender  from renderer import ScreenRenderer, PrinterRender
43    
# Line 357  class MapCanvas(wxWindow, Publisher): Line 361  class MapCanvas(wxWindow, Publisher):
361          dc = wxPaintDC(self)          dc = wxPaintDC(self)
362          clear = self.map is None or not self.map.HasLayers()          clear = self.map is None or not self.map.HasLayers()
363    
364            #wxBeginBusyCursor()
365    
366          if not clear:          if not clear:
367              try:              try:
368                  self.do_redraw()                  self.do_redraw()
# Line 376  class MapCanvas(wxWindow, Publisher): Line 382  class MapCanvas(wxWindow, Publisher):
382              dc.Clear()              dc.Clear()
383              dc.EndDrawing()              dc.EndDrawing()
384    
385            #wxEndBusyCursor()
386    
387      def do_redraw(self):      def do_redraw(self):
388          # This should only be called if we have a non-empty map.          # This should only be called if we have a non-empty map.
389    
# Line 509  class MapCanvas(wxWindow, Publisher): Line 517  class MapCanvas(wxWindow, Publisher):
517          if bbox is not None:          if bbox is not None:
518              self.FitRectToWindow(bbox)              self.FitRectToWindow(bbox)
519    
520        def FitLayerToWindow(self, layer):
521            """Fit the given layer to the window.
522    
523            Set the scale so that the layer fits exactly into the window and
524            center it in the window.
525            """
526            
527            bbox = layer.LatLongBoundingBox()
528            if bbox is not None:
529                proj = self.map.GetProjection()
530                if proj is not None:
531                    bbox = proj.ForwardBBox(bbox)
532                    if bbox is not None:
533                        self.FitRectToWindow(bbox)
534    
535      def ZoomFactor(self, factor, center = None):      def ZoomFactor(self, factor, center = None):
536          """Multiply the zoom by factor and center on center.          """Multiply the zoom by factor and center on center.
537    
# Line 572  class MapCanvas(wxWindow, Publisher): Line 595  class MapCanvas(wxWindow, Publisher):
595      def PanTool(self):      def PanTool(self):
596          """Start the pan tool"""          """Start the pan tool"""
597          self.SelectTool(PanTool(self))          self.SelectTool(PanTool(self))
598            #img = resource.GetImageResource("pan", wxBITMAP_TYPE_XPM)
599            #bmp = resource.GetBitmapResource("pan", wxBITMAP_TYPE_XPM)
600            #print bmp
601            #img = wxImageFromBitmap(bmp)
602            #print img
603            #cur = wxCursor(img)
604            #print cur
605            #self.SetCursor(cur)
606    
607      def IdentifyTool(self):      def IdentifyTool(self):
608          """Start the identify tool"""          """Start the identify tool"""

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26