43 |
|
|
44 |
import labeldialog |
import labeldialog |
45 |
|
|
46 |
from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION |
from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION, \ |
47 |
|
SCALE_CHANGED |
48 |
|
|
49 |
|
|
50 |
# |
# |
278 |
delegated_methods = {"SelectLayer": "selection", |
delegated_methods = {"SelectLayer": "selection", |
279 |
"SelectShapes": "selection", |
"SelectShapes": "selection", |
280 |
"SelectedLayer": "selection", |
"SelectedLayer": "selection", |
281 |
"HasSelectedLayer": "selection"} |
"HasSelectedLayer": "selection", |
282 |
|
"HasSelectedShapes": "selection"} |
283 |
|
|
284 |
def __init__(self, parent, winid): |
def __init__(self, parent, winid): |
285 |
wxWindow.__init__(self, parent, winid) |
wxWindow.__init__(self, parent, winid) |
476 |
self.scale = scale |
self.scale = scale |
477 |
self.offset = offset |
self.offset = offset |
478 |
self.full_redraw() |
self.full_redraw() |
479 |
|
self.issue(SCALE_CHANGED, scale) |
480 |
|
|
481 |
def proj_to_win(self, x, y): |
def proj_to_win(self, x, y): |
482 |
"""\ |
"""\ |
532 |
proj = self.map.GetProjection() |
proj = self.map.GetProjection() |
533 |
if proj is not None: |
if proj is not None: |
534 |
bbox = proj.ForwardBBox(bbox) |
bbox = proj.ForwardBBox(bbox) |
535 |
if bbox is not None: |
|
536 |
self.FitRectToWindow(bbox) |
if bbox is not None: |
537 |
|
self.FitRectToWindow(bbox) |
538 |
|
|
539 |
|
def FitSelectedToWindow(self): |
540 |
|
layer = self.selection.SelectedLayer() |
541 |
|
shapes = self.selection.SelectedShapes() |
542 |
|
|
543 |
|
bbox = layer.ShapesBoundingBox(shapes) |
544 |
|
if bbox is not None: |
545 |
|
proj = self.map.GetProjection() |
546 |
|
if proj is not None: |
547 |
|
bbox = proj.ForwardBBox(bbox) |
548 |
|
|
549 |
|
if bbox is not None: |
550 |
|
self.FitRectToWindow(bbox) |
551 |
|
|
552 |
def ZoomFactor(self, factor, center = None): |
def ZoomFactor(self, factor, center = None): |
553 |
"""Multiply the zoom by factor and center on center. |
"""Multiply the zoom by factor and center on center. |