/[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 967 by jonathan, Wed May 21 17:24:54 2003 UTC revision 1105 by jonathan, Fri May 30 06:30:15 2003 UTC
# Line 271  class MapPrintout(wx.wxPrintout): Line 271  class MapPrintout(wx.wxPrintout):
271                                  (height/canvas_scale)*scale),                                  (height/canvas_scale)*scale),
272                                  mapregion,                                  mapregion,
273                             self.selected_layer, self.selected_shapes)                             self.selected_layer, self.selected_shapes)
274          return wx.true          return True
275    
276    
277  class MapCanvas(wxWindow, Publisher):  class MapCanvas(wxWindow, Publisher):
# Line 378  class MapCanvas(wxWindow, Publisher): Line 378  class MapCanvas(wxWindow, Publisher):
378          clear = self.map is None or not self.map.HasLayers()          clear = self.map is None or not self.map.HasLayers()
379    
380          wxBeginBusyCursor()          wxBeginBusyCursor()
381            try:
382          if not clear:              if not clear:
383              self.do_redraw()                  self.do_redraw()
384              try:                  try:
385                  pass                      pass
386              except:                  except:
387                  print "Error during drawing:", sys.exc_info()[0]                      print "Error during drawing:", sys.exc_info()[0]
388                  clear = True                      clear = True
389    
390          if clear:              if clear:
391              # 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
392              # the screen.                  # the screen.
393    
394              # XXX it's probably possible to get rid of this. The                  # XXX it's probably possible to get rid of this. The
395              # background color of the window is already white and the                  # background color of the window is already white and the
396              # only thing we may have to do is to call self.Refresh()                  # only thing we may have to do is to call self.Refresh()
397              # with a true argument in the right places.                  # with a true argument in the right places.
398              dc.BeginDrawing()                  dc.BeginDrawing()
399              dc.Clear()                  dc.Clear()
400              dc.EndDrawing()                  dc.EndDrawing()
401            finally:
402          wxEndBusyCursor()              wxEndBusyCursor()
403    
404      def do_redraw(self):      def do_redraw(self):
405          # 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 492  class MapCanvas(wxWindow, Publisher): Line 492  class MapCanvas(wxWindow, Publisher):
492                    
493          printout = MapPrintout(self, self.map, (0, 0, width, height),          printout = MapPrintout(self, self.map, (0, 0, width, height),
494                                 selected_layer, selected_shapes)                                 selected_layer, selected_shapes)
495          printer.Print(self, printout, wx.true)          printer.Print(self, printout, True)
496          printout.Destroy()          printout.Destroy()
497    
498      def SetMap(self, map):      def SetMap(self, map):
# Line 612  class MapCanvas(wxWindow, Publisher): Line 612  class MapCanvas(wxWindow, Publisher):
612                  bbox = proj.ForwardBBox(bbox)                  bbox = proj.ForwardBBox(bbox)
613    
614              if bbox is not None:              if bbox is not None:
615                  self.FitRectToWindow(bbox)                  if len(shapes) == 1 and layer.ShapeType() == SHAPETYPE_POINT:
616                        self.ZoomFactor(1, self.proj_to_win(bbox[0], bbox[1]))
617                    else:
618                        self.FitRectToWindow(bbox)
619    
620      def ZoomFactor(self, factor, center = None):      def ZoomFactor(self, factor, center = None):
621          """Multiply the zoom by factor and center on center.          """Multiply the zoom by factor and center on center.

Legend:
Removed from v.967  
changed lines
  Added in v.1105

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26