1 |
jschuengel |
2257 |
# -*- coding:latin1 -*- |
2 |
|
|
# Copyright (C) 2004 by Intevation GmbH |
3 |
|
|
# Authors: |
4 |
|
|
# Jan Schüngel <[email protected]> |
5 |
|
|
# |
6 |
|
|
# This program is free software under the GPL (>=v2) |
7 |
|
|
# Read the file COPYING coming with Thuban for details. |
8 |
|
|
|
9 |
|
|
""" |
10 |
|
|
This modul extend Thuban with the possibility to handle |
11 |
|
|
UMN MapServer mapfiles. |
12 |
|
|
""" |
13 |
|
|
|
14 |
|
|
__version__ = "$Revision$" |
15 |
|
|
# $Source$ |
16 |
|
|
# $Id$ |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
# ################################### |
20 |
|
|
# |
21 |
|
|
# import necessary modules |
22 |
|
|
# |
23 |
|
|
# ################################### |
24 |
|
|
|
25 |
|
|
import os, sys |
26 |
|
|
|
27 |
|
|
# mapscript |
28 |
jschuengel |
2318 |
from mapscript import mapObj, layerObj |
29 |
jschuengel |
2257 |
|
30 |
dpinte |
2719 |
# wx.Python support |
31 |
|
|
import wx |
32 |
|
|
from wx import grid |
33 |
jschuengel |
2257 |
|
34 |
|
|
# Thuban |
35 |
|
|
# use _() already now for all strings that may later be translated |
36 |
|
|
from Thuban import _ |
37 |
|
|
|
38 |
|
|
# Thuban has named commands which can be registered in the central |
39 |
|
|
# instance registry. |
40 |
|
|
from Thuban.UI.command import registry, Command |
41 |
|
|
|
42 |
|
|
# needed to add the new menu |
43 |
|
|
from Thuban.UI.mainwindow import main_menu |
44 |
|
|
|
45 |
|
|
# import Map Object for the Mapfile |
46 |
|
|
from mapfile import MF_Map |
47 |
|
|
|
48 |
|
|
from Thuban.UI.colordialog import ColorDialog |
49 |
|
|
|
50 |
|
|
from mapfile import unit_type, legend_status_type, legend_position_type, \ |
51 |
jschuengel |
2267 |
label_font_type, scalebar_status_type, scalebar_style_type, \ |
52 |
jschuengel |
2274 |
scalebar_position_type, label_position_type |
53 |
jschuengel |
2257 |
|
54 |
|
|
# ################################### |
55 |
|
|
# |
56 |
|
|
# Mainpart of the Extension |
57 |
|
|
# |
58 |
|
|
# ################################### |
59 |
|
|
|
60 |
|
|
ID_COLOR_CHANGE= 8001 |
61 |
jschuengel |
2267 |
ID_IMGCOLOR_CHANGE = 8002 |
62 |
jschuengel |
2257 |
|
63 |
dpinte |
2719 |
class Map_Dialog(wx.Dialog): |
64 |
jschuengel |
2257 |
|
65 |
|
|
def __init__(self, parent, ID, title, |
66 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
67 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
68 |
jschuengel |
2257 |
|
69 |
|
|
# initialize the Dialog |
70 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
71 |
jschuengel |
2257 |
|
72 |
|
|
# parent.canvas.Map() |
73 |
|
|
self.tb_map = parent.canvas.Map() |
74 |
|
|
self.tb_map_umn = self.tb_map.extension_umn_mapobj |
75 |
|
|
|
76 |
|
|
# create name |
77 |
dpinte |
2719 |
box_name = wx.BoxSizer(wx.HORIZONTAL) |
78 |
|
|
box_name.Add(wx.StaticText(self, -1, _("Map-Name:")), 0, |
79 |
|
|
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
80 |
|
|
box_name.Add(wx.StaticText(self, -1, self.tb_map.Title()), 0, |
81 |
|
|
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
82 |
jschuengel |
2257 |
|
83 |
|
|
#create size settings |
84 |
jschuengel |
2271 |
insidetxt = self.tb_map_umn.get_size() |
85 |
dpinte |
2719 |
staticSize = wx.StaticBox(self, 1010, _("Size"), style = 0, |
86 |
jschuengel |
2274 |
name = "staticBox", ) |
87 |
dpinte |
2719 |
box_size = wx.StaticBoxSizer(staticSize, wx.VERTICAL) |
88 |
jschuengel |
2257 |
|
89 |
dpinte |
2719 |
box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL) |
90 |
|
|
box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 4) |
91 |
|
|
self.text_width = wx.TextCtrl(self, -1, str(insidetxt[0])) |
92 |
|
|
box_sizepartWidth.Add(self.text_width, 2, wx.ALL, 4) |
93 |
|
|
box_size.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 5) |
94 |
|
|
box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL) |
95 |
|
|
box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, |
96 |
|
|
wx.ALL, 4) |
97 |
|
|
self.text_height = wx.TextCtrl(self, -1, str(insidetxt[1])) |
98 |
|
|
box_sizepartHeight.Add(self.text_height, 2, wx.ALL, 4) |
99 |
|
|
box_size.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 5) |
100 |
jschuengel |
2257 |
|
101 |
jschuengel |
2282 |
# get the web object |
102 |
|
|
self.tb_map = parent.canvas.Map() |
103 |
|
|
self.tb_map_umn = self.tb_map.extension_umn_mapobj |
104 |
|
|
|
105 |
|
|
#get the imagetype |
106 |
|
|
umn_imagetype = self.tb_map_umn.get_imagetype() |
107 |
|
|
# create a list with the outputformat names |
108 |
|
|
umn_outputformats = [] |
109 |
|
|
for format in self.tb_map_umn.get_alloutputformats(): |
110 |
|
|
umn_outputformats.append(format.get_name()) |
111 |
|
|
#Imagetype selector |
112 |
dpinte |
2719 |
box_imagetypeStatic = wx.StaticBox(self, -1, _("Image Type"), |
113 |
jschuengel |
2282 |
style = 0, name = "imagetype") |
114 |
dpinte |
2719 |
box_imagetype = wx.StaticBoxSizer(box_imagetypeStatic, wx.VERTICAL) |
115 |
|
|
self.choice_imgtype = wx.Choice(self, 8060, (80, 50), |
116 |
jschuengel |
2282 |
choices = umn_outputformats) |
117 |
|
|
EVT_CHOICE(self, 8060, self.EvtChoiceBox) |
118 |
|
|
self.choice_imgtype.SetStringSelection(umn_imagetype) |
119 |
dpinte |
2719 |
box_imagetype.Add(self.choice_imgtype,0, wx.EXPAND, wx.ALL, 5) |
120 |
jschuengel |
2282 |
|
121 |
jschuengel |
2274 |
#unittype |
122 |
jschuengel |
2257 |
insideunit = self.tb_map_umn.get_units() |
123 |
jschuengel |
2274 |
#Unittype selector |
124 |
dpinte |
2719 |
box_unitsStatic = wx.StaticBox(self, 1011, _("Unit Type"), |
125 |
jschuengel |
2274 |
style = 0, name = "imagecolor") |
126 |
dpinte |
2719 |
box_units = wx.StaticBoxSizer(box_unitsStatic, wx.VERTICAL) |
127 |
jschuengel |
2257 |
sam = [] |
128 |
|
|
for key in unit_type: |
129 |
|
|
sam.append(unit_type[key]) |
130 |
dpinte |
2719 |
self.choice_units = wx.Choice(self, 40, (80, 50), choices = sam) |
131 |
jschuengel |
2257 |
self.choice_units.SetStringSelection(insideunit) |
132 |
dpinte |
2719 |
box_units.Add(self.choice_units,0, wx.EXPAND, wx.ALL, 5) |
133 |
jschuengel |
2257 |
|
134 |
|
|
# color chouser |
135 |
dpinte |
2719 |
box_colorStatic = wx.StaticBox(self, 1011, _("ImageColor"), |
136 |
jschuengel |
2274 |
style = 0, name = "imagecolor") |
137 |
dpinte |
2719 |
box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL) |
138 |
jschuengel |
2257 |
|
139 |
|
|
# preview box |
140 |
dpinte |
2719 |
self.previewcolor = wx.Panel(self,99, name = 'backgroundPanel', |
141 |
|
|
style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN) |
142 |
jschuengel |
2257 |
imagecolor = self.tb_map_umn.get_imagecolor() |
143 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(imagecolor.get_red(), |
144 |
jschuengel |
2257 |
imagecolor.get_green(), imagecolor.get_blue())) |
145 |
dpinte |
2719 |
box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5) |
146 |
jschuengel |
2257 |
# color change button, opens a new color dialog |
147 |
dpinte |
2719 |
button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color")) |
148 |
jschuengel |
2257 |
button.SetFocus() |
149 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
150 |
dpinte |
2719 |
box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5) |
151 |
jschuengel |
2257 |
|
152 |
jschuengel |
2271 |
# status |
153 |
|
|
umn_status = self.tb_map_umn.get_status() |
154 |
dpinte |
2719 |
self.choice_status = wx.RadioBox(self, -1, choices=["True","False"], |
155 |
jschuengel |
2271 |
label='status', majorDimension=1, |
156 |
dpinte |
2719 |
name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS) |
157 |
jschuengel |
2271 |
self.choice_status.SetStringSelection(str(umn_status)) |
158 |
|
|
|
159 |
jschuengel |
2257 |
#buttons |
160 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
161 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
162 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
163 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
164 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
165 |
jschuengel |
2274 |
#button functions |
166 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
167 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
168 |
jschuengel |
2257 |
|
169 |
|
|
#add all boxes to the box top |
170 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
171 |
|
|
top.Add(box_name, 0, wx.EXPAND |wx.ALL, 5) |
172 |
|
|
top.Add(box_size, 0, wx.EXPAND |wx.ALL, 5) |
173 |
|
|
top.Add(box_imagetype,0, wx.EXPAND |wx.ALL, 5) |
174 |
|
|
top.Add(box_units,0, wx.EXPAND |wx.ALL, 5) |
175 |
|
|
top.Add(box_color,0, wx.EXPAND |wx.ALL, 5) |
176 |
|
|
top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5) |
177 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
178 |
jschuengel |
2257 |
|
179 |
|
|
# final layout settings |
180 |
|
|
self.SetSizer(top) |
181 |
|
|
top.Fit(self) |
182 |
|
|
|
183 |
|
|
def OnChangeColor(self, event): |
184 |
|
|
cur = self.tb_map_umn.get_imagecolor().get_thubancolor() |
185 |
|
|
dialog = ColorDialog(self) |
186 |
|
|
dialog.SetColor(cur) |
187 |
|
|
self.retcolor = None |
188 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
189 |
jschuengel |
2257 |
self.retcolor = dialog.GetColor() |
190 |
|
|
dialog.Destroy() |
191 |
|
|
if self.retcolor: |
192 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
193 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
194 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
195 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour((self.redcolor), |
196 |
jschuengel |
2257 |
int(self.greencolor), int(self.bluecolor))) |
197 |
jschuengel |
2282 |
# refresh the colorbox to show the new color |
198 |
|
|
self.previewcolor.Refresh() |
199 |
|
|
|
200 |
|
|
def EvtChoiceBox(self, event): |
201 |
|
|
outformat = self.tb_map_umn.get_outputformat().get_name() |
202 |
jschuengel |
2257 |
|
203 |
|
|
def RunDialog(self): |
204 |
|
|
self.ShowModal() |
205 |
|
|
self.Destroy() |
206 |
|
|
|
207 |
|
|
def end_dialog(self, result): |
208 |
|
|
self.result = result |
209 |
|
|
if self.result is not None: |
210 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
211 |
jschuengel |
2257 |
else: |
212 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
213 |
jschuengel |
2257 |
self.Show(False) |
214 |
|
|
|
215 |
|
|
def OnOK(self, event): |
216 |
jschuengel |
2271 |
self.tb_map_umn.set_size(int(self.text_width.GetValue()), |
217 |
|
|
int(self.text_height.GetValue())) |
218 |
jschuengel |
2257 |
self.tb_map_umn.set_units(self.choice_units.GetStringSelection()) |
219 |
jschuengel |
2271 |
if self.choice_status.GetStringSelection() == "True": |
220 |
|
|
self.tb_map_umn.set_status(True) |
221 |
|
|
else: |
222 |
|
|
self.tb_map_umn.set_status(False) |
223 |
jschuengel |
2267 |
previewcolor = self.previewcolor.GetBackgroundColour() |
224 |
|
|
self.tb_map_umn.get_imagecolor().set_rgbcolor(previewcolor.Red(), |
225 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
226 |
jschuengel |
2271 |
self.tb_map_umn.set_imagetype(self.choice_imgtype.GetStringSelection()) |
227 |
|
|
self.result ="OK" |
228 |
|
|
self.end_dialog(self.result) |
229 |
|
|
|
230 |
|
|
def OnCancel(self, event): |
231 |
|
|
self.end_dialog(None) |
232 |
|
|
|
233 |
|
|
|
234 |
dpinte |
2719 |
class Web_Dialog(wx.Dialog): |
235 |
jschuengel |
2257 |
|
236 |
|
|
def __init__(self, parent, ID, title, |
237 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
238 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
239 |
jschuengel |
2257 |
|
240 |
|
|
# initialize the Dialog |
241 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
242 |
jschuengel |
2257 |
|
243 |
|
|
# get the web object |
244 |
|
|
self.tb_map = parent.canvas.Map() |
245 |
|
|
self.umn_web = self.tb_map.extension_umn_mapobj.get_web() |
246 |
jschuengel |
2282 |
|
247 |
|
|
# Template |
248 |
dpinte |
2719 |
box_template = wx.BoxSizer(wx.HORIZONTAL) |
249 |
|
|
box_template.Add(wx.StaticText(self, -1, _("Template:")), 0, |
250 |
|
|
wx.ALL|wx.ALIGN_LEFT, 4) |
251 |
|
|
self.text_template = wx.TextCtrl(self, -1, |
252 |
jschuengel |
2282 |
str(self.umn_web.get_template())) |
253 |
|
|
self.text_template.SetSize((250,self.text_template.GetSize()[1])) |
254 |
|
|
box_template.Add(self.text_template, 0, |
255 |
dpinte |
2719 |
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
256 |
jschuengel |
2282 |
|
257 |
jschuengel |
2257 |
# Imagepath |
258 |
dpinte |
2719 |
box_imagepath = wx.BoxSizer(wx.HORIZONTAL) |
259 |
|
|
box_imagepath.Add(wx.StaticText(self, -1, _("Imagepath:")), 0, |
260 |
|
|
wx.ALL|wx.ALIGN_LEFT, 4) |
261 |
|
|
self.text_imagepath = wx.TextCtrl(self, -1, |
262 |
jschuengel |
2274 |
str(self.umn_web.get_imagepath())) |
263 |
jschuengel |
2257 |
box_imagepath.Add(self.text_imagepath, 0, |
264 |
dpinte |
2719 |
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
265 |
jschuengel |
2257 |
|
266 |
|
|
# Imageurl |
267 |
dpinte |
2719 |
box_imageurl = wx.BoxSizer(wx.HORIZONTAL) |
268 |
|
|
box_imageurl.Add(wx.StaticText(self, -1, _("Imageurl:")), 0, |
269 |
|
|
wx.ALL|wx.ALIGN_LEFT, 4) |
270 |
|
|
self.text_imageurl = wx.TextCtrl(self, -1, |
271 |
jschuengel |
2274 |
str(self.umn_web.get_imageurl())) |
272 |
jschuengel |
2257 |
box_imageurl.Add(self.text_imageurl, 0, |
273 |
dpinte |
2719 |
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
274 |
jschuengel |
2257 |
|
275 |
|
|
#buttons |
276 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
277 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
278 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
279 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
280 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
281 |
jschuengel |
2257 |
#set the button funcitons |
282 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
283 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
284 |
jschuengel |
2271 |
|
285 |
|
|
# compose the final dialog |
286 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
287 |
|
|
top.Add(box_template, 0, wx.EXPAND |wx.ALL, 5) |
288 |
|
|
top.Add(box_imagepath, 0, wx.EXPAND |wx.ALL, 5) |
289 |
|
|
top.Add(box_imageurl, 0, wx.EXPAND |wx.ALL, 5) |
290 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
291 |
jschuengel |
2257 |
|
292 |
|
|
# final layout settings |
293 |
|
|
self.SetSizer(top) |
294 |
|
|
top.Fit(self) |
295 |
|
|
|
296 |
|
|
def RunDialog(self): |
297 |
|
|
self.ShowModal() |
298 |
|
|
self.Destroy() |
299 |
|
|
|
300 |
|
|
def end_dialog(self, result): |
301 |
|
|
self.result = result |
302 |
|
|
if self.result is not None: |
303 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
304 |
jschuengel |
2257 |
else: |
305 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
306 |
jschuengel |
2257 |
self.Show(False) |
307 |
|
|
|
308 |
|
|
def OnOK(self, event): |
309 |
jschuengel |
2282 |
self.umn_web.set_template(self.text_template.GetValue()) |
310 |
jschuengel |
2257 |
self.umn_web.set_imagepath(self.text_imagepath.GetValue()) |
311 |
|
|
self.umn_web.set_imageurl(self.text_imageurl.GetValue()) |
312 |
|
|
self.result ="OK" |
313 |
|
|
self.end_dialog(self.result) |
314 |
|
|
|
315 |
|
|
def OnCancel(self, event): |
316 |
|
|
self.end_dialog(None) |
317 |
|
|
|
318 |
jschuengel |
2303 |
ID_METADATA_CHANGE = 8020 |
319 |
jschuengel |
2257 |
|
320 |
jschuengel |
2303 |
from Extensions.umn_mapserver.mapfile import MF_Layer |
321 |
|
|
|
322 |
dpinte |
2719 |
class Layer_Dialog(wx.Dialog): |
323 |
jschuengel |
2303 |
|
324 |
|
|
def __init__(self, parent, ID, title, |
325 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
326 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
327 |
jschuengel |
2303 |
|
328 |
|
|
# initialize the Dialog |
329 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
330 |
jschuengel |
2303 |
|
331 |
|
|
# get the web object |
332 |
|
|
self.tb_layer = parent.current_layer() |
333 |
jschuengel |
2318 |
if hasattr(self.tb_layer,"extension_umn_layerobj"): |
334 |
|
|
self.umn_layer = self.tb_layer.extension_umn_layerobj |
335 |
|
|
else: |
336 |
|
|
newlayerobj = parent.canvas.Map().extension_umn_mapobj.create_new_layer() |
337 |
|
|
self.tb_layer.extension_umn_layerobj = newlayerobj |
338 |
|
|
self.umn_layer = self.tb_layer.extension_umn_layerobj |
339 |
jschuengel |
2303 |
|
340 |
|
|
# create name |
341 |
dpinte |
2719 |
layer_name = wx.BoxSizer(wx.HORIZONTAL) |
342 |
|
|
layer_name.Add(wx.StaticText(self, -1, _("Layer-Name:")), 0, |
343 |
|
|
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
344 |
|
|
layer_name.Add(wx.StaticText(self, -1, self.tb_layer.Title()), 0, |
345 |
|
|
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
346 |
jschuengel |
2303 |
|
347 |
jschuengel |
2318 |
# metadata button |
348 |
dpinte |
2719 |
metadata_button = wx.Button(self, ID_METADATA_CHANGE, _("Edit Metadata")) |
349 |
jschuengel |
2318 |
EVT_BUTTON(self, ID_METADATA_CHANGE, self.OnChangeMetadata) |
350 |
jschuengel |
2303 |
|
351 |
jschuengel |
2318 |
# Group |
352 |
dpinte |
2719 |
box_group = wx.BoxSizer(wx.HORIZONTAL) |
353 |
jschuengel |
2318 |
if self.umn_layer.get_group(): |
354 |
|
|
umn_layer_group = self.umn_layer.get_group() |
355 |
|
|
else: |
356 |
|
|
umn_layer_group = "" |
357 |
dpinte |
2719 |
box_group.Add(wx.StaticText(self, -1, _("Group:")), 0, |
358 |
|
|
wx.ALL|wx.ALIGN_LEFT, 4) |
359 |
|
|
self.text_group = wx.TextCtrl(self, -1, |
360 |
jschuengel |
2318 |
str(umn_layer_group)) |
361 |
|
|
self.text_group.SetSize((250,self.text_group.GetSize()[1])) |
362 |
|
|
box_group.Add(self.text_group, 0, |
363 |
dpinte |
2719 |
wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4) |
364 |
jschuengel |
2318 |
|
365 |
jschuengel |
2303 |
# buttons |
366 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
367 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
368 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
369 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
370 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
371 |
jschuengel |
2303 |
#set the button funcitons |
372 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
373 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
374 |
jschuengel |
2303 |
|
375 |
|
|
# compose the final dialog |
376 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
377 |
|
|
#top.Add(box_template, 0, wx.EXPAND |wx.ALL, 5) |
378 |
|
|
top.Add(layer_name, 0, wx.EXPAND|wx.ALL, 5) |
379 |
|
|
top.Add(box_group, 0, wx.EXPAND|wx.ALL, 5) |
380 |
|
|
top.Add(metadata_button, 0, wx.EXPAND|wx.ALL, 5) |
381 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
382 |
jschuengel |
2303 |
|
383 |
|
|
# final layout settings |
384 |
|
|
self.SetSizer(top) |
385 |
|
|
top.Fit(self) |
386 |
|
|
|
387 |
|
|
def OnChangeMetadata(self, event): |
388 |
|
|
# set the umn_label for scalebar so the Label_Dialog can be used |
389 |
|
|
self.umn_metadata= self.umn_layer.get_metadata() |
390 |
|
|
dialog = Metadata_Dialog(self, -1, "Layer Metadata Settings", |
391 |
dpinte |
2719 |
size=wx.Size(450, 200), |
392 |
|
|
style = wx.DEFAULT_DIALOG_STYLE |
393 |
jschuengel |
2303 |
) |
394 |
|
|
dialog.CenterOnScreen() |
395 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
396 |
jschuengel |
2303 |
return |
397 |
|
|
dialog.Destroy() |
398 |
|
|
|
399 |
|
|
|
400 |
|
|
def RunDialog(self): |
401 |
|
|
self.ShowModal() |
402 |
|
|
self.Destroy() |
403 |
|
|
|
404 |
|
|
def end_dialog(self, result): |
405 |
|
|
self.result = result |
406 |
|
|
if self.result is not None: |
407 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
408 |
jschuengel |
2303 |
else: |
409 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
410 |
jschuengel |
2303 |
self.Show(False) |
411 |
|
|
|
412 |
|
|
def OnOK(self, event): |
413 |
jschuengel |
2318 |
if self.text_group.GetValue() == "": |
414 |
|
|
self.umn_layer.set_group(None) |
415 |
|
|
else: |
416 |
|
|
self.umn_layer.set_group(self.text_group.GetValue()) |
417 |
jschuengel |
2303 |
self.result ="OK" |
418 |
|
|
self.end_dialog(self.result) |
419 |
|
|
|
420 |
|
|
def OnCancel(self, event): |
421 |
|
|
self.end_dialog(None) |
422 |
|
|
|
423 |
|
|
|
424 |
jschuengel |
2257 |
ID_LABEL_CHANGE = 8011 |
425 |
|
|
|
426 |
dpinte |
2719 |
class Legend_Dialog(wx.Dialog): |
427 |
jschuengel |
2257 |
|
428 |
|
|
def __init__(self, parent, ID, title, |
429 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
430 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
431 |
jschuengel |
2257 |
|
432 |
|
|
# initialize the Dialog |
433 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
434 |
jschuengel |
2257 |
|
435 |
|
|
# get the web object |
436 |
|
|
self.tb_map = parent.canvas.Map() |
437 |
|
|
self.umn_legend = self.tb_map.extension_umn_mapobj.get_legend() |
438 |
|
|
|
439 |
|
|
# create the Keysize |
440 |
dpinte |
2719 |
keySize = wx.StaticBox(self, 1010, _("KeySize"), style = 0, |
441 |
jschuengel |
2274 |
name = "KeySize Box", ) |
442 |
dpinte |
2719 |
box_keysize = wx.StaticBoxSizer(keySize, wx.VERTICAL) |
443 |
jschuengel |
2257 |
umn_legend_keysize = self.umn_legend.get_keysize() |
444 |
dpinte |
2719 |
box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL) |
445 |
|
|
box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 2) |
446 |
|
|
self.text_keysize_width = wx.SpinCtrl(self, -1, |
447 |
jschuengel |
2257 |
value=str(umn_legend_keysize[0]), max=100, min=0, |
448 |
dpinte |
2719 |
name='keywidth', style=wx.SP_ARROW_KEYS) |
449 |
|
|
box_sizepartWidth.Add(self.text_keysize_width, 2, wx.ALL, 2) |
450 |
|
|
box_keysize.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
451 |
|
|
box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL) |
452 |
|
|
box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, wx.ALL, 2), |
453 |
|
|
self.text_keysize_height = wx.SpinCtrl(self, -1, |
454 |
jschuengel |
2257 |
value=str(umn_legend_keysize[1]), max=100, min=0, |
455 |
dpinte |
2719 |
name='keyheight', style=wx.SP_ARROW_KEYS) |
456 |
|
|
box_sizepartHeight.Add(self.text_keysize_height, 2, wx.ALL, 2) |
457 |
|
|
box_keysize.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
458 |
jschuengel |
2257 |
|
459 |
|
|
# create the Keyspacing |
460 |
dpinte |
2719 |
keySpacing= wx.StaticBox(self, 1010, _("KeySpacing"), style = 0, |
461 |
jschuengel |
2274 |
name = "KeySpacing Box", ) |
462 |
dpinte |
2719 |
box_keyspacing = wx.StaticBoxSizer(keySpacing, wx.VERTICAL) |
463 |
jschuengel |
2257 |
umn_legend_keyspacing = self.umn_legend.get_keyspacing() |
464 |
dpinte |
2719 |
box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL) |
465 |
|
|
box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 2) |
466 |
|
|
self.text_keyspacing_width = wx.SpinCtrl(self, -1, |
467 |
jschuengel |
2274 |
value=str(umn_legend_keyspacing[0]), max=100, |
468 |
dpinte |
2719 |
min=0, name='spacingwidth', style=wx.SP_ARROW_KEYS) |
469 |
|
|
box_sizepartWidth.Add(self.text_keyspacing_width, 2, wx.ALL, 2) |
470 |
|
|
box_keyspacing.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
471 |
|
|
box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL) |
472 |
|
|
box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, wx.ALL, 2), |
473 |
|
|
self.text_keyspacing_height = wx.SpinCtrl(self, -1, |
474 |
jschuengel |
2274 |
value=str(umn_legend_keyspacing[1]), max=100, |
475 |
dpinte |
2719 |
min=0,name='spacingheight', style=wx.SP_ARROW_KEYS) |
476 |
|
|
box_sizepartHeight.Add(self.text_keyspacing_height, 2, wx.ALL, 2) |
477 |
|
|
box_keyspacing.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
478 |
jschuengel |
2257 |
|
479 |
|
|
# color chooser |
480 |
dpinte |
2719 |
box_colorStatic = wx.StaticBox(self, 1011, _("ImageColor"), style = 0, |
481 |
jschuengel |
2274 |
name = "imagecolor") |
482 |
dpinte |
2719 |
box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL) |
483 |
jschuengel |
2257 |
# preview box |
484 |
dpinte |
2719 |
self.previewcolor = wx.Panel(self, 99, name = 'imagecolorPanel', |
485 |
|
|
style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN) |
486 |
jschuengel |
2257 |
imagecolor = self.umn_legend.get_imagecolor() |
487 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(imagecolor.get_red(), |
488 |
jschuengel |
2257 |
imagecolor.get_green(), imagecolor.get_blue())) |
489 |
dpinte |
2719 |
box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5) |
490 |
jschuengel |
2257 |
# color change button, opens a new color dialog |
491 |
dpinte |
2719 |
button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color")) |
492 |
jschuengel |
2257 |
button.SetFocus() |
493 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
494 |
dpinte |
2719 |
box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5) |
495 |
jschuengel |
2257 |
|
496 |
jschuengel |
2267 |
# status |
497 |
jschuengel |
2274 |
umn_legend_status= self.umn_legend.get_status(mode="string") |
498 |
jschuengel |
2257 |
possible_choices = [] |
499 |
|
|
for key in legend_status_type: |
500 |
|
|
possible_choices.append(legend_status_type[key]) |
501 |
dpinte |
2719 |
self.choice_status = wx.RadioBox(self, -1, choices=possible_choices, |
502 |
jschuengel |
2257 |
label='Status', majorDimension=1, |
503 |
dpinte |
2719 |
name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS) |
504 |
jschuengel |
2257 |
self.choice_status.SetStringSelection(umn_legend_status) |
505 |
|
|
|
506 |
|
|
# create the positionbox |
507 |
jschuengel |
2274 |
umn_legend_position= self.umn_legend.get_position(mode="string") |
508 |
jschuengel |
2257 |
possible_choices = [] |
509 |
|
|
for key in legend_position_type: |
510 |
|
|
possible_choices.append(legend_position_type[key]) |
511 |
dpinte |
2719 |
self.choice_position = wx.RadioBox(self, -1, choices=possible_choices, |
512 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
513 |
|
|
name='position check', |
514 |
dpinte |
2719 |
size=wx.DefaultSize, |
515 |
|
|
style=wx.RA_SPECIFY_ROWS) |
516 |
jschuengel |
2257 |
self.choice_position.SetStringSelection(umn_legend_position) |
517 |
|
|
|
518 |
jschuengel |
2271 |
# button for label |
519 |
dpinte |
2719 |
labelbutton = wx.Button(self, ID_LABEL_CHANGE, _("Change Label")) |
520 |
jschuengel |
2257 |
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel) |
521 |
|
|
|
522 |
|
|
#buttons |
523 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
524 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
525 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
526 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
527 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
528 |
jschuengel |
2257 |
#set the button funcitons |
529 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
530 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
531 |
jschuengel |
2271 |
|
532 |
|
|
# compose the final layout |
533 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
534 |
|
|
top.Add(box_keysize,0, wx.EXPAND |wx.ALL, 5) |
535 |
|
|
top.Add(box_keyspacing,0, wx.EXPAND |wx.ALL, 5) |
536 |
|
|
top.Add(box_color,0, wx.EXPAND |wx.ALL, 5) |
537 |
|
|
top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5) |
538 |
|
|
top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5) |
539 |
|
|
top.Add(labelbutton, 1, wx.EXPAND|wx.ALL, 5) |
540 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
541 |
jschuengel |
2257 |
|
542 |
|
|
# final layout settings |
543 |
|
|
self.SetSizer(top) |
544 |
|
|
top.Fit(self) |
545 |
|
|
|
546 |
|
|
def OnChangeLabel(self, event): |
547 |
jschuengel |
2267 |
self.umn_label = self.umn_legend.get_label() |
548 |
jschuengel |
2274 |
dialog = Label_Dialog(self, -1, "Legend Label Settings", |
549 |
dpinte |
2719 |
size=wx.Size(350, 200), |
550 |
|
|
style = wx.DEFAULT_DIALOG_STYLE |
551 |
jschuengel |
2257 |
) |
552 |
|
|
dialog.CenterOnScreen() |
553 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
554 |
jschuengel |
2257 |
return |
555 |
|
|
dialog.Destroy() |
556 |
|
|
|
557 |
|
|
def OnChangeColor(self, event): |
558 |
|
|
cur = self.umn_legend.get_imagecolor().get_thubancolor() |
559 |
|
|
dialog = ColorDialog(self) |
560 |
|
|
dialog.SetColor(cur) |
561 |
|
|
self.retcolor = None |
562 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
563 |
jschuengel |
2257 |
self.retcolor = dialog.GetColor() |
564 |
|
|
dialog.Destroy() |
565 |
|
|
if self.retcolor: |
566 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
567 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
568 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
569 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor), |
570 |
jschuengel |
2274 |
int(self.greencolor), |
571 |
|
|
int(self.bluecolor))) |
572 |
jschuengel |
2282 |
# refresh the colorbox to show the new color |
573 |
|
|
self.previewcolor.Refresh() |
574 |
jschuengel |
2257 |
|
575 |
|
|
def RunDialog(self): |
576 |
|
|
self.ShowModal() |
577 |
|
|
self.Destroy() |
578 |
|
|
|
579 |
|
|
def end_dialog(self, result): |
580 |
|
|
self.result = result |
581 |
|
|
if self.result is not None: |
582 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
583 |
jschuengel |
2257 |
else: |
584 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
585 |
jschuengel |
2257 |
self.Show(False) |
586 |
|
|
|
587 |
|
|
def OnOK(self, event): |
588 |
jschuengel |
2271 |
self.umn_legend.set_keysize(self.text_keysize_width.GetValue(), |
589 |
|
|
self.text_keysize_height.GetValue()) |
590 |
|
|
self.umn_legend.set_keyspacing(self.text_keyspacing_width.GetValue(), |
591 |
|
|
self.text_keyspacing_height.GetValue()) |
592 |
jschuengel |
2257 |
self.umn_legend.set_status(self.choice_status.GetStringSelection()) |
593 |
|
|
self.umn_legend.set_position(self.choice_position.GetStringSelection()) |
594 |
jschuengel |
2267 |
previewcolor = self.previewcolor.GetBackgroundColour() |
595 |
|
|
self.umn_legend.get_imagecolor().set_rgbcolor(previewcolor.Red(), |
596 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
597 |
jschuengel |
2257 |
self.result ="OK" |
598 |
|
|
self.end_dialog(self.result) |
599 |
|
|
|
600 |
|
|
def OnCancel(self, event): |
601 |
|
|
self.end_dialog(None) |
602 |
|
|
|
603 |
dpinte |
2719 |
class Label_Dialog(wx.Dialog): |
604 |
jschuengel |
2257 |
|
605 |
|
|
def __init__(self, parent, ID, title, |
606 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
607 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
608 |
jschuengel |
2257 |
|
609 |
|
|
# initialize the Dialog |
610 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
611 |
jschuengel |
2257 |
|
612 |
|
|
# get the web object |
613 |
jschuengel |
2267 |
self.umn_label = parent.umn_label |
614 |
jschuengel |
2257 |
|
615 |
|
|
# size |
616 |
dpinte |
2719 |
labelsize= wx.StaticBox(self, 1010, _("Size"), style = 0, |
617 |
jschuengel |
2274 |
name = "Size Box", ) |
618 |
dpinte |
2719 |
box_labelsize = wx.StaticBoxSizer(labelsize, wx.VERTICAL) |
619 |
jschuengel |
2257 |
umn_label_size= self.umn_label.get_size() |
620 |
dpinte |
2719 |
box_size = wx.BoxSizer(wx.HORIZONTAL) |
621 |
|
|
self.text_labelsize = wx.SpinCtrl(self, -1, |
622 |
jschuengel |
2257 |
value=str(umn_label_size), max=10, min=0, |
623 |
dpinte |
2719 |
name='size', style=wx.SP_ARROW_KEYS) |
624 |
|
|
box_size.Add(self.text_labelsize, 2, wx.ALL, 2) |
625 |
|
|
box_labelsize.Add(box_size, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
626 |
jschuengel |
2257 |
|
627 |
|
|
# color chooser |
628 |
dpinte |
2719 |
box_colorStatic = wx.StaticBox(self, 1011, _("Color"), style = 0, |
629 |
jschuengel |
2274 |
name = "color") |
630 |
dpinte |
2719 |
box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL) |
631 |
jschuengel |
2257 |
# preview box |
632 |
dpinte |
2719 |
self.previewcolor = wx.Panel(self, 99, name = 'colorPanel', |
633 |
|
|
style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN) |
634 |
jschuengel |
2257 |
color = self.umn_label.get_color() |
635 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(color.get_red(), |
636 |
jschuengel |
2257 |
color.get_green(), color.get_blue())) |
637 |
dpinte |
2719 |
box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5) |
638 |
jschuengel |
2257 |
# color change button, opens a new color dialog |
639 |
dpinte |
2719 |
button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color")) |
640 |
jschuengel |
2257 |
button.SetFocus() |
641 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
642 |
dpinte |
2719 |
box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5) |
643 |
jschuengel |
2257 |
|
644 |
|
|
#get the set type |
645 |
|
|
insidetype = self.umn_label.get_type() |
646 |
|
|
#create the type selector for fonttype (Bitmap, TrueType) |
647 |
|
|
# TODO: Truetype is not supported yet |
648 |
dpinte |
2719 |
box_typeStatic = wx.StaticBox(self, 1011, _("Type"), style = 0, |
649 |
jschuengel |
2274 |
name = "type") |
650 |
dpinte |
2719 |
box_type = wx.StaticBoxSizer(box_typeStatic, wx.VERTICAL) |
651 |
jschuengel |
2257 |
sam = [] |
652 |
|
|
for key in label_font_type: |
653 |
|
|
# dont add truetype |
654 |
|
|
#if key != 0: |
655 |
|
|
sam.append(label_font_type[key]) |
656 |
dpinte |
2719 |
self.choice_type = wx.Choice(self, 40, (80, 50), choices = sam) |
657 |
jschuengel |
2257 |
self.choice_type.SetStringSelection(insidetype) |
658 |
dpinte |
2719 |
box_type.Add(self.choice_type,0, wx.EXPAND, wx.ALL, 5) |
659 |
jschuengel |
2271 |
|
660 |
jschuengel |
2257 |
# Offset |
661 |
dpinte |
2719 |
offset= wx.StaticBox(self, 1010, _("Offset"), style = 0, |
662 |
jschuengel |
2274 |
name = "Offset Box", ) |
663 |
dpinte |
2719 |
box_offset = wx.StaticBoxSizer(offset, wx.VERTICAL) |
664 |
jschuengel |
2257 |
umn_label_offset = self.umn_label.get_offset() |
665 |
dpinte |
2719 |
box_offsetX = wx.BoxSizer(wx.HORIZONTAL) |
666 |
|
|
box_offsetX.Add(wx.StaticText(self, -1, _("X: ")), 0, wx.ALL, 2) |
667 |
|
|
self.text_offsetx = wx.SpinCtrl(self, -1, |
668 |
jschuengel |
2257 |
value=str(umn_label_offset[0]), max=20, min=0, |
669 |
dpinte |
2719 |
name='offsetX', style=wx.SP_ARROW_KEYS) |
670 |
|
|
box_offsetX.Add(self.text_offsetx, 2, wx.ALL, 2) |
671 |
|
|
box_offset.Add(box_offsetX, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
672 |
|
|
box_offsetY = wx.BoxSizer(wx.HORIZONTAL) |
673 |
|
|
box_offsetY.Add(wx.StaticText(self, -1, _("Y: ")), 0, wx.ALL, 2), |
674 |
|
|
self.text_offsety = wx.SpinCtrl(self, -1, |
675 |
jschuengel |
2257 |
value=str(umn_label_offset[1]), max=100, min=0, |
676 |
dpinte |
2719 |
name='offsetY', style=wx.SP_ARROW_KEYS) |
677 |
|
|
box_offsetY.Add(self.text_offsety, 2, wx.ALL, 2) |
678 |
|
|
box_offset.Add(box_offsetY, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
679 |
jschuengel |
2257 |
|
680 |
jschuengel |
2271 |
# partials |
681 |
jschuengel |
2267 |
umn_partials = self.umn_label.get_partials() |
682 |
dpinte |
2719 |
self.choice_partials = wx.RadioBox(self, -1, choices=["True","False"], |
683 |
jschuengel |
2274 |
label='partials', majorDimension=1, |
684 |
|
|
name='partials check', |
685 |
dpinte |
2719 |
size=wx.DefaultSize, |
686 |
|
|
style=wx.RA_SPECIFY_ROWS) |
687 |
jschuengel |
2267 |
self.choice_partials.SetStringSelection(str(umn_partials)) |
688 |
jschuengel |
2271 |
|
689 |
|
|
# force |
690 |
|
|
umn_force = self.umn_label.get_force() |
691 |
dpinte |
2719 |
self.choice_force = wx.RadioBox(self, -1, choices=["True","False"], |
692 |
jschuengel |
2271 |
label='force', majorDimension=1, |
693 |
dpinte |
2719 |
name='force check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS) |
694 |
jschuengel |
2271 |
self.choice_force.SetStringSelection(str(umn_force)) |
695 |
|
|
|
696 |
|
|
# buffer |
697 |
dpinte |
2719 |
buffer = wx.StaticBox(self, 1010, _("Buffer"), style = 0, |
698 |
jschuengel |
2274 |
name = "Buffer Box", ) |
699 |
dpinte |
2719 |
box_buffer = wx.StaticBoxSizer(buffer, wx.VERTICAL) |
700 |
jschuengel |
2271 |
umn_buffer= self.umn_label.get_buffer() |
701 |
dpinte |
2719 |
box_buffertext = wx.BoxSizer(wx.HORIZONTAL) |
702 |
|
|
self.text_buffer = wx.SpinCtrl(self, -1, |
703 |
jschuengel |
2271 |
value=str(umn_buffer), max=10, min=0, |
704 |
dpinte |
2719 |
name='size', style=wx.SP_ARROW_KEYS) |
705 |
|
|
box_buffertext.Add(self.text_buffer, 2, wx.ALL, 2) |
706 |
|
|
box_buffer.Add(box_buffertext, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
707 |
jschuengel |
2271 |
|
708 |
|
|
# minfeaturesize |
709 |
dpinte |
2719 |
minfeaturesize = wx.StaticBox(self, 1010, _("Minfeaturesize"), |
710 |
jschuengel |
2274 |
style = 0, name = "Minfeaturesize Box") |
711 |
dpinte |
2719 |
box_minfeaturesize = wx.StaticBoxSizer(minfeaturesize, wx.VERTICAL) |
712 |
jschuengel |
2271 |
umn_minfeaturesize= self.umn_label.get_minfeaturesize() |
713 |
dpinte |
2719 |
box_minfeaturesizetext = wx.BoxSizer(wx.HORIZONTAL) |
714 |
|
|
self.text_minfeaturesize = wx.SpinCtrl(self, -1, |
715 |
jschuengel |
2271 |
value=str(umn_minfeaturesize), max=10, min=-1, |
716 |
dpinte |
2719 |
name='minfeaturesize', style=wx.SP_ARROW_KEYS) |
717 |
|
|
box_minfeaturesizetext.Add(self.text_minfeaturesize, 2, wx.ALL, 2) |
718 |
jschuengel |
2271 |
box_minfeaturesize.Add(box_minfeaturesizetext, 0, |
719 |
dpinte |
2719 |
wx.ALIGN_RIGHT | wx.ALL, 2) |
720 |
jschuengel |
2271 |
|
721 |
|
|
# mindistance |
722 |
dpinte |
2719 |
mindistance = wx.StaticBox(self, 1010, _("Mindistance"), style = 0, |
723 |
jschuengel |
2271 |
name = "Mindistance Box", ) |
724 |
dpinte |
2719 |
box_mindistance = wx.StaticBoxSizer(mindistance, wx.VERTICAL) |
725 |
jschuengel |
2271 |
umn_mindistance= self.umn_label.get_mindistance() |
726 |
dpinte |
2719 |
box_mindistancetext = wx.BoxSizer(wx.HORIZONTAL) |
727 |
|
|
self.text_mindistance = wx.SpinCtrl(self, -1, |
728 |
jschuengel |
2271 |
value=str(umn_mindistance), max=10, min=-1, |
729 |
dpinte |
2719 |
name='mindistance', style=wx.SP_ARROW_KEYS) |
730 |
|
|
box_mindistancetext.Add(self.text_mindistance, 2, wx.ALL, 2) |
731 |
jschuengel |
2271 |
box_mindistance.Add(box_mindistancetext, 0, |
732 |
dpinte |
2719 |
wx.ALIGN_RIGHT | wx.ALL, 2) |
733 |
jschuengel |
2257 |
|
734 |
jschuengel |
2271 |
# position |
735 |
jschuengel |
2274 |
umn_label_position= self.umn_label.get_position(mode="string") |
736 |
jschuengel |
2271 |
possible_choices = [] |
737 |
|
|
for key in label_position_type: |
738 |
|
|
possible_choices.append(label_position_type[key]) |
739 |
dpinte |
2719 |
self.choice_position = wx.RadioBox(self, -1, choices=possible_choices, |
740 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
741 |
|
|
name='position check', |
742 |
dpinte |
2719 |
size=wx.DefaultSize, |
743 |
|
|
style=wx.RA_SPECIFY_ROWS) |
744 |
jschuengel |
2271 |
self.choice_position.SetStringSelection(umn_label_position) |
745 |
|
|
|
746 |
jschuengel |
2257 |
#buttons |
747 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
748 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
749 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
750 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
751 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
752 |
jschuengel |
2257 |
#set the button funcitons |
753 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
754 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
755 |
jschuengel |
2271 |
|
756 |
|
|
# compose the Dialog |
757 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
758 |
jschuengel |
2271 |
|
759 |
dpinte |
2719 |
top1 = wx.BoxSizer(wx.HORIZONTAL) |
760 |
|
|
top1.Add(box_labelsize,0, wx.EXPAND |wx.ALL, 5) |
761 |
|
|
top1.Add(box_color,0, wx.EXPAND |wx.ALL, 5) |
762 |
|
|
top1.Add(box_minfeaturesize,0, wx.EXPAND |wx.ALL, 5) |
763 |
jschuengel |
2271 |
|
764 |
dpinte |
2719 |
top2 = wx.BoxSizer(wx.HORIZONTAL) |
765 |
|
|
top2.Add(box_type,0,wx.EXPAND |wx.ALL, 5) |
766 |
|
|
top2.Add(box_offset,0, wx.EXPAND |wx.ALL, 5) |
767 |
|
|
top2.Add(box_mindistance,0, wx.EXPAND |wx.ALL, 5) |
768 |
jschuengel |
2271 |
|
769 |
dpinte |
2719 |
top3 = wx.BoxSizer(wx.HORIZONTAL) |
770 |
|
|
top3.Add(self.choice_partials,0, wx.EXPAND |wx.ALL, 5) |
771 |
|
|
top3.Add(box_buffer,0, wx.EXPAND |wx.ALL, 5) |
772 |
|
|
top3.Add(self.choice_force,0, wx.EXPAND |wx.ALL, 5) |
773 |
jschuengel |
2271 |
|
774 |
dpinte |
2719 |
top.Add(top1, 0, wx.EXPAND) |
775 |
|
|
top.Add(top2, 0, wx.EXPAND) |
776 |
|
|
top.Add(top3, 0, wx.EXPAND) |
777 |
|
|
top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5) |
778 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
779 |
jschuengel |
2271 |
|
780 |
jschuengel |
2257 |
# final layout settings |
781 |
|
|
self.SetSizer(top) |
782 |
|
|
top.Fit(self) |
783 |
|
|
|
784 |
|
|
def OnChangeColor(self, event): |
785 |
|
|
cur = self.umn_label.get_color().get_thubancolor() |
786 |
|
|
dialog = ColorDialog(self) |
787 |
|
|
dialog.SetColor(cur) |
788 |
|
|
self.retcolor = None |
789 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
790 |
jschuengel |
2257 |
self.retcolor = dialog.GetColor() |
791 |
|
|
dialog.Destroy() |
792 |
|
|
if self.retcolor: |
793 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
794 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
795 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
796 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor), |
797 |
jschuengel |
2274 |
int(self.greencolor), |
798 |
|
|
int(self.bluecolor))) |
799 |
jschuengel |
2282 |
# refresh the colorbox to show the new color |
800 |
|
|
self.previewcolor.Refresh() |
801 |
jschuengel |
2257 |
|
802 |
|
|
def RunDialog(self): |
803 |
|
|
self.ShowModal() |
804 |
|
|
self.Destroy() |
805 |
|
|
|
806 |
|
|
def end_dialog(self, result): |
807 |
|
|
self.result = result |
808 |
|
|
if self.result is not None: |
809 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
810 |
jschuengel |
2257 |
else: |
811 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
812 |
jschuengel |
2257 |
self.Show(False) |
813 |
|
|
|
814 |
|
|
def OnOK(self, event): |
815 |
|
|
self.umn_label.set_size(self.text_labelsize.GetValue()) |
816 |
jschuengel |
2274 |
self.umn_label.set_offset(self.text_offsetx.GetValue(), |
817 |
|
|
self.text_offsety.GetValue()) |
818 |
jschuengel |
2257 |
self.umn_label.set_type(self.choice_type.GetStringSelection()) |
819 |
jschuengel |
2267 |
if self.choice_partials.GetStringSelection() == "True": |
820 |
|
|
self.umn_label.set_partials(True) |
821 |
|
|
else: |
822 |
|
|
self.umn_label.set_partials(False) |
823 |
|
|
previewcolor = self.previewcolor.GetBackgroundColour() |
824 |
|
|
self.umn_label.get_color().set_rgbcolor(previewcolor.Red(), |
825 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
826 |
jschuengel |
2271 |
self.umn_label.set_mindistance(self.text_mindistance.GetValue()) |
827 |
|
|
self.umn_label.set_minfeaturesize(self.text_minfeaturesize.GetValue()) |
828 |
|
|
self.umn_label.set_position(self.choice_position.GetStringSelection()) |
829 |
|
|
self.umn_label.set_buffer(self.text_buffer.GetValue()) |
830 |
|
|
if self.choice_force.GetStringSelection() == "True": |
831 |
|
|
self.umn_label.set_force(True) |
832 |
|
|
else: |
833 |
|
|
self.umn_label.set_force(False) |
834 |
jschuengel |
2257 |
self.result ="OK" |
835 |
|
|
self.end_dialog(self.result) |
836 |
|
|
|
837 |
|
|
def OnCancel(self, event): |
838 |
|
|
self.end_dialog(None) |
839 |
|
|
|
840 |
dpinte |
2719 |
class Scalebar_Dialog(wx.Dialog): |
841 |
jschuengel |
2267 |
|
842 |
|
|
def __init__(self, parent, ID, title, |
843 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
844 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
845 |
jschuengel |
2267 |
|
846 |
|
|
# initialize the Dialog |
847 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
848 |
jschuengel |
2257 |
|
849 |
jschuengel |
2267 |
# get the web object |
850 |
|
|
self.tb_map = parent.canvas.Map() |
851 |
|
|
self.umn_scalebar = self.tb_map.extension_umn_mapobj.get_scalebar() |
852 |
|
|
|
853 |
|
|
# color chooser |
854 |
dpinte |
2719 |
box_colorStatic = wx.StaticBox(self, 1011, _("Color"), style = 0, |
855 |
jschuengel |
2274 |
name = "color") |
856 |
dpinte |
2719 |
box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL) |
857 |
jschuengel |
2267 |
# preview box |
858 |
dpinte |
2719 |
self.previewcolor = wx.Panel(self, 99, name = 'colorPanel', |
859 |
|
|
style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN) |
860 |
jschuengel |
2267 |
color = self.umn_scalebar.get_color() |
861 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(color.get_red(), |
862 |
jschuengel |
2267 |
color.get_green(), color.get_blue())) |
863 |
dpinte |
2719 |
box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5) |
864 |
jschuengel |
2267 |
# color change button, opens a new color dialog |
865 |
dpinte |
2719 |
button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color")) |
866 |
jschuengel |
2267 |
button.SetFocus() |
867 |
|
|
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor) |
868 |
dpinte |
2719 |
box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5) |
869 |
jschuengel |
2267 |
# show the two color chooser horizontal |
870 |
dpinte |
2719 |
colorHor = wx.BoxSizer(wx.HORIZONTAL) |
871 |
|
|
colorHor.Add(box_color,0, wx.EXPAND |wx.ALL, 5) |
872 |
jschuengel |
2267 |
|
873 |
|
|
# imagecolor chooser |
874 |
dpinte |
2719 |
box_imgcolorStatic = wx.StaticBox(self, 1011, _("Image Color"), |
875 |
jschuengel |
2274 |
style = 0, name = "imgcolor") |
876 |
dpinte |
2719 |
box_imgcolor = wx.StaticBoxSizer(box_imgcolorStatic, wx.VERTICAL) |
877 |
jschuengel |
2267 |
# preview box |
878 |
dpinte |
2719 |
self.previewimgcolor = wx.Panel(self, 99, name = 'colorPanel', |
879 |
|
|
style = wx.SIMPLE_BORDER|wx.CLIP_CHILDREN) |
880 |
jschuengel |
2267 |
color = self.umn_scalebar.get_imagecolor() |
881 |
dpinte |
2719 |
self.previewimgcolor.SetBackgroundColour(wx.Colour(color.get_red(), |
882 |
jschuengel |
2267 |
color.get_green(), color.get_blue())) |
883 |
dpinte |
2719 |
box_imgcolor.Add(self.previewimgcolor, 1, wx.GROW | wx.ALL, 5) |
884 |
jschuengel |
2267 |
# color change button, opens a new color dialog |
885 |
dpinte |
2719 |
button = wx.Button(self, ID_IMGCOLOR_CHANGE, _("Change ImageColor")) |
886 |
jschuengel |
2267 |
button.SetFocus() |
887 |
|
|
EVT_BUTTON(self, ID_IMGCOLOR_CHANGE, self.OnChangeImageColor) |
888 |
dpinte |
2719 |
box_imgcolor.Add(button, 1, wx.EXPAND|wx.ALL, 5) |
889 |
|
|
colorHor.Add(box_imgcolor,0, wx.EXPAND |wx.ALL, 5) |
890 |
jschuengel |
2267 |
|
891 |
|
|
# create the intervals |
892 |
dpinte |
2719 |
intervalsStatic = wx.StaticBox(self, 1010, _("Intervals"), style = 0, |
893 |
jschuengel |
2274 |
name = "Intervals Box", ) |
894 |
dpinte |
2719 |
box_intervals = wx.StaticBoxSizer(intervalsStatic, wx.VERTICAL) |
895 |
jschuengel |
2267 |
umn_scalebar_intervals = self.umn_scalebar.get_intervals() |
896 |
dpinte |
2719 |
self.text_intervals = wx.SpinCtrl(self, -1, |
897 |
jschuengel |
2267 |
value=str(umn_scalebar_intervals), max=100, min=0, |
898 |
dpinte |
2719 |
name='intervals', style=wx.SP_ARROW_KEYS) |
899 |
|
|
box_intervals.Add(self.text_intervals, 0, wx.ALIGN_RIGHT | wx.ALL, 2) |
900 |
|
|
hori2 = wx.BoxSizer(wx.HORIZONTAL) |
901 |
|
|
hori2.Add(box_intervals,0, wx.EXPAND |wx.ALL, 5) |
902 |
jschuengel |
2267 |
|
903 |
|
|
#style |
904 |
|
|
umn_scalebar_style= self.umn_scalebar.get_style() |
905 |
|
|
possible_choices = [] |
906 |
|
|
for key in scalebar_style_type: |
907 |
|
|
possible_choices.append(scalebar_style_type[key]) |
908 |
dpinte |
2719 |
self.choice_style = wx.RadioBox(self, -1, choices=possible_choices, |
909 |
jschuengel |
2267 |
label='Style', majorDimension=1, |
910 |
dpinte |
2719 |
name='style check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS) |
911 |
jschuengel |
2267 |
self.choice_style.SetSelection(umn_scalebar_style) |
912 |
dpinte |
2719 |
hori2.Add(self.choice_style, 1, wx.EXPAND|wx.ALL, 5) |
913 |
jschuengel |
2267 |
|
914 |
|
|
#create size settings |
915 |
|
|
try: |
916 |
|
|
insidetxt = self.umn_scalebar.get_size() |
917 |
|
|
except: |
918 |
|
|
insidetxt = (0,0) |
919 |
|
|
# create the Size Box |
920 |
dpinte |
2719 |
staticSize = wx.StaticBox(self, -1, _("Size"), style = 0, |
921 |
jschuengel |
2274 |
name="sizeBox") |
922 |
dpinte |
2719 |
box_size = wx.StaticBoxSizer(staticSize, wx.HORIZONTAL) |
923 |
jschuengel |
2267 |
|
924 |
dpinte |
2719 |
box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL) |
925 |
|
|
box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 4) |
926 |
|
|
self.text_width = wx.TextCtrl(self, -1, str(insidetxt[0])) |
927 |
|
|
box_sizepartWidth.Add(self.text_width, 2, wx.ALL, 4) |
928 |
|
|
box_size.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 5) |
929 |
|
|
box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL) |
930 |
|
|
box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, |
931 |
|
|
wx.ALL, 4) |
932 |
|
|
self.text_height = wx.TextCtrl(self, -1, str(insidetxt[1])) |
933 |
|
|
box_sizepartHeight.Add(self.text_height, 2, wx.ALL, 4) |
934 |
|
|
box_size.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 5) |
935 |
jschuengel |
2267 |
|
936 |
|
|
# status |
937 |
jschuengel |
2274 |
umn_scalebar_status= self.umn_scalebar.get_status(mode="string") |
938 |
jschuengel |
2267 |
possible_choices = [] |
939 |
|
|
for key in legend_status_type: |
940 |
|
|
possible_choices.append(scalebar_status_type[key]) |
941 |
dpinte |
2719 |
self.choice_status = wx.RadioBox(self, -1, choices=possible_choices, |
942 |
jschuengel |
2267 |
label='Status', majorDimension=1, |
943 |
dpinte |
2719 |
name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS) |
944 |
jschuengel |
2267 |
self.choice_status.SetStringSelection(umn_scalebar_status) |
945 |
|
|
|
946 |
|
|
# position |
947 |
jschuengel |
2274 |
umn_scalebar_position= self.umn_scalebar.get_position(mode="string") |
948 |
jschuengel |
2267 |
possible_choices = [] |
949 |
|
|
for key in scalebar_position_type: |
950 |
|
|
possible_choices.append(scalebar_position_type[key]) |
951 |
dpinte |
2719 |
self.choice_position = wx.RadioBox(self, -1, choices=possible_choices, |
952 |
jschuengel |
2274 |
label='Position', majorDimension=1, |
953 |
dpinte |
2719 |
name='position check', size=wx.DefaultSize, |
954 |
|
|
style=wx.RA_SPECIFY_ROWS) |
955 |
jschuengel |
2267 |
self.choice_position.SetStringSelection(umn_scalebar_position) |
956 |
|
|
|
957 |
|
|
#get the set unittype |
958 |
|
|
insideunit = self.umn_scalebar .get_units() |
959 |
|
|
#create the Unittype selector |
960 |
dpinte |
2719 |
box_unitsStatic = wx.StaticBox(self, -1, _("Unit Type"), style = 0, |
961 |
jschuengel |
2274 |
name = "unittype") |
962 |
dpinte |
2719 |
box_units = wx.StaticBoxSizer(box_unitsStatic, wx.VERTICAL) |
963 |
jschuengel |
2267 |
sam = [] |
964 |
|
|
for key in unit_type: |
965 |
|
|
sam.append(unit_type[key]) |
966 |
dpinte |
2719 |
self.choice_units = wx.Choice(self, 40, (80, 50), choices = sam) |
967 |
jschuengel |
2267 |
self.choice_units.SetStringSelection(insideunit) |
968 |
dpinte |
2719 |
box_units.Add(self.choice_units,0, wx.EXPAND, wx.ALL, 5) |
969 |
jschuengel |
2267 |
|
970 |
jschuengel |
2271 |
# button for label |
971 |
dpinte |
2719 |
labelbutton = wx.Button(self, ID_LABEL_CHANGE, _("Change Label")) |
972 |
jschuengel |
2267 |
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel) |
973 |
|
|
|
974 |
|
|
#buttons |
975 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
976 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
977 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
978 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
979 |
jschuengel |
2267 |
button.SetFocus() |
980 |
dpinte |
2719 |
box_buttons.Add(button, 0, wx.ALL, 5) |
981 |
jschuengel |
2267 |
#set the button funcitons |
982 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
983 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
984 |
jschuengel |
2271 |
|
985 |
|
|
# compose the dialog |
986 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
987 |
|
|
top.Add(colorHor,0, wx.EXPAND |wx.ALL, 5) |
988 |
|
|
top.Add(hori2, 1, wx.EXPAND|wx.ALL, 5) |
989 |
|
|
top.Add(box_size, 1, wx.EXPAND|wx.ALL, 5) |
990 |
|
|
top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5) |
991 |
|
|
top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5) |
992 |
|
|
top.Add(box_units, 1, wx.EXPAND|wx.ALL, 5) |
993 |
|
|
top.Add(labelbutton, 0, wx.EXPAND|wx.ALL, 5) |
994 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
995 |
jschuengel |
2267 |
|
996 |
|
|
# final layout settings |
997 |
|
|
self.SetSizer(top) |
998 |
|
|
top.Fit(self) |
999 |
|
|
|
1000 |
|
|
def OnChangeLabel(self, event): |
1001 |
|
|
# set the umn_label for scalebar so the Label_Dialog can be used |
1002 |
|
|
self.umn_label = self.umn_scalebar.get_label() |
1003 |
jschuengel |
2274 |
dialog = Label_Dialog(self, -1, "Scalbar Label Settings", |
1004 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1005 |
|
|
style = wx.DEFAULT_DIALOG_STYLE |
1006 |
jschuengel |
2267 |
) |
1007 |
|
|
dialog.CenterOnScreen() |
1008 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
1009 |
jschuengel |
2267 |
return |
1010 |
|
|
dialog.Destroy() |
1011 |
|
|
|
1012 |
|
|
def OnChangeImageColor(self, event): |
1013 |
|
|
cur = self.umn_scalebar.get_imagecolor().get_thubancolor() |
1014 |
|
|
dialog = ColorDialog(self) |
1015 |
|
|
dialog.SetColor(cur) |
1016 |
|
|
self.retcolor = None |
1017 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
1018 |
jschuengel |
2267 |
self.retcolor = dialog.GetColor() |
1019 |
|
|
dialog.Destroy() |
1020 |
|
|
if self.retcolor: |
1021 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
1022 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
1023 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
1024 |
dpinte |
2719 |
self.previewimgcolor.SetBackgroundColour(wx.Colour(int(self.redcolor), |
1025 |
jschuengel |
2274 |
int(self.greencolor), |
1026 |
|
|
int(self.bluecolor))) |
1027 |
jschuengel |
2282 |
# refresh the colorbox to show the new color |
1028 |
|
|
self.previewimgcolor.Refresh() |
1029 |
jschuengel |
2267 |
|
1030 |
|
|
def OnChangeColor(self, event): |
1031 |
|
|
cur = self.umn_scalebar.get_color().get_thubancolor() |
1032 |
|
|
dialog = ColorDialog(self) |
1033 |
|
|
dialog.SetColor(cur) |
1034 |
|
|
self.retcolor = None |
1035 |
dpinte |
2719 |
if dialog.ShowModal() == wx.ID_OK: |
1036 |
jschuengel |
2267 |
self.retcolor = dialog.GetColor() |
1037 |
|
|
dialog.Destroy() |
1038 |
|
|
if self.retcolor: |
1039 |
|
|
self.redcolor = int(round(self.retcolor.red*255)) |
1040 |
|
|
self.greencolor = int(round(self.retcolor.green*255)) |
1041 |
|
|
self.bluecolor = int(round(self.retcolor.blue*255)) |
1042 |
dpinte |
2719 |
self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor), |
1043 |
jschuengel |
2274 |
int(self.greencolor), |
1044 |
|
|
int(self.bluecolor))) |
1045 |
jschuengel |
2282 |
# refresh the colorbox to show the new color |
1046 |
|
|
self.previewcolor.Refresh() |
1047 |
jschuengel |
2267 |
|
1048 |
|
|
def RunDialog(self): |
1049 |
|
|
self.ShowModal() |
1050 |
|
|
self.Destroy() |
1051 |
|
|
|
1052 |
|
|
def end_dialog(self, result): |
1053 |
|
|
self.result = result |
1054 |
|
|
if self.result is not None: |
1055 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
1056 |
jschuengel |
2267 |
else: |
1057 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
1058 |
jschuengel |
2267 |
self.Show(False) |
1059 |
|
|
|
1060 |
|
|
def OnOK(self, event): |
1061 |
|
|
self.umn_scalebar.set_status(self.choice_status.GetStringSelection()) |
1062 |
|
|
self.umn_scalebar.set_units(self.choice_units.GetStringSelection()) |
1063 |
|
|
self.umn_scalebar.set_intervals(self.text_intervals.GetValue()) |
1064 |
|
|
self.umn_scalebar.set_style(self.choice_style.GetSelection()) |
1065 |
|
|
self.umn_scalebar.set_position(self.choice_position.GetStringSelection()) |
1066 |
jschuengel |
2274 |
self.umn_scalebar.set_size(int(self.text_width.GetValue()), |
1067 |
|
|
int(self.text_height.GetValue())) |
1068 |
jschuengel |
2267 |
|
1069 |
|
|
previewcolor = self.previewcolor.GetBackgroundColour() |
1070 |
|
|
self.umn_scalebar.get_color().set_rgbcolor(previewcolor.Red(), |
1071 |
|
|
previewcolor.Green(), previewcolor.Blue()) |
1072 |
|
|
previewimgcolor = self.previewimgcolor.GetBackgroundColour() |
1073 |
|
|
self.umn_scalebar.get_imagecolor().set_rgbcolor(previewimgcolor.Red(), |
1074 |
|
|
previewimgcolor.Green(), previewimgcolor.Blue()) |
1075 |
|
|
self.result ="OK" |
1076 |
|
|
self.end_dialog(self.result) |
1077 |
|
|
|
1078 |
|
|
def OnCancel(self, event): |
1079 |
|
|
self.end_dialog(None) |
1080 |
|
|
|
1081 |
|
|
|
1082 |
dpinte |
2719 |
class Metadata_CustomDataTable(grid.PyGridTableBase): |
1083 |
jschuengel |
2303 |
""" |
1084 |
jschuengel |
2318 |
creates a custum Grid. |
1085 |
|
|
|
1086 |
dpinte |
2719 |
copied from the wx. demo. |
1087 |
jschuengel |
2303 |
""" |
1088 |
|
|
def __init__(self, data): |
1089 |
dpinte |
2719 |
gridPyGridTableBase.__init__(self) |
1090 |
jschuengel |
2303 |
|
1091 |
|
|
self.colLabels = ['ID', 'Description'] |
1092 |
dpinte |
2719 |
self.dataTypes = [wx.GRID_VALUE_STRING, |
1093 |
|
|
wx.GRID_VALUE_STRING |
1094 |
jschuengel |
2303 |
] |
1095 |
jschuengel |
2318 |
|
1096 |
jschuengel |
2303 |
if data: |
1097 |
|
|
self.data = data |
1098 |
|
|
else: |
1099 |
|
|
self.data = [["",""]] #-------------------------------------------------- |
1100 |
dpinte |
2719 |
# required methods for the grid.PyGridTableBase interface |
1101 |
jschuengel |
2303 |
|
1102 |
|
|
def GetNumberRows(self): |
1103 |
|
|
return len(self.data) + 1 |
1104 |
|
|
|
1105 |
|
|
def GetNumberCols(self): |
1106 |
jschuengel |
2318 |
return len(self.data[0]) |
1107 |
jschuengel |
2303 |
|
1108 |
|
|
def IsEmptyCell(self, row, col): |
1109 |
|
|
try: |
1110 |
|
|
return not self.data[row][col] |
1111 |
|
|
except IndexError: |
1112 |
|
|
return true |
1113 |
|
|
|
1114 |
|
|
# Get/Set values in the table. The Python version of these |
1115 |
|
|
# methods can handle any data-type, (as long as the Editor and |
1116 |
|
|
# Renderer understands the type too,) not just strings as in the |
1117 |
|
|
# C++ version. |
1118 |
|
|
def GetValue(self, row, col): |
1119 |
|
|
try: |
1120 |
|
|
return self.data[row][col] |
1121 |
|
|
except IndexError: |
1122 |
|
|
return '' |
1123 |
|
|
|
1124 |
|
|
def SetValue(self, row, col, value): |
1125 |
|
|
try: |
1126 |
|
|
self.data[row][col] = value |
1127 |
|
|
except IndexError: |
1128 |
|
|
# add a new row |
1129 |
jschuengel |
2318 |
|
1130 |
jschuengel |
2303 |
self.data.append([''] * self.GetNumberCols()) |
1131 |
|
|
self.SetValue(row, col, value) |
1132 |
|
|
|
1133 |
|
|
# tell the grid we've added a row |
1134 |
dpinte |
2719 |
msg = grid.GridTableMessage(self, # The table |
1135 |
|
|
wx.GRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it |
1136 |
jschuengel |
2303 |
1) # how many |
1137 |
|
|
|
1138 |
|
|
self.GetView().ProcessTableMessage(msg) |
1139 |
|
|
|
1140 |
jschuengel |
2318 |
#-------------------------------------------------- |
1141 |
|
|
# Some optional methods |
1142 |
jschuengel |
2303 |
|
1143 |
jschuengel |
2318 |
# Called when the grid needs to display labels |
1144 |
|
|
def GetColLabelValue(self, col): |
1145 |
|
|
return self.colLabels[col] |
1146 |
|
|
|
1147 |
|
|
# Called to determine the kind of editor/renderer to use by |
1148 |
|
|
# default, doesn't necessarily have to be the same type used |
1149 |
|
|
# natively by the editor/renderer if they know how to convert. |
1150 |
|
|
def GetTypeName(self, row, col): |
1151 |
|
|
return self.dataTypes[col] |
1152 |
|
|
|
1153 |
|
|
# Called to determine how the data can be fetched and stored by the |
1154 |
|
|
# editor and renderer. This allows you to enforce some type-safety |
1155 |
|
|
# in the grid. |
1156 |
|
|
def CanGetValueAs(self, row, col, typeName): |
1157 |
|
|
colType = self.dataTypes[col].split(':')[0] |
1158 |
|
|
if typeName == colType: |
1159 |
|
|
return true |
1160 |
|
|
else: |
1161 |
|
|
return False |
1162 |
|
|
|
1163 |
|
|
def CanSetValueAs(self, row, col, typeName): |
1164 |
|
|
return self.CanGetValueAs(row, col, typeName) |
1165 |
|
|
|
1166 |
|
|
|
1167 |
dpinte |
2719 |
class Metadata_TableGrid(grid.Grid): |
1168 |
jschuengel |
2303 |
def __init__(self, parent, data): |
1169 |
dpinte |
2719 |
grid.Grid.__init__(self, parent, -1) |
1170 |
jschuengel |
2303 |
|
1171 |
|
|
self.table = Metadata_CustomDataTable(data) |
1172 |
|
|
|
1173 |
|
|
# The second parameter means that the grid is to take ownership of the |
1174 |
|
|
# table and will destroy it when done. Otherwise you would need to keep |
1175 |
|
|
# a reference to it and call it's Destroy method later. |
1176 |
|
|
self.SetTable(self.table, true) |
1177 |
|
|
|
1178 |
|
|
self.SetRowLabelSize(0) |
1179 |
jschuengel |
2318 |
self.SetColMinimalWidth(0,180) |
1180 |
|
|
self.SetColSize(0,180) |
1181 |
|
|
self.SetColMinimalWidth(1,250) |
1182 |
|
|
self.SetColSize(1,250) |
1183 |
jschuengel |
2303 |
self.SetMargins(0,0) |
1184 |
|
|
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick) |
1185 |
|
|
|
1186 |
|
|
def get_table(self): |
1187 |
|
|
return self.table |
1188 |
|
|
|
1189 |
|
|
# I do this because I don't like the default behaviour of not starting the |
1190 |
|
|
# cell editor on double clicks, but only a second click. |
1191 |
|
|
def OnLeftDClick(self, evt): |
1192 |
|
|
if self.CanEnableCellControl(): |
1193 |
|
|
self.EnableCellEditControl() |
1194 |
|
|
|
1195 |
|
|
|
1196 |
dpinte |
2719 |
class Metadata_Dialog(wx.Dialog): |
1197 |
jschuengel |
2303 |
|
1198 |
|
|
def __init__(self, parent, ID, title, |
1199 |
dpinte |
2719 |
pos=wx.DefaultPosition, size=wx.DefaultSize, |
1200 |
|
|
style=wx.DEFAULT_DIALOG_STYLE): |
1201 |
jschuengel |
2303 |
|
1202 |
|
|
# initialize the Dialog |
1203 |
dpinte |
2719 |
wx.Dialog.__init__(self, parent, ID, title, pos, size, style) |
1204 |
jschuengel |
2303 |
|
1205 |
|
|
# get the web object |
1206 |
|
|
if hasattr(parent,"umn_metadata"): |
1207 |
|
|
self.umn_metadata = parent.umn_metadata |
1208 |
|
|
else: |
1209 |
|
|
self.tb_map = parent.canvas.Map() |
1210 |
|
|
self.umn_metadata = self.tb_map.extension_umn_mapobj.get_metadata() |
1211 |
|
|
|
1212 |
|
|
|
1213 |
|
|
# at all items to the dataset |
1214 |
|
|
self.grid = Metadata_TableGrid(self, self.umn_metadata.get_metadata()) |
1215 |
|
|
|
1216 |
|
|
#buttons |
1217 |
dpinte |
2719 |
box_buttons = wx.BoxSizer(wx.HORIZONTAL) |
1218 |
|
|
button = wx.Button(self, wx.ID_OK, _("OK")) |
1219 |
|
|
box_buttons.Add(button, 0, wx.ALL, 5) |
1220 |
|
|
button = wx.Button(self, wx.ID_CANCEL, _("Cancel")) |
1221 |
jschuengel |
2303 |
button.SetFocus() |
1222 |
dpinte |
2719 |
box_buttons.Add(button, 0, wx.ALL, 5) |
1223 |
jschuengel |
2303 |
#set the button funcitons |
1224 |
dpinte |
2719 |
EVT_BUTTON(self, wx.ID_OK, self.OnOK) |
1225 |
|
|
EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel) |
1226 |
jschuengel |
2303 |
|
1227 |
|
|
# compose the dialog |
1228 |
dpinte |
2719 |
top = wx.BoxSizer(wx.VERTICAL) |
1229 |
|
|
top.Add(self.grid, 1, wx.GROW|wx.ALL, 5) |
1230 |
|
|
top.Add(box_buttons, 0, wx.ALIGN_RIGHT) |
1231 |
jschuengel |
2303 |
|
1232 |
|
|
# final layout settings |
1233 |
|
|
self.SetSizer(top) |
1234 |
|
|
#top.Fit(self) |
1235 |
|
|
|
1236 |
|
|
def OnItemActivated(self, event): |
1237 |
|
|
self.currentItem = event.m_itemIndex |
1238 |
|
|
|
1239 |
|
|
def OnDoubleClick(self, event): |
1240 |
|
|
print "OnDoubleClick" +self.list.GetItemText(self.currentItem) |
1241 |
|
|
event.Skip() |
1242 |
|
|
|
1243 |
|
|
def OnSize(self, event): |
1244 |
|
|
w,h = self.GetClientSizeTuple() |
1245 |
|
|
self.list.SetDimensions(0, 0, w, h) |
1246 |
|
|
|
1247 |
|
|
def RunDialog(self): |
1248 |
|
|
self.ShowModal() |
1249 |
|
|
self.Destroy() |
1250 |
|
|
|
1251 |
|
|
def end_dialog(self, result): |
1252 |
|
|
self.result = result |
1253 |
|
|
if self.result is not None: |
1254 |
dpinte |
2719 |
self.EndModal(wx.ID_OK) |
1255 |
jschuengel |
2303 |
else: |
1256 |
dpinte |
2719 |
self.EndModal(wx.ID_CANCEL) |
1257 |
jschuengel |
2303 |
self.Show(False) |
1258 |
|
|
|
1259 |
|
|
def OnOK(self, event): |
1260 |
jschuengel |
2318 |
# added all metadatas to the mapobj, |
1261 |
|
|
# first remove the old ones |
1262 |
|
|
self.umn_metadata.remove_allmetadata() |
1263 |
|
|
for x in range(self.grid.get_table().GetNumberRows()-2,-1, -1): |
1264 |
jschuengel |
2303 |
if self.grid.get_table().GetValue(x,0): |
1265 |
|
|
self.umn_metadata.add_metadata(str(self.grid.get_table().GetValue(x,0)),\ |
1266 |
|
|
str(self.grid.get_table().GetValue(x,1))) |
1267 |
jschuengel |
2318 |
|
1268 |
jschuengel |
2303 |
self.result ="OK" |
1269 |
|
|
self.end_dialog(self.result) |
1270 |
|
|
|
1271 |
|
|
def OnCancel(self, event): |
1272 |
|
|
self.end_dialog(None) |
1273 |
|
|
|
1274 |
|
|
|
1275 |
|
|
|
1276 |
|
|
|
1277 |
|
|
def metadatasettings(context): |
1278 |
|
|
win = Metadata_Dialog(context.mainwindow, -1, "Metadata Settings", |
1279 |
dpinte |
2719 |
size=wx.Size(450, 250), |
1280 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1281 |
jschuengel |
2303 |
win.CenterOnScreen() |
1282 |
|
|
val = win.ShowModal() |
1283 |
|
|
|
1284 |
|
|
|
1285 |
jschuengel |
2267 |
def scalebarsettings(context): |
1286 |
jschuengel |
2274 |
win = Scalebar_Dialog(context.mainwindow, -1, "Scalebar Settings", |
1287 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1288 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1289 |
jschuengel |
2267 |
win.CenterOnScreen() |
1290 |
|
|
val = win.ShowModal() |
1291 |
|
|
|
1292 |
jschuengel |
2257 |
def mapsettings(context): |
1293 |
jschuengel |
2274 |
win = Map_Dialog(context.mainwindow, -1, "Map Settings", |
1294 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1295 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1296 |
jschuengel |
2257 |
win.CenterOnScreen() |
1297 |
|
|
val = win.ShowModal() |
1298 |
|
|
|
1299 |
jschuengel |
2271 |
def outputformatsettings(context): |
1300 |
|
|
win = OutputFormat_Dialog(context.mainwindow, -1, "OutputFormat Settings", |
1301 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1302 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1303 |
jschuengel |
2271 |
win.CenterOnScreen() |
1304 |
|
|
val = win.ShowModal() |
1305 |
|
|
|
1306 |
jschuengel |
2257 |
def websettings(context): |
1307 |
jschuengel |
2274 |
win = Web_Dialog(context.mainwindow, -1, "Web Settings", |
1308 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1309 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1310 |
jschuengel |
2257 |
win.CenterOnScreen() |
1311 |
|
|
val = win.ShowModal() |
1312 |
|
|
|
1313 |
jschuengel |
2303 |
def layersettings(context): |
1314 |
|
|
win = Layer_Dialog(context.mainwindow, -1, "Layer Settings", |
1315 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1316 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1317 |
jschuengel |
2303 |
win.CenterOnScreen() |
1318 |
|
|
val = win.ShowModal() |
1319 |
|
|
|
1320 |
jschuengel |
2257 |
def legendsettings(context): |
1321 |
jschuengel |
2274 |
win = Legend_Dialog(context.mainwindow, -1, "Legend Settings", |
1322 |
dpinte |
2719 |
size=wx.Size(350, 200), |
1323 |
|
|
style = wx.DEFAULT_DIALOG_STYLE) |
1324 |
jschuengel |
2257 |
win.CenterOnScreen() |
1325 |
|
|
val = win.ShowModal() |
1326 |
|
|
|
1327 |
jschuengel |
2282 |
# TODO: Maybe can be imported from another class |
1328 |
|
|
# check if an mapobj exists, to control the menuitem is available or not |
1329 |
|
|
def _has_umn_mapobj(context): |
1330 |
|
|
"""Return true if a umn_mapobj exists""" |
1331 |
|
|
return hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj") |
1332 |
|
|
|
1333 |
jschuengel |
2303 |
def _has_umn_mapobj_and_selectedlayer(context): |
1334 |
|
|
"""Return true if a umn_mapobj exists""" |
1335 |
jschuengel |
2318 |
# temporary disabled |
1336 |
jschuengel |
2328 |
#return False |
1337 |
jschuengel |
2303 |
if context.mainwindow.has_selected_layer(): |
1338 |
|
|
return hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj") |
1339 |
|
|
else: |
1340 |
|
|
return False |
1341 |
jschuengel |
2282 |
|
1342 |
jschuengel |
2257 |
# ################################### |
1343 |
|
|
# |
1344 |
|
|
# Hook in MapServer Extension into Thuban |
1345 |
|
|
# |
1346 |
|
|
# ################################### |
1347 |
|
|
|
1348 |
|
|
# find the extensions menu (create it anew if not found) |
1349 |
jschuengel |
2274 |
experimental_menu = main_menu.FindOrInsertMenu("experimental", |
1350 |
|
|
_("Experimenta&l")) |
1351 |
jschuengel |
2257 |
# find the extension menu and add a new submenu if found |
1352 |
jschuengel |
2274 |
mapserver_menu = experimental_menu.FindOrInsertMenu("mapserver", |
1353 |
|
|
_("&MapServer")) |
1354 |
jschuengel |
2257 |
|
1355 |
jschuengel |
2282 |
# find the MapServer menu and add a new submenu if found |
1356 |
|
|
mapserver_edit_menu = mapserver_menu.FindOrInsertMenu("edit_mapfile", |
1357 |
|
|
_("&Edit mapfile"), \ |
1358 |
jschuengel |
2318 |
after = "import_layer_from_mapfile") |
1359 |
jschuengel |
2257 |
|
1360 |
|
|
# register the new command (Map Settings Dialog) |
1361 |
jschuengel |
2282 |
registry.Add(Command("Map Settings", _("Map"), mapsettings, |
1362 |
|
|
helptext = _("Edit the Map Setting"), \ |
1363 |
|
|
sensitive = _has_umn_mapobj)) |
1364 |
jschuengel |
2257 |
# finally add the new entry to the extensions menu |
1365 |
jschuengel |
2282 |
mapserver_edit_menu.InsertItem("Map Settings") |
1366 |
jschuengel |
2257 |
|
1367 |
jschuengel |
2271 |
|
1368 |
jschuengel |
2257 |
# register the new command (Map Settings Dialog) |
1369 |
jschuengel |
2282 |
registry.Add(Command("Web Settings", _("Web"), |
1370 |
jschuengel |
2274 |
websettings, |
1371 |
jschuengel |
2282 |
helptext = _("Edit the Web Setting"), \ |
1372 |
|
|
sensitive = _has_umn_mapobj)) |
1373 |
jschuengel |
2257 |
# finally add the new entry to the extensions menu |
1374 |
jschuengel |
2282 |
mapserver_edit_menu.InsertItem("Web Settings") |
1375 |
jschuengel |
2257 |
|
1376 |
jschuengel |
2303 |
# register the new command (Layer Settings Dialog) |
1377 |
|
|
registry.Add(Command("Layer Settings", _("Layer"), |
1378 |
|
|
layersettings, |
1379 |
|
|
helptext = _("Edit the Layer Setting of the aktive Layer"), \ |
1380 |
|
|
sensitive = _has_umn_mapobj_and_selectedlayer)) |
1381 |
|
|
# finally add the new entry to the extensions menu |
1382 |
|
|
mapserver_edit_menu.InsertItem("Layer Settings") |
1383 |
|
|
|
1384 |
jschuengel |
2257 |
# register the new command (Legend Settings Dialog) |
1385 |
jschuengel |
2282 |
registry.Add(Command("Legend Settings", _("Legend"), |
1386 |
jschuengel |
2274 |
legendsettings, |
1387 |
jschuengel |
2282 |
helptext = _("Edit the Legend Setting"), \ |
1388 |
|
|
sensitive = _has_umn_mapobj)) |
1389 |
jschuengel |
2257 |
# finally add the new entry to the extensions menu |
1390 |
jschuengel |
2282 |
mapserver_edit_menu.InsertItem("Legend Settings") |
1391 |
jschuengel |
2257 |
|
1392 |
jschuengel |
2267 |
# register the new command (Scalebar Settings Dialog) |
1393 |
jschuengel |
2282 |
registry.Add(Command("Scalebar Settings", _("Scalebar"), |
1394 |
jschuengel |
2274 |
scalebarsettings, |
1395 |
jschuengel |
2282 |
helptext = _("Edit the Scalebar Setting"), \ |
1396 |
|
|
sensitive = _has_umn_mapobj)) |
1397 |
jschuengel |
2267 |
# finally add the new entry to the extensions menu |
1398 |
jschuengel |
2282 |
mapserver_edit_menu.InsertItem("Scalebar Settings") |
1399 |
jschuengel |
2257 |
|
1400 |
jschuengel |
2303 |
# register the new command (Scalebar Settings Dialog) |
1401 |
|
|
registry.Add(Command("Metadata Settings", _("Metadata"), |
1402 |
|
|
metadatasettings, |
1403 |
|
|
helptext = _("Edit the Metadata Setting"), \ |
1404 |
|
|
sensitive = _has_umn_mapobj)) |
1405 |
|
|
# finally add the new entry to the extensions menu |
1406 |
|
|
mapserver_edit_menu.InsertItem("Metadata Settings") |
1407 |
jschuengel |
2267 |
|
1408 |
jschuengel |
2303 |
|