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. |
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. |