19 |
|
|
20 |
from math import hypot |
from math import hypot |
21 |
|
|
22 |
from wxPython.wx import wxWindow,\ |
from wxPython.wx import wxWindow, \ |
23 |
wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\ |
wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\ |
24 |
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, \ |
25 |
wxBITMAP_TYPE_XPM, wxBeginBusyCursor, wxEndBusyCursor, wxCursor, \ |
wxBITMAP_TYPE_XPM, wxCursor, wxImageFromBitmap, wxPlatform, \ |
26 |
wxImageFromBitmap, wxPlatform |
wxBeginBusyCursor, wxEndBusyCursor |
27 |
|
|
28 |
|
|
29 |
# Export related stuff |
# Export related stuff |
30 |
if wxPlatform == '__WXMSW__': |
if wxPlatform == '__WXMSW__': |
275 |
self.selected_layer, self.selected_shapes) |
self.selected_layer, self.selected_shapes) |
276 |
return True |
return True |
277 |
|
|
|
|
|
278 |
class MapCanvas(wxWindow, Publisher): |
class MapCanvas(wxWindow, Publisher): |
279 |
|
|
280 |
"""A widget that displays a map and offers some interaction""" |
"""A widget that displays a map and offers some interaction""" |
381 |
|
|
382 |
def OnPaint(self, event): |
def OnPaint(self, event): |
383 |
dc = wxPaintDC(self) |
dc = wxPaintDC(self) |
384 |
|
|
385 |
clear = self.map is None or not self.map.HasLayers() |
clear = self.map is None or not self.map.HasLayers() |
386 |
|
|
387 |
wxBeginBusyCursor() |
wxBeginBusyCursor() |
388 |
try: |
try: |
389 |
if not clear: |
if not clear: |
390 |
self.do_redraw() |
self.do_redraw() |
391 |
try: |
else: |
|
pass |
|
|
except: |
|
|
print "Error during drawing:", sys.exc_info()[0] |
|
|
clear = True |
|
|
|
|
|
if clear: |
|
392 |
# 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 |
393 |
# the screen. |
# the screen. |
394 |
|
|
938 |
layer = layers[layer_index] |
layer = layers[layer_index] |
939 |
|
|
940 |
# search only in visible layers |
# search only in visible layers |
941 |
if not layer.Visible(): |
if not layer.Visible() or not layer.HasShapes(): |
942 |
continue |
continue |
943 |
|
|
944 |
filled = layer.GetClassification().GetDefaultFill() \ |
filled = layer.GetClassification().GetDefaultFill() \ |