11 |
|
|
12 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
13 |
|
|
14 |
|
import sys |
15 |
|
|
16 |
from math import hypot |
from math import hypot |
17 |
|
|
18 |
from wxPython.wx import wxWindow,\ |
from wxPython.wx import wxWindow,\ |
355 |
|
|
356 |
def OnPaint(self, event): |
def OnPaint(self, event): |
357 |
dc = wxPaintDC(self) |
dc = wxPaintDC(self) |
358 |
if self.map is not None and self.map.HasLayers(): |
clear = self.map is None or not self.map.HasLayers() |
359 |
self.do_redraw() |
|
360 |
else: |
if not clear: |
361 |
|
try: |
362 |
|
self.do_redraw() |
363 |
|
except: |
364 |
|
print "Error during drawing:", sys.exc_info()[0] |
365 |
|
clear = True |
366 |
|
|
367 |
|
if clear: |
368 |
# 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 |
369 |
# the screen. |
# the screen. |
370 |
|
|
392 |
dc.BeginDrawing() |
dc.BeginDrawing() |
393 |
|
|
394 |
# clear the background |
# clear the background |
395 |
dc.SetBrush(wx.wxWHITE_BRUSH) |
#dc.SetBrush(wx.wxWHITE_BRUSH) |
396 |
dc.SetPen(wx.wxTRANSPARENT_PEN) |
#dc.SetPen(wx.wxTRANSPARENT_PEN) |
397 |
dc.DrawRectangle(0, 0, width, height) |
#dc.DrawRectangle(0, 0, width, height) |
398 |
|
dc.SetBackground(wx.wxWHITE_BRUSH) |
399 |
|
dc.Clear() |
400 |
|
|
401 |
selected_layer = self.selection.SelectedLayer() |
selected_layer = self.selection.SelectedLayer() |
402 |
selected_shapes = self.selection.SelectedShapes() |
selected_shapes = self.selection.SelectedShapes() |
490 |
width, height = self.GetSizeTuple() |
width, height = self.GetSizeTuple() |
491 |
llx, lly, urx, ury = rect |
llx, lly, urx, ury = rect |
492 |
if llx == urx or lly == ury: |
if llx == urx or lly == ury: |
493 |
# zero with or zero height. Do Nothing |
# zero width or zero height. Do Nothing |
494 |
return |
return |
495 |
scalex = width / (urx - llx) |
scalex = width / (urx - llx) |
496 |
scaley = height / (ury - lly) |
scaley = height / (ury - lly) |
650 |
# Even when the window becomes larger some parts of the bitmap |
# Even when the window becomes larger some parts of the bitmap |
651 |
# could be reused. |
# could be reused. |
652 |
self.full_redraw() |
self.full_redraw() |
653 |
|
pass |
654 |
|
|
655 |
def shape_selected(self, layer, shape): |
def shape_selected(self, layer, shape): |
656 |
"""Receiver for the SHAPES_SELECTED messages. Redraw the map.""" |
"""Receiver for the SHAPES_SELECTED messages. Redraw the map.""" |