GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gcp/toolbars.py
Go to the documentation of this file.
1 """!
2 @package gcp.toolbars
3 
4 @brief Georectification module - toolbars
5 
6 Classes:
7  - toolbars::GCPManToolbar
8  - toolbars::GCPDisplayToolbar
9 
10 (C) 2007-2011 by the GRASS Development Team
11 
12 This program is free software under the GNU General Public License
13 (>=v2). Read the file COPYING that comes with GRASS for details.
14 
15 @author Markus Metz
16 """
17 
18 import os
19 import sys
20 
21 import wx
22 
23 from core import globalvar
24 from gui_core.toolbars import BaseToolbar, BaseIcons
25 from icon import MetaIcon
26 
28  """!Toolbar for managing ground control points
29 
30  @param parent reference to GCP widget
31  """
32  def __init__(self, parent):
33  BaseToolbar.__init__(self, parent)
34 
35  self.InitToolbar(self._toolbarData())
36 
37  # realize the toolbar
38  self.Realize()
39 
40  def _toolbarData(self):
41  icons = {
42  'gcpAdd' : MetaIcon(img = 'gcp-add',
43  label = _('Add new GCP to the list')),
44  'gcpDelete' : MetaIcon(img = 'gcp-delete',
45  label = _('Delete selected GCP')),
46  'gcpClear' : MetaIcon(img = 'gcp-remove',
47  label = _('Clear selected GCP')),
48  'gcpRms' : MetaIcon(img = 'gcp-rms',
49  label = _('Recalculate RMS error')),
50  'georectify' : MetaIcon(img = 'georectify',
51  label = _('Georectify')),
52  'gcpSave' : MetaIcon(img = 'gcp-save',
53  label = _('Save GCPs to POINTS file')),
54  'gcpReload' : MetaIcon(img = 'reload',
55  label = _('Reload GCPs from POINTS file')),
56  }
57 
58  return self._getToolbarData((('gcpAdd', icons["gcpAdd"],
59  self.parent.AddGCP),
60  ('gcpDelete', icons["gcpDelete"],
61  self.parent.DeleteGCP),
62  ('gcpClear', icons["gcpClear"],
63  self.parent.ClearGCP),
64  (None, ),
65  ('rms', icons["gcpRms"],
66  self.parent.OnRMS),
67  ('georect', icons["georectify"],
68  self.parent.OnGeorect),
69  (None, ),
70  ('gcpSave', icons["gcpSave"],
71  self.parent.SaveGCPs),
72  ('gcpReload', icons["gcpReload"],
73  self.parent.ReloadGCPs))
74  )
75 
77  """
78  GCP Display toolbar
79  """
80  def __init__(self, parent):
81  """!
82  GCP Display toolbar constructor
83  """
84  BaseToolbar.__init__(self, parent)
85 
86  self.InitToolbar(self._toolbarData())
87 
88  # add tool to toggle active map window
89  self.togglemapid = wx.NewId()
90  self.togglemap = wx.Choice(parent = self, id = self.togglemapid,
91  choices = [_('source'), _('target')])
92 
93  self.InsertControl(10, self.togglemap)
94 
95  self.SetToolShortHelp(self.togglemapid, '%s %s %s' % (_('Set map canvas for '),
96  BaseIcons["zoomBack"].GetLabel(),
97  _(' / Zoom to map')))
98 
99  # realize the toolbar
100  self.Realize()
101 
102  self.action = { 'id' : self.gcpset }
103  self.defaultAction = { 'id' : self.gcpset,
104  'bind' : self.parent.OnPointer }
105 
106  self.OnTool(None)
107 
108  self.EnableTool(self.zoomback, False)
109 
110  def _toolbarData(self):
111  """!Toolbar data"""
112  icons = {
113  'gcpSet' : MetaIcon(img = 'gcp-create',
114  label = _('Update GCP coordinates'),
115  desc = _('Update GCP coordinates)')),
116  'quit' : BaseIcons['quit'].SetLabel(_('Quit georectification tool')),
117  'settings' : BaseIcons['settings'].SetLabel( _('Georectifier settings')),
118  'help' : BaseIcons['help'].SetLabel(_('Georectifier manual')),
119  }
120 
121  return self._getToolbarData((("displaymap", BaseIcons["display"],
122  self.parent.OnDraw),
123  ("rendermap", BaseIcons["render"],
124  self.parent.OnRender),
125  ("erase", BaseIcons["erase"],
126  self.parent.OnErase),
127  (None, ),
128  ("gcpset", icons["gcpSet"],
129  self.parent.OnPointer,
130  wx.ITEM_CHECK),
131  ("pan", BaseIcons["pan"],
132  self.parent.OnPan,
133  wx.ITEM_CHECK),
134  ("zoomin", BaseIcons["zoomIn"],
135  self.parent.OnZoomIn,
136  wx.ITEM_CHECK),
137  ("zoomout", BaseIcons["zoomOut"],
138  self.parent.OnZoomOut,
139  wx.ITEM_CHECK),
140  ("zoommenu", BaseIcons["zoomMenu"],
141  self.parent.OnZoomMenuGCP),
142  (None, ),
143  ("zoomback", BaseIcons["zoomBack"],
144  self.parent.OnZoomBack),
145  ("zoomtomap", BaseIcons["zoomExtent"],
146  self.parent.OnZoomToMap),
147  (None, ),
148  ('settings', icons["settings"],
149  self.parent.OnSettings),
150  ('help', icons["help"],
151  self.parent.OnHelp),
152  (None, ),
153  ('quit', icons["quit"],
154  self.parent.OnQuit))
155  )
Toolbar for managing ground control points.
Definition: gcp/toolbars.py:27
def OnTool
Tool selected.
def _getToolbarData
Define tool.
def InitToolbar
Initialize toolbar, add tools to the toolbar.
Abstract toolbar class.
Base classes toolbar widgets.
def _toolbarData
Toolbar data.
def __init__
GCP Display toolbar constructor.
Definition: gcp/toolbars.py:80