104 |
toolbar.SetToolBitmapSize(wxSize(24, 24)) |
toolbar.SetToolBitmapSize(wxSize(24, 24)) |
105 |
|
|
106 |
for name in ["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
for name in ["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
107 |
"map_identify_tool", "map_label_tool"]: |
"map_identify_tool", "map_label_tool", "map_full_extent"]: |
108 |
self.add_toolbar_command(toolbar, name) |
self.add_toolbar_command(toolbar, name) |
109 |
# call Realize to make sure that the tools appear. |
# call Realize to make sure that the tools appear. |
110 |
toolbar.Realize() |
toolbar.Realize() |
421 |
map = self.canvas.Map() |
map = self.canvas.Map() |
422 |
proj = map.projection |
proj = map.projection |
423 |
if proj is None: |
if proj is None: |
424 |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, None) |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, None, map.BoundingBox()) |
425 |
else: |
else: |
426 |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, map.projection.params) |
proj4Dlg = proj4dialog.Proj4Dialog(NULL, map.projection.params, |
427 |
|
map.BoundingBox()) |
428 |
if proj4Dlg.ShowModal() == wxID_OK: |
if proj4Dlg.ShowModal() == wxID_OK: |
429 |
params = proj4Dlg.GetParams() |
params = proj4Dlg.GetParams() |
430 |
if params is not None: |
if params is not None: |
477 |
"""Call the context's method methodname with args *args""" |
"""Call the context's method methodname with args *args""" |
478 |
apply(getattr(context, methodname), args) |
apply(getattr(context, methodname), args) |
479 |
|
|
480 |
def _method_command(name, title, method, helptext = "", sensitive = None): |
def _method_command(name, title, method, helptext = "", |
481 |
|
icon = "", sensitive = None): |
482 |
"""Add a command implemented by a method of the context object""" |
"""Add a command implemented by a method of the context object""" |
483 |
registry.Add(Command(name, title, call_method, args=(method,), |
registry.Add(Command(name, title, call_method, args=(method,), |
484 |
helptext = helptext, sensitive = sensitive)) |
helptext = helptext, icon = icon, |
485 |
|
sensitive = sensitive)) |
486 |
|
|
487 |
def _tool_command(name, title, method, toolname, helptext = "", |
def _tool_command(name, title, method, toolname, helptext = "", |
488 |
icon = ""): |
icon = ""): |
489 |
"""Add a tool command""" |
"""Add a tool command""" |
521 |
helptext = "Switch to map-mode 'identify'", icon = "identify") |
helptext = "Switch to map-mode 'identify'", icon = "identify") |
522 |
_tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool", |
_tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool", |
523 |
helptext = "Add/Remove labels", icon = "label") |
helptext = "Add/Remove labels", icon = "label") |
524 |
_method_command("map_full_extent", "&Full extent", "FullExtent") |
_method_command("map_full_extent", "&Full extent", "FullExtent", |
525 |
|
helptext = "Full Extent", icon = "fullextent") |
526 |
_method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map") |
_method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map") |
527 |
|
|
528 |
# Layer menu |
# Layer menu |