/[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 159 by bh, Wed May 8 13:46:15 2002 UTC revision 174 by bh, Wed May 15 13:30:00 2002 UTC
# Line 286  class MapCanvas(wxWindow, Publisher): Line 286  class MapCanvas(wxWindow, Publisher):
286          self.interactor = interactor          self.interactor = interactor
287          self.interactor.Subscribe(SELECTED_SHAPE, self.shape_selected)          self.interactor.Subscribe(SELECTED_SHAPE, self.shape_selected)
288    
289            # keep track of which layers/shapes are selected to make sure we
290            # only redraw when necessary
291            self.last_selected_layer = None
292            self.last_selected_shape = None
293    
294          # subscribe the WX events we're interested in          # subscribe the WX events we're interested in
295          EVT_PAINT(self, self.OnPaint)          EVT_PAINT(self, self.OnPaint)
296          EVT_LEFT_DOWN(self, self.OnLeftDown)          EVT_LEFT_DOWN(self, self.OnLeftDown)
# Line 582  class MapCanvas(wxWindow, Publisher): Line 587  class MapCanvas(wxWindow, Publisher):
587          self.full_redraw()          self.full_redraw()
588    
589      def shape_selected(self, layer, shape):      def shape_selected(self, layer, shape):
590          self.full_redraw()          """Redraw the map.
591    
592            Receiver for the SELECTED_SHAPE messages. Try to redraw only
593            when necessary.
594            """
595            # A redraw is necessary when the display has to change, which
596            # means that either the status changes from having no selection
597            # to having a selection shape or vice versa, or when the fact
598            # whether there is a selection at all doesn't change, when the
599            # shape which is selected has changed (which means that layer or
600            # shapeid changes).
601            print "MapCanvas.shape_selected:", layer, shape
602            if ((shape is not None or self.last_selected_shape is not None)
603                and (shape != self.last_selected_shape
604                     or layer != self.last_selected_layer)):
605                print "MapCanvas.shape_selected: redraw",
606                self.full_redraw()
607            else:
608                print "MapCanvas.shape_selected: no redraw"
609            self.last_selected_layer = layer
610            self.last_selected_shape = shape
611    
612      def unprojected_rect_around_point(self, x, y):      def unprojected_rect_around_point(self, x, y):
613          """return a rect a few pixels around (x, y) in unprojected corrdinates          """return a rect a few pixels around (x, y) in unprojected corrdinates

Legend:
Removed from v.159  
changed lines
  Added in v.174

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26