65 |
|
|
66 |
menu = wxMenu() |
menu = wxMenu() |
67 |
menuBar.Append(menu, "&Map"); |
menuBar.Append(menu, "&Map"); |
68 |
for name in ["map_projection", |
for name in ["layer_add", "layer_remove", |
69 |
|
None, |
70 |
|
"map_projection", |
71 |
None, |
None, |
72 |
"map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
"map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool", |
73 |
"map_identify_tool", "map_label_tool", |
"map_identify_tool", "map_label_tool", |
79 |
|
|
80 |
menu = wxMenu() |
menu = wxMenu() |
81 |
menuBar.Append(menu, "&Layer"); |
menuBar.Append(menu, "&Layer"); |
82 |
for name in ["layer_add", "layer_remove", |
for name in ["layer_fill_color", "layer_transparent_fill", |
|
None, |
|
|
"layer_fill_color", "layer_transparent_fill", |
|
83 |
"layer_ourline_color", "layer_no_outline", |
"layer_ourline_color", "layer_no_outline", |
84 |
None, |
None, |
85 |
"layer_raise", "layer_lower", |
"layer_raise", "layer_lower", |
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() |
259 |
dlg.Destroy() |
dlg.Destroy() |
260 |
|
|
261 |
def SaveSession(self): |
def SaveSession(self): |
262 |
|
if main.app.session.filename == None: |
263 |
|
self.SaveSessionAs() |
264 |
main.app.SaveSession() |
main.app.SaveSession() |
265 |
|
|
266 |
def SaveSessionAs(self): |
def SaveSessionAs(self): |
304 |
wxOK | wxICON_INFORMATION) |
wxOK | wxICON_INFORMATION) |
305 |
|
|
306 |
def AddLayer(self): |
def AddLayer(self): |
307 |
dlg = wxFileDialog(self, "Select a session file", ".", "", "*.*", |
dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*", |
308 |
wxOPEN) |
wxOPEN) |
309 |
if dlg.ShowModal() == wxID_OK: |
if dlg.ShowModal() == wxID_OK: |
310 |
filename = dlg.GetPath() |
filename = dlg.GetPath() |
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 |
529 |
_method_command("layer_add", "&Add", "AddLayer", |
_method_command("layer_add", "&Add Layer", "AddLayer", |
530 |
helptext = "Add a new layer to active map") |
helptext = "Add a new layer to active map") |
531 |
_method_command("layer_remove", "&Remove", "RemoveLayer", |
_method_command("layer_remove", "&Remove Layer", "RemoveLayer", |
532 |
helptext = "Remove selected layer(s)", |
helptext = "Remove selected layer(s)", |
533 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
534 |
_method_command("layer_fill_color", "&Fill Color", "LayerFillColor", |
_method_command("layer_fill_color", "&Fill Color", "LayerFillColor", |