svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / preferencespage / ViewPage.java @ 10626
History | View | Annotate | Download (17.7 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: ViewPage.java 10626 2007-03-06 16:55:54Z caballero $
|
45 |
* $Log$
|
46 |
* Revision 1.25 2007-03-06 16:35:02 caballero
|
47 |
* Exceptions
|
48 |
*
|
49 |
* Revision 1.24 2007/02/20 15:52:32 caballero
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.23 2007/01/25 11:04:07 caballero
|
53 |
* comprobar que el factor no es cero
|
54 |
*
|
55 |
* Revision 1.22 2006/12/20 14:41:12 caballero
|
56 |
* Remodelado Layout
|
57 |
*
|
58 |
* Revision 1.21 2006/11/08 10:57:55 jaume
|
59 |
* remove unecessary imports
|
60 |
*
|
61 |
* Revision 1.20 2006/10/25 08:34:06 jmvivo
|
62 |
* LLamado al PluginServices.getText para las unidades de medida del los combo
|
63 |
*
|
64 |
* Revision 1.19 2006/10/04 07:23:31 jaume
|
65 |
* refactored ambiguous methods and field names and added some more features for preference pages
|
66 |
*
|
67 |
* Revision 1.18 2006/10/03 09:52:38 jaume
|
68 |
* restores to meters
|
69 |
*
|
70 |
* Revision 1.17 2006/10/03 09:19:12 jaume
|
71 |
* *** empty log message ***
|
72 |
*
|
73 |
* Revision 1.16 2006/10/03 07:26:08 jaume
|
74 |
* *** empty log message ***
|
75 |
*
|
76 |
* Revision 1.15 2006/10/02 15:30:29 jaume
|
77 |
* *** empty log message ***
|
78 |
*
|
79 |
* Revision 1.14 2006/10/02 13:52:34 jaume
|
80 |
* organize impots
|
81 |
*
|
82 |
* Revision 1.13 2006/10/02 13:38:23 jaume
|
83 |
* *** empty log message ***
|
84 |
*
|
85 |
* Revision 1.12 2006/10/02 11:49:23 jaume
|
86 |
* *** empty log message ***
|
87 |
*
|
88 |
* Revision 1.11 2006/09/28 12:04:21 jaume
|
89 |
* default selection color now configurable
|
90 |
*
|
91 |
* Revision 1.10 2006/09/25 10:17:15 caballero
|
92 |
* Projection
|
93 |
*
|
94 |
* Revision 1.9 2006/09/15 10:41:30 caballero
|
95 |
* extensibilidad de documentos
|
96 |
*
|
97 |
* Revision 1.8 2006/09/14 15:43:48 jaume
|
98 |
* *** empty log message ***
|
99 |
*
|
100 |
* Revision 1.7 2006/09/14 15:42:38 jaume
|
101 |
* *** empty log message ***
|
102 |
*
|
103 |
* Revision 1.6 2006/09/14 06:57:18 jaume
|
104 |
* *** empty log message ***
|
105 |
*
|
106 |
* Revision 1.5 2006/09/12 15:56:50 jaume
|
107 |
* Default Projection now customizable
|
108 |
*
|
109 |
* Revision 1.4 2006/08/29 07:21:08 cesar
|
110 |
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
|
111 |
*
|
112 |
* Revision 1.3 2006/08/22 12:30:59 jaume
|
113 |
* *** empty log message ***
|
114 |
*
|
115 |
* Revision 1.2 2006/08/22 07:36:04 jaume
|
116 |
* *** empty log message ***
|
117 |
*
|
118 |
* Revision 1.1 2006/08/04 11:41:05 caballero
|
119 |
* poder especificar el zoom a aplicar en las vistas
|
120 |
*
|
121 |
* Revision 1.3 2006/07/31 10:02:31 jaume
|
122 |
* *** empty log message ***
|
123 |
*
|
124 |
* Revision 1.2 2006/06/13 07:43:08 fjp
|
125 |
* Ajustes sobre los cuadros de dialogos de preferencias
|
126 |
*
|
127 |
* Revision 1.1 2006/06/12 16:04:28 caballero
|
128 |
* Preferencias
|
129 |
*
|
130 |
* Revision 1.11 2006/06/06 10:26:31 jaume
|
131 |
* *** empty log message ***
|
132 |
*
|
133 |
* Revision 1.10 2006/06/05 17:07:17 jaume
|
134 |
* *** empty log message ***
|
135 |
*
|
136 |
* Revision 1.9 2006/06/05 17:00:44 jaume
|
137 |
* *** empty log message ***
|
138 |
*
|
139 |
* Revision 1.8 2006/06/05 16:57:59 jaume
|
140 |
* *** empty log message ***
|
141 |
*
|
142 |
* Revision 1.7 2006/06/05 14:45:06 jaume
|
143 |
* *** empty log message ***
|
144 |
*
|
145 |
* Revision 1.6 2006/06/05 11:00:09 jaume
|
146 |
* *** empty log message ***
|
147 |
*
|
148 |
* Revision 1.5 2006/06/05 10:39:02 jaume
|
149 |
* *** empty log message ***
|
150 |
*
|
151 |
* Revision 1.4 2006/06/05 10:13:40 jaume
|
152 |
* *** empty log message ***
|
153 |
*
|
154 |
* Revision 1.3 2006/06/05 10:06:08 jaume
|
155 |
* *** empty log message ***
|
156 |
*
|
157 |
* Revision 1.2 2006/06/05 09:51:56 jaume
|
158 |
* *** empty log message ***
|
159 |
*
|
160 |
* Revision 1.1 2006/06/02 10:50:18 jaume
|
161 |
* *** empty log message ***
|
162 |
*
|
163 |
*
|
164 |
*/
|
165 |
package com.iver.cit.gvsig.gui.preferencespage; |
166 |
|
167 |
import java.awt.Color; |
168 |
import java.awt.FlowLayout; |
169 |
import java.awt.event.ActionEvent; |
170 |
import java.awt.event.ActionListener; |
171 |
import java.util.Enumeration; |
172 |
|
173 |
import javax.swing.ImageIcon; |
174 |
import javax.swing.JCheckBox; |
175 |
import javax.swing.JLabel; |
176 |
import javax.swing.JPanel; |
177 |
import javax.swing.JTextField; |
178 |
import javax.swing.UIManager; |
179 |
import javax.swing.plaf.FontUIResource; |
180 |
|
181 |
import org.cresques.cts.IProjection; |
182 |
import org.gvsig.gui.beans.swing.JButton; |
183 |
|
184 |
import com.iver.andami.PluginServices; |
185 |
import com.iver.andami.preferences.AbstractPreferencePage; |
186 |
import com.iver.andami.preferences.StoreException; |
187 |
import com.iver.cit.gvsig.fmap.MapContext; |
188 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
189 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
190 |
import com.iver.cit.gvsig.project.Project; |
191 |
import com.iver.cit.gvsig.project.documents.layout.Attributes; |
192 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
193 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
194 |
import com.iver.utiles.StringUtilities; |
195 |
import com.iver.utiles.XMLEntity; |
196 |
import com.iver.utiles.swing.JComboBox; |
197 |
/**
|
198 |
* View document configuration page.
|
199 |
* <b><b>
|
200 |
* Here the user can establish what settings wants to use by default regarding to
|
201 |
* the document View.
|
202 |
*
|
203 |
*
|
204 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
205 |
*/
|
206 |
public class ViewPage extends AbstractPreferencePage { |
207 |
|
208 |
private static final String DEFAULT_PROJECTION_KEY_NAME = "DefaultProjection"; |
209 |
private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030"; |
210 |
private static final String ZOOM_IN_FACTOR_KEY_NAME = "ZoomInFactor"; |
211 |
private static final String ZOOM_OUT_FACTOR_KEY_NAME = "ZoomOutFactor"; |
212 |
private static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode"; |
213 |
private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing"; |
214 |
private static final String DEFAULT_SELECTION_COLOR_KEY_NAME = "DefaultSelectionColor"; |
215 |
private static final String DEFAULT_VIEW_BACK_COLOR_KEY_NAME = "DefaultViewBackColor"; |
216 |
private static final String DEFAULT_DISTANCE_UNITS_KEY_NAME = "DefaultDistanceUnits"; |
217 |
private static final String DEFAULT_MAP_UNITS_KEY_NAME = "DefaultMapUnits"; |
218 |
/*
|
219 |
* Locator's background color, for when we let it be possible
|
220 |
* private static final String DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME = "DefaultMapOverViewBackColor";
|
221 |
*/
|
222 |
private static final double DEFAULT_ZOOM_IN_FACTOR = 2.0; |
223 |
private static final double DEFAULT_ZOOM_OUT_FACTOR = 0.5; |
224 |
private static final Color FACTORY_DEFAULT_SELECTION_COLOR = Color.YELLOW; |
225 |
private static final Color FACTORY_DEFAULT_VIEW_BACK_COLOR = Color.WHITE; |
226 |
/*
|
227 |
* Locator's background color, for when we let it be possible
|
228 |
* private static final Color FACTORY_DEFAULT_MAP_OVERVIEW_BACK_COLOR = Color.WHITE;
|
229 |
*/
|
230 |
|
231 |
private static String[] unitsNames = null; |
232 |
|
233 |
private static int FACTORY_DEFAULT_MAP_UNITS; |
234 |
private static int FACTORY_DEFAULT_DISTANCE_UNITS; |
235 |
|
236 |
private JTextField txtZoomInFactor; |
237 |
private JTextField txtZoomOutFactor; |
238 |
protected String id; |
239 |
private ImageIcon icon; |
240 |
private JLabel lblDefaultProjection; |
241 |
private JButton btnChangeProjection; |
242 |
private String fontName; |
243 |
private JCheckBox chkInvisibleNewLayers; |
244 |
private JCheckBox chkKeepScaleOnResizing; |
245 |
private ColorChooserPanel jccDefaultSelectionColor;
|
246 |
private ColorChooserPanel jccDefaultViewBackColor;
|
247 |
private JComboBox jCmbMapUnits; |
248 |
private JComboBox jCmbDistanceUnits; |
249 |
/*
|
250 |
* Locator's background color, for when we let it be possible
|
251 |
* private ColorChooserPanel jccDefaultMapOverViewBackColor;
|
252 |
*/
|
253 |
|
254 |
{ |
255 |
Enumeration keys = UIManager.getDefaults().keys(); |
256 |
while (keys.hasMoreElements()) {
|
257 |
Object key = keys.nextElement();
|
258 |
Object value = UIManager.get (key); |
259 |
if (value instanceof FontUIResource) { |
260 |
FontUIResource fur = (FontUIResource) value; |
261 |
fontName = fur.getFontName(); |
262 |
|
263 |
} |
264 |
} |
265 |
|
266 |
String[] unitNames = Attributes.NAMES; |
267 |
for (int i = 0; i < unitNames.length; i++) { |
268 |
if (unitNames[i].equals(PluginServices.getText(this, "Metros"))) { |
269 |
FACTORY_DEFAULT_DISTANCE_UNITS = i; |
270 |
FACTORY_DEFAULT_MAP_UNITS = i; |
271 |
break;
|
272 |
} |
273 |
} |
274 |
|
275 |
} |
276 |
|
277 |
/**
|
278 |
* Creates a new panel containing View preferences settings.
|
279 |
*
|
280 |
*/
|
281 |
public ViewPage() {
|
282 |
super();
|
283 |
id = this.getClass().getName();
|
284 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/Vista.png")); |
285 |
|
286 |
|
287 |
// default projection
|
288 |
lblDefaultProjection = new JLabel(); |
289 |
lblDefaultProjection.setFont(new java.awt.Font(
|
290 |
fontName, java.awt.Font.BOLD, 11));
|
291 |
btnChangeProjection = new JButton(PluginServices.getText(this, "change")); |
292 |
btnChangeProjection.addActionListener(new ActionListener() { |
293 |
public void actionPerformed(ActionEvent e) { |
294 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
295 |
csSelect.setProjection( CRSFactory.getCRS( |
296 |
lblDefaultProjection.getText())); |
297 |
PluginServices.getMDIManager().addWindow(csSelect); |
298 |
|
299 |
if (csSelect.isOkPressed()) {
|
300 |
IProjection proj = csSelect.getProjection(); |
301 |
lblDefaultProjection.setText(proj.getAbrev()); |
302 |
} |
303 |
} |
304 |
}); |
305 |
|
306 |
addComponent(PluginServices.getText(this, "default_projection") + ":", lblDefaultProjection ); |
307 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
308 |
aux.add(btnChangeProjection); |
309 |
addComponent("", aux);
|
310 |
|
311 |
// just a separator
|
312 |
addComponent(new JLabel(" ")); |
313 |
|
314 |
// Adding Invisible New Layers
|
315 |
chkInvisibleNewLayers = new JCheckBox( |
316 |
PluginServices.getText(this, "options.view.invisible_new_layers")); |
317 |
|
318 |
addComponent("", chkInvisibleNewLayers);
|
319 |
chkKeepScaleOnResizing = new JCheckBox( |
320 |
PluginServices.getText(this, "options.view.keep_scale_on_resizing")); |
321 |
chkKeepScaleOnResizing.setEnabled(false);
|
322 |
addComponent("", chkKeepScaleOnResizing);
|
323 |
|
324 |
// just a separator
|
325 |
addComponent(new JLabel(" ")); |
326 |
|
327 |
// zoom in factor
|
328 |
addComponent(PluginServices.getText(this, "zoom_in_factor") + ":", |
329 |
txtZoomInFactor = new JTextField("", 15)); |
330 |
// zoom out factor
|
331 |
addComponent(PluginServices.getText(this, "zoom_out_factor") + ":", |
332 |
txtZoomOutFactor = new JTextField("", 15)); |
333 |
|
334 |
// just a separator
|
335 |
addComponent(new JLabel(" ")); |
336 |
|
337 |
// default back color chooser
|
338 |
addComponent(PluginServices.getText(this, "options.view.default_view_back_color"), |
339 |
jccDefaultViewBackColor = new ColorChooserPanel());
|
340 |
|
341 |
/*
|
342 |
* Locator's background color, for when we let it be possible
|
343 |
* // default back color chooser
|
344 |
* addComponent(PluginServices.getText(this, "options.view.default_map_overview_back_color"), jccDefaultMapOverViewBackColor = new ColorChooserPanel());
|
345 |
*/
|
346 |
|
347 |
// default selection color chooser
|
348 |
addComponent(PluginServices.getText(this, "options.view.default_selection_color"), |
349 |
jccDefaultSelectionColor = new ColorChooserPanel());
|
350 |
|
351 |
// just a separator
|
352 |
addComponent(new JLabel(" ")); |
353 |
|
354 |
// default map units
|
355 |
addComponent(PluginServices.getText(this, "map_units"), |
356 |
jCmbMapUnits = new JComboBox(getUnitsNames())); |
357 |
|
358 |
// default distance units
|
359 |
addComponent(PluginServices.getText(this, "distance_units"), |
360 |
jCmbDistanceUnits = new JComboBox(getUnitsNames())); |
361 |
|
362 |
initializeValues(); |
363 |
} |
364 |
|
365 |
public void initializeValues() { |
366 |
PluginServices ps = PluginServices.getPluginServices(this);
|
367 |
XMLEntity xml = ps.getPersistentXML(); |
368 |
|
369 |
// Default Projection
|
370 |
if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) {
|
371 |
lblDefaultProjection.setText( |
372 |
xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME)); |
373 |
} else {
|
374 |
lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION); |
375 |
} |
376 |
Project.setDefaultProjection( CRSFactory.getCRS(lblDefaultProjection.getText())); |
377 |
|
378 |
// Adding invisible new layers
|
379 |
if (xml.contains(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)) {
|
380 |
chkInvisibleNewLayers.setSelected( |
381 |
xml.getBooleanProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)); |
382 |
} |
383 |
|
384 |
// Keep scale on resizing
|
385 |
if (xml.contains(KEEP_SCALE_ON_RESIZING_KEY_NAME)) {
|
386 |
chkKeepScaleOnResizing.setSelected( |
387 |
xml.getBooleanProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME)); |
388 |
} |
389 |
|
390 |
// Zoom-in factor
|
391 |
if (xml.contains(ZOOM_IN_FACTOR_KEY_NAME)) {
|
392 |
double zoomInFactor = xml.getDoubleProperty(ZOOM_IN_FACTOR_KEY_NAME);
|
393 |
txtZoomInFactor.setText(String.valueOf( zoomInFactor ));
|
394 |
} else {
|
395 |
txtZoomInFactor.setText( |
396 |
String.valueOf( MapContext.ZOOMINFACTOR ));
|
397 |
} |
398 |
MapContext.ZOOMINFACTOR = Double.parseDouble(txtZoomInFactor.getText());
|
399 |
|
400 |
// Zoom-out factor
|
401 |
if (xml.contains(ZOOM_OUT_FACTOR_KEY_NAME)) {
|
402 |
double zoomOutFactor = xml.getDoubleProperty(ZOOM_OUT_FACTOR_KEY_NAME);
|
403 |
txtZoomOutFactor.setText(String.valueOf( zoomOutFactor ));
|
404 |
} else {
|
405 |
txtZoomOutFactor.setText( |
406 |
String.valueOf( MapContext.ZOOMOUTFACTOR ));
|
407 |
} |
408 |
MapContext.ZOOMOUTFACTOR = Double.parseDouble(txtZoomOutFactor.getText());;
|
409 |
|
410 |
// Default back color
|
411 |
jccDefaultViewBackColor.setColor(View.getDefaultBackColor());
|
412 |
jccDefaultViewBackColor.setAlpha(255);
|
413 |
/*
|
414 |
* Locator's background color, for when we let it be possible
|
415 |
* // Default map overview back color
|
416 |
* jccDefaultMapOverViewBackColor.setColor(Project.getDefaultMapOverViewBackColor());
|
417 |
* jccDefaultMapOverViewBackColor.setAlpha(255);
|
418 |
*/
|
419 |
|
420 |
// Default selection color
|
421 |
jccDefaultSelectionColor.setColor(Project.getDefaultSelectionColor()); |
422 |
jccDefaultSelectionColor.setAlpha(255);
|
423 |
|
424 |
// Map units
|
425 |
jCmbMapUnits.setSelectedIndex(Project.getDefaultMapUnits()); |
426 |
|
427 |
// Distance units
|
428 |
jCmbDistanceUnits.setSelectedIndex(Project.getDefaultDistanceUnits()); |
429 |
|
430 |
} |
431 |
|
432 |
public String getID() { |
433 |
return id;
|
434 |
} |
435 |
|
436 |
public String getTitle() { |
437 |
return PluginServices.getText(this, "Vista"); |
438 |
} |
439 |
|
440 |
public JPanel getPanel() { |
441 |
return this; |
442 |
} |
443 |
|
444 |
public void storeValues() throws StoreException { |
445 |
String projName = lblDefaultProjection.getText();
|
446 |
double zif=1; |
447 |
double zof=1; |
448 |
boolean invisibleNewLayers, keepScaleOnResize;
|
449 |
Color selectionColor, viewBackColor;
|
450 |
/*
|
451 |
* Locator's background color, for when we let it be possible
|
452 |
* Color mapOverViewBackColor;
|
453 |
*/
|
454 |
|
455 |
try {
|
456 |
// try {
|
457 |
zif=Double.parseDouble(txtZoomInFactor.getText());
|
458 |
zof=Double.parseDouble(txtZoomOutFactor.getText());
|
459 |
if (zif==0 || zof==0) { |
460 |
throw new NumberFormatException(); |
461 |
} |
462 |
// }catch (NumberFormatException e) {
|
463 |
// //JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"numero_incorrecto")+" = "+ txtZoomInFactor.getText()+ ", "+txtZoomOutFactor.getText());
|
464 |
// throw new StoreException(PluginServices.getText(this,"numero_incorrecto")+" = "+ txtZoomInFactor.getText()+ ", "+txtZoomOutFactor.getText());
|
465 |
// }
|
466 |
Project.setDefaultProjection( CRSFactory.getCRS(projName)); |
467 |
|
468 |
selectionColor = jccDefaultSelectionColor.getColor(); |
469 |
Project.setDefaultSelectionColor( selectionColor ); |
470 |
|
471 |
viewBackColor = jccDefaultViewBackColor.getColor(); |
472 |
View.setDefaultBackColor( viewBackColor );
|
473 |
/*
|
474 |
* Locator's background color, for when we let it be possible
|
475 |
* mapOverViewBackColor = jccDefaultMapOverViewBackColor.getColor();
|
476 |
* View.setDefaultMapOverViewBackColor( mapOverViewBackColor );
|
477 |
*/
|
478 |
|
479 |
Project.setDefaultMapUnits(jCmbMapUnits.getSelectedIndex()); |
480 |
Project.setDefaultDistanceUnits(jCmbDistanceUnits.getSelectedIndex()); |
481 |
invisibleNewLayers = chkInvisibleNewLayers.isSelected(); |
482 |
keepScaleOnResize = chkKeepScaleOnResizing.isSelected(); |
483 |
} catch (Exception e) { |
484 |
throw new StoreException(PluginServices.getText(this,"factor_zoom_incorrecto")); |
485 |
} |
486 |
MapContext.ZOOMINFACTOR=zif; |
487 |
MapContext.ZOOMOUTFACTOR=zof; |
488 |
// MapControl.setScalingOnResize(!keepScaleOnResize);
|
489 |
|
490 |
PluginServices ps = PluginServices.getPluginServices(this);
|
491 |
XMLEntity xml = ps.getPersistentXML(); |
492 |
xml.putProperty(DEFAULT_PROJECTION_KEY_NAME, projName); |
493 |
xml.putProperty(ZOOM_IN_FACTOR_KEY_NAME, zif); |
494 |
xml.putProperty(ZOOM_OUT_FACTOR_KEY_NAME, zof); |
495 |
xml.putProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME, invisibleNewLayers); |
496 |
xml.putProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME, keepScaleOnResize); |
497 |
xml.putProperty(DEFAULT_VIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(viewBackColor)); |
498 |
/*
|
499 |
* Locator's background color, for when we let it be possible
|
500 |
* xml.putProperty(DEFAULT_MAP_OVERVIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(mapOverViewBackColor));
|
501 |
*/
|
502 |
xml.putProperty(DEFAULT_SELECTION_COLOR_KEY_NAME, StringUtilities.color2String(selectionColor)); |
503 |
xml.putProperty(DEFAULT_MAP_UNITS_KEY_NAME, jCmbMapUnits.getSelectedIndex()); |
504 |
xml.putProperty(DEFAULT_DISTANCE_UNITS_KEY_NAME, jCmbDistanceUnits.getSelectedIndex()); |
505 |
} |
506 |
|
507 |
|
508 |
public void initializeDefaults() { |
509 |
lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION); |
510 |
txtZoomInFactor.setText(String.valueOf(DEFAULT_ZOOM_IN_FACTOR));
|
511 |
txtZoomOutFactor.setText(String.valueOf(DEFAULT_ZOOM_OUT_FACTOR));
|
512 |
chkInvisibleNewLayers.setSelected(false);
|
513 |
chkKeepScaleOnResizing.setSelected(false);
|
514 |
jccDefaultViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR); |
515 |
/*
|
516 |
* Locator's background color, for when we let it be possible
|
517 |
* jccDefaultMapOverViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR);
|
518 |
*/
|
519 |
jccDefaultSelectionColor.setColor(FACTORY_DEFAULT_SELECTION_COLOR); |
520 |
jCmbMapUnits.setSelectedIndex(FACTORY_DEFAULT_MAP_UNITS); |
521 |
jCmbDistanceUnits.setSelectedIndex(FACTORY_DEFAULT_DISTANCE_UNITS); |
522 |
|
523 |
} |
524 |
|
525 |
public ImageIcon getIcon() { |
526 |
return icon;
|
527 |
} |
528 |
|
529 |
public boolean isValueChanged() { |
530 |
return super.hasChanged(); |
531 |
} |
532 |
|
533 |
public void setChangesApplied() { |
534 |
setChanged(false);
|
535 |
} |
536 |
|
537 |
|
538 |
private String[] getUnitsNames() { |
539 |
if (unitsNames == null) { |
540 |
unitsNames = new String[Attributes.NAMES.length]; |
541 |
for (int i=0;i<Attributes.NAMES.length;i++) { |
542 |
unitsNames[i]=PluginServices.getText(this, Attributes.NAMES[i]); |
543 |
} |
544 |
} |
545 |
return unitsNames;
|
546 |
} |
547 |
} |