19 |
|
|
20 |
from math import hypot |
from math import hypot |
21 |
|
|
22 |
from wxPython.wx import wxWindow,\ |
from wxPython.wx import wxWindow, wxYield,\ |
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, wxBeginBusyCursor, wxEndBusyCursor, wxCursor, \ |
274 |
self.selected_layer, self.selected_shapes) |
self.selected_layer, self.selected_shapes) |
275 |
return True |
return True |
276 |
|
|
|
|
|
277 |
class MapCanvas(wxWindow, Publisher): |
class MapCanvas(wxWindow, Publisher): |
278 |
|
|
279 |
"""A widget that displays a map and offers some interaction""" |
"""A widget that displays a map and offers some interaction""" |
383 |
clear = self.map is None or not self.map.HasLayers() |
clear = self.map is None or not self.map.HasLayers() |
384 |
|
|
385 |
wxBeginBusyCursor() |
wxBeginBusyCursor() |
386 |
|
wxYield() |
387 |
|
|
388 |
try: |
try: |
389 |
if not clear: |
if not clear: |
390 |
self.do_redraw() |
self.do_redraw() |
654 |
Set the scale so that the map fits exactly into the window and |
Set the scale so that the map fits exactly into the window and |
655 |
center it in the window. |
center it in the window. |
656 |
""" |
""" |
657 |
bbox = self.map.ProjectedBoundingBox() |
if self.map is not None: |
658 |
if bbox is not None: |
bbox = self.map.ProjectedBoundingBox() |
659 |
self.FitRectToWindow(bbox) |
if bbox is not None: |
660 |
|
self.FitRectToWindow(bbox) |
661 |
|
|
662 |
def FitLayerToWindow(self, layer): |
def FitLayerToWindow(self, layer): |
663 |
"""Fit the given layer to the window. |
"""Fit the given layer to the window. |