source: osm/applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java@ 30737

Last change on this file since 30737 was 30737, checked in by donvip, 10 years ago

[josm_plugins] fix Java 7 / unused code warnings

  • Property svn:eol-style set to native
File size: 24.6 KB
Line 
1// License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others
2package cadastre_fr;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.marktr;
6import static org.openstreetmap.josm.tools.I18n.tr;
7import static org.openstreetmap.josm.io.session.SessionWriter.registerSessionLayerExporter;
8import static org.openstreetmap.josm.io.session.SessionReader.registerSessionLayerImporter;
9
10import java.awt.event.ActionEvent;
11import java.awt.event.ActionListener;
12import java.awt.event.KeyEvent;
13import java.io.File;
14import java.util.Arrays;
15import java.util.HashMap;
16import java.util.Map;
17
18import javax.swing.JCheckBoxMenuItem;
19import javax.swing.JDialog;
20import javax.swing.JMenu;
21import javax.swing.JMenuItem;
22import javax.swing.JOptionPane;
23import javax.swing.KeyStroke;
24
25import org.openstreetmap.josm.Main;
26import org.openstreetmap.josm.actions.JosmAction;
27import org.openstreetmap.josm.actions.UploadAction;
28import org.openstreetmap.josm.data.projection.AbstractProjection;
29import org.openstreetmap.josm.data.projection.Projection;
30import org.openstreetmap.josm.gui.MainMenu;
31import org.openstreetmap.josm.gui.MapFrame;
32import org.openstreetmap.josm.gui.IconToggleButton;
33import org.openstreetmap.josm.gui.layer.Layer;
34import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
35import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
36import org.openstreetmap.josm.gui.preferences.map.MapPreference;
37import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
38import org.openstreetmap.josm.plugins.Plugin;
39import org.openstreetmap.josm.plugins.PluginInformation;
40
41/**
42 *
43 * Plugin to access the French Cadastre WMS server at www.cadastre.gouv.fr This
44 * WMS server requires some specific handling like retrieving a cookie for a
45 * limitation in case of no activity, or the request to the server shall provide
46 * a city/town/village code.
47 *
48 * @author Pieren <pieren3@gmail.com>,
49 * @author <matthieu.lochegnies@gmail.com> for the extension to codeCommune
50 * @version 0.8
51 * History:
52 * 0.1 17-Jun-2008 first prototype using a first Lambert projection impl. in core
53 * 0.2 22-Jun-2008 first stable version
54 * 0.3 24-Jun-2008 add code departement
55 * 0.4 06-Jul-2008 - add images scales, icons, menu items disabling
56 * - remove dependencies of wmsplugin
57 * - add option to force a Lambert zone (for median locations)
58 * - add auto-sourcing
59 * 0.5 16-Aug-2008 - add transparency in layer (allowing multiple wms layers displayed together)
60 * - no overlapping of grabbed images if transparency is enabled
61 * - set one layer per location
62 * - use utf-8 charset in POST request to server
63 * - improve the preferences setting dialog
64 * - cancel the current download is now possible
65 * - add automatic images caching and load on request (+ manage cache directory size)
66 * - enable auto-sourcing only if a WMS layer is used
67 * 0.6 18-Aug-2008 - suppress the null-exception message after the dialog 'open a layer first'
68 * - process the overlapping images when cache is loaded from disk
69 * - save the last 'new location request' text again in preferences
70 * - avoid duplicate layers with same name
71 * - set text input for new locations in upper case
72 * - the cache directory is configurable in "cadastrewms.cacheDir"
73 * - improve configuration change updates
74 * 0.7 24-Aug-2008 - mask images only if transparency enabled
75 * - validate projection name by Lambert.toString() method
76 * 0.8 25-Jan-2009 - display returned list of communes if direct name is not recognized by server
77 * - new possible grab factor of 100 square meters fixed size
78 * - minor fixes due to changes in JOSM core classes
79 * - first draft of raster image support
80 * 0.9 05-Feb-2009 - grab vectorized full commune bbox, save in file, convert to OSM way
81 * and simplify
82 * 1.0 18-Feb-2009 - fix various bugs in color management and preference dialog
83 * - increase PNG picture size requested to WMS (800x1000)
84 * - set 4th grab scale fixed size configurable (from 25 to 1000 meters)
85 * 1.1 11-Jun-2009 - fixed a null exception error when trying to displace a vectorized layer
86 * - propose to use shortcut F11 for grabbing
87 * 1.2 16-Aug-2009 - implementation of raster image grabbing, cropping and georeferencing (not the
88 * overview rasters (Tableau d'assemblage) but directly small units (Feuille)
89 * 1.3 23-Aug-2009 - improve georeferencing action cancellation
90 * - fixed bug of raster image loaded from cache not working on Java1.6
91 * - improve mouse click bounce detection during georeferencing process
92 * 1.4 25-Oct-2009 - add support for new Lambert CC 9 Zones projection
93 * - add optional crosspieces display on raster image layers
94 * - add automatic raster images georeferencing when WMS provides data
95 * - re-implement manual adjustment mode in raster image layer
96 * 1.5 21-Nov-2009 - major changes in projection in core : no magical zone prediction anymore for
97 * Lambert 4 and 9 zones; grid translation implemented for Lambert 4 zones;
98 * support of subprojections in preferences for zones setting and UTM20N
99 * - removed autosourcing of empty new nodes
100 * 1.6 28-Nov-2009 - Fix minor issues if Grab is called without layer (possible since projection rework)
101 * 1.7 12-Dec-2009 - Change URL's changes for cookie and downgrade imgs resolution due to WMS changes
102 * 1.8 11-Mar-2010 - filter the mouse button 1 during georeferencing
103 * - retry if getting a new cookie failed (10 times during 30 seconds)
104 * - cookie expiration automatically detected and renewed (after 30 minutes)
105 * - proper WMS layer cleanup at destruction (workaround for memory leak)
106 * - new cache format (v3) storing original image and cropped image bbox + angle
107 * - new cache format (v4) storing original image size for later rotation
108 * - cache files read compatible with previous formats
109 * - raster image rotation issues fixed, now using shift+ctrl key instead of ctrl
110 * - raster image adjustment using default system menu modifier (ctrl for windows) for Mac support
111 * - image resolution configurable (high, medium, low) like the online interface
112 * - layer selection configurable for vectorized images
113 * - improved download cancellation
114 * - from Erik Amzallag:
115 * - possibility to modify the auto-sourcing text just before upload
116 * - from Clément Ménier:
117 * - new option allowing an auto-selection of the first cadastre layer for grab
118 * - non-modal JDialog in MenuActionGrabPlanImage
119 * - new options in the image filter (bilinear, bicubic)
120 * 1.9 05-Apr-2010 - added a scroll bar in preferences
121 * - download cancellation improved
122 * - last deployment for Java1.5 compatibility
123 * 2.0 07-Jul-2010 - update projection for "La Reunion" departement to RGR92, UTM40S.
124 * - add 'departement' as option in the municipality selection
125 * - fixed bug in cache directory size control (and disabled by default)
126 * - add map mode for addressing
127 * - from Nicolas Dumoulin:
128 * - add "tableau d'assemblage" in raster images for georeferencing (as option)
129 * 2.1 14-Jan-2011 - add GrabThread moving the grab to a separate thread
130 * - the divided BBox mode starts from the central square and loads the next in a spiral
131 * - move the grabber from CadastrPlugin singleton to each wmsLayer instance to allow grabbing
132 * of multiple municipalities in parallel.
133 * 2.2 01-Jul-2011 - replace deprecated Main.proj by newest Main.getProjection()
134 * - fix list of raster images (Feuilles) parsing failing after a Cadastre server change/maintenance
135 * 2.3 11-Jan-2013 - add various improvements from Don-Vip (Vincent Privat) trac #8175, #8229 and #5626.
136 * 2.4 27-Jun-2013 - fix raster image georeferencing issues. Add new MenuActionRefineGeoRef for a new georeferencing
137 * of already referenced plan image.
138 * 2.5 06-Aug-2013 - fix transparency issue on new raster images. Temporary disable georeferences parsing not
139 * working on new cadastre WMS.
140 * - workaround on address help tool when switching to full screen
141 * - improvement when clicking on existing node address street in mode relation
142 * - option to simplify raster images in 2 bits colors (like images served in the past).
143 * 2.6 10-Sep-2013 - add JOSM "sessions" feature support (list of layers stored in a file)
144 */
145public class CadastrePlugin extends Plugin {
146 static String VERSION = "2.5";
147
148 static JMenu cadastreJMenu;
149
150 public static String source = "";
151
152 // true if the checkbox "auto-sourcing" is set in the plugin menu
153 public static boolean autoSourcing = false;
154
155 // true when the plugin is first used, e.g. grab from WMS or download cache file
156 public static boolean pluginUsed = false;
157
158 public static String cacheDir = null;
159
160 public static boolean alterColors = false;
161
162 public static boolean backgroundTransparent = false;
163
164 public static float transparency = 1.0f;
165
166 public static boolean drawBoundaries = false;
167
168 public static int imageWidth, imageHeight;
169
170 public static String grabLayers, grabStyles = null;
171
172 static private boolean menuEnabled = false;
173
174 private static String LAYER_BULDINGS = "CDIF:LS2";
175 private static String STYLE_BUILDING = "LS2_90";
176 private static String LAYER_WATER = "CDIF:LS3";
177 private static String STYLE_WATER = "LS3_90";
178 private static String LAYER_SYMBOL = "CDIF:LS1";
179 private static String STYLE_SYMBOL = "LS1_90";
180 private static String LAYER_PARCELS = "CDIF:PARCELLE";
181 private static String STYLE_PARCELS = "PARCELLE_90";
182 private static String LAYER_NUMERO = "CDIF:NUMERO";
183 private static String STYLE_NUMERO = "NUMERO_90";
184 private static String LAYER_LABEL = "CDIF:PT3,CDIF:PT2,CDIF:PT1";
185 private static String STYLE_LABEL = "PT3_90,PT2_90,PT1_90";
186 private static String LAYER_LIEUDIT = "CDIF:LIEUDIT";
187 private static String STYLE_LIEUDIT = "LIEUDIT_90";
188 private static String LAYER_SECTION = "CDIF:SUBSECTION,CDIF:SECTION";
189 private static String STYLE_SECTION = "SUBSECTION_90,SECTION_90";
190 private static String LAYER_COMMUNE = "CDIF:COMMUNE";
191 private static String STYLE_COMMUNE = "COMMUNE_90";
192
193 /**
194 * Creates the plugin and setup the default settings if necessary
195 *
196 * @throws Exception
197 */
198 public CadastrePlugin(PluginInformation info) throws Exception {
199 super(info);
200 System.out.println("Pluging cadastre-fr v"+VERSION+" started...");
201 if (Main.pref.get("cadastrewms.cacheDir").equals(""))
202 cacheDir = Main.pref.getPreferencesDir()+"plugins"+File.separatorChar+"cadastrewms"+File.separatorChar;
203 else {
204 cacheDir = Main.pref.get("cadastrewms.cacheDir");
205 if (cacheDir.charAt(cacheDir.length()-1) != File.separatorChar )
206 cacheDir += File.separatorChar;
207 }
208 System.out.println("current cache directory: "+cacheDir);
209
210 refreshConfiguration();
211
212 UploadAction.registerUploadHook(new CheckSourceUploadHook());
213
214 registerSessionLayerExporter(WMSLayer.class , CadastreSessionExporter.class);
215 registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);
216
217 }
218
219 public static void refreshMenu() {
220 MainMenu menu = Main.main.menu;
221
222 if (cadastreJMenu == null) {
223 cadastreJMenu = menu.addMenu(marktr("Cadastre"), KeyEvent.VK_C, menu.getDefaultMenuPos(), ht("/Plugin/CadastreFr"));
224 JosmAction grab = new MenuActionGrab();
225 JMenuItem menuGrab = new JMenuItem(grab);
226 KeyStroke ks = grab.getShortcut().getKeyStroke();
227 if (ks != null) {
228 menuGrab.setAccelerator(ks);
229 }
230 JMenuItem menuActionGrabPlanImage = new JMenuItem(new MenuActionGrabPlanImage());
231 JMenuItem menuSettings = new JMenuItem(new MenuActionNewLocation());
232 final JCheckBoxMenuItem menuSource = new JCheckBoxMenuItem(tr("Auto sourcing"));
233 menuSource.setSelected(autoSourcing);
234 menuSource.addActionListener(new ActionListener() {
235 public void actionPerformed(ActionEvent ev) {
236 Main.pref.put("cadastrewms.autosourcing", menuSource.isSelected());
237 autoSourcing = menuSource.isSelected();
238 }
239 });
240
241 //JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie());
242 //JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone());
243 JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache());
244 // temporary disabled:
245 //JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries());
246 //JMenuItem menuActionBuildings = new JMenuItem(new MenuActionBuildings());
247
248 cadastreJMenu.add(menuGrab);
249 cadastreJMenu.add(menuActionGrabPlanImage);
250 cadastreJMenu.add(menuSettings);
251 cadastreJMenu.add(menuSource);
252 //cadastreJMenu.add(menuResetCookie); not required any more
253 //cadastreJMenu.add(menuLambertZone);
254 //if (Main.pref.getBoolean("cadastrewms.buildingsMenu", false))
255 // cadastreJMenu.add(menuActionBuildings);
256 cadastreJMenu.add(menuLoadFromCache);
257 // all SVG features disabled until official WMS is released
258 //cadastreJMenu.add(menuActionBoundaries);
259 cadastreJMenu.add(new JMenuItem(new MenuActionOpenPreferences()));
260 }
261 setEnabledAll(menuEnabled);
262 }
263
264 public static void refreshConfiguration() {
265 source = checkSourceMillesime();
266 autoSourcing = Main.pref.getBoolean("cadastrewms.autosourcing", true);
267 alterColors = Main.pref.getBoolean("cadastrewms.alterColors");
268 drawBoundaries = Main.pref.getBoolean("cadastrewms.drawBoundaries", false);
269 if (alterColors) {
270 backgroundTransparent = Main.pref.getBoolean("cadastrewms.backgroundTransparent");
271 transparency = Float.parseFloat(Main.pref.get("cadastrewms.brightness", "1.0f"));
272 } else {
273 backgroundTransparent = false;
274 transparency = 1.0f;
275 }
276 String currentResolution = Main.pref.get("cadastrewms.resolution", "high");
277 if (currentResolution.equals("high")) {
278 imageWidth = 1000; imageHeight = 800;
279 } else if (currentResolution.equals("medium")){
280 imageWidth = 800; imageHeight = 600;
281 } else {
282 imageWidth = 600; imageHeight = 400;
283 }
284 refreshLayersURL();
285
286 /* TODO: remove in july 2012 */
287 if(!Main.pref.getBoolean("cadastregrab.shortcut.warn", false))
288 {
289 Main.pref.put("cadastregrab.shortcut.warn", true);
290 JOptionPane.showMessageDialog(Main.parent,
291 tr("Plugin cadastre-fr used the key shortcut F11 for grabbing,\n"+
292 "which is now allocated for full-screen switch.\n"+
293 "The new grabbing key is F10, but you can change the key\n" +
294 "in the shortcut settings if you want."));
295 }
296 refreshMenu();
297 }
298
299 private static void refreshLayersURL() {
300 grabLayers = "";
301 grabStyles = "";
302 int countLayers = 0;
303 if (Main.pref.getBoolean("cadastrewms.layerWater", true)) {
304 grabLayers += LAYER_WATER + ",";
305 grabStyles += STYLE_WATER + ",";
306 countLayers++;
307 }
308 if (Main.pref.getBoolean("cadastrewms.layerBuilding", true)) {
309 grabLayers += LAYER_BULDINGS + ",";
310 grabStyles += STYLE_BUILDING + ",";
311 countLayers++;
312 }
313 if (Main.pref.getBoolean("cadastrewms.layerSymbol", true)) {
314 grabLayers += LAYER_SYMBOL + ",";
315 grabStyles += STYLE_SYMBOL + ",";
316 countLayers++;
317 }
318 if (Main.pref.getBoolean("cadastrewms.layerParcel", true)) {
319 grabLayers += LAYER_PARCELS + ",";
320 grabStyles += STYLE_PARCELS + ",";
321 countLayers++;
322 }
323 if (Main.pref.getBoolean("cadastrewms.layerNumero", true)) {
324 grabLayers += LAYER_NUMERO + ",";
325 grabStyles += STYLE_NUMERO + ",";
326 countLayers++;
327 }
328 if (Main.pref.getBoolean("cadastrewms.layerLabel", true)) {
329 grabLayers += LAYER_LABEL + ",";
330 grabStyles += STYLE_LABEL + ",";
331 countLayers++;
332 }
333 if (Main.pref.getBoolean("cadastrewms.layerLieudit", true)) {
334 grabLayers += LAYER_LIEUDIT + ",";
335 grabStyles += STYLE_LIEUDIT + ",";
336 countLayers++;
337 }
338 if (Main.pref.getBoolean("cadastrewms.layerSection", true)) {
339 grabLayers += LAYER_SECTION + ",";
340 grabStyles += STYLE_SECTION + ",";
341 countLayers++;
342 }
343 if (Main.pref.getBoolean("cadastrewms.layerCommune", true)) {
344 grabLayers += LAYER_COMMUNE + ",";
345 grabStyles += STYLE_COMMUNE + ",";
346 countLayers++;
347 }
348 if (countLayers > 2) { // remove the last ','
349 grabLayers = grabLayers.substring(0, grabLayers.length()-1);
350 grabStyles = grabStyles.substring(0, grabStyles.length()-1);
351 } else {
352 JOptionPane.showMessageDialog(Main.parent,tr("Please enable at least two WMS layers in the cadastre-fr "
353 + "plugin configuration.\nLayers ''Building'' and ''Parcel'' added by default."));
354 Main.pref.put("cadastrewms.layerBuilding", true);
355 Main.pref.put("cadastrewms.layerParcel", true);
356 grabLayers += LAYER_BULDINGS + "," + LAYER_PARCELS;
357 grabStyles += STYLE_BUILDING + "," + STYLE_PARCELS;
358 }
359 }
360
361 @Override
362 public PreferenceSetting getPreferenceSetting() {
363 return new CadastrePreferenceSetting();
364 }
365
366 private static void setEnabledAll(boolean isEnabled) {
367 for (int i = 0; i < cadastreJMenu.getItemCount(); i++) {
368 JMenuItem item = cadastreJMenu.getItem(i);
369 if (item != null)
370 if (item.getText().equals(MenuActionGrabPlanImage.name) /*||
371 item.getText().equals(MenuActionGrab.name) ||
372 item.getText().equals(MenuActionBoundaries.name) ||
373 item.getText().equals(MenuActionBuildings.name)*/) {
374 item.setEnabled(isEnabled);
375 }
376 }
377 menuEnabled = isEnabled;
378 }
379
380 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
381 if (cadastreJMenu != null) {
382 if (oldFrame == null && newFrame != null) {
383 setEnabledAll(true);
384 Main.map.addMapMode(new IconToggleButton(new WMSAdjustAction(Main.map)));
385 Main.map.addMapMode(new IconToggleButton(new Address(Main.map)));
386 } else if (oldFrame != null && newFrame == null) {
387 setEnabledAll(false);
388 //Lambert.layoutZone = -1;
389 //LambertCC9Zones.layoutZone = -1;
390 }
391 }
392 }
393
394 public static boolean isLambert() {
395 String code = Main.getProjection().toCode();
396 return Arrays.asList(ProjectionPreference.lambert.allCodes()).contains(code);
397 }
398
399 public static boolean isUtm_france_dom() {
400 String code = Main.getProjection().toCode();
401 return Arrays.asList(ProjectionPreference.utm_france_dom.allCodes()).contains(code);
402 }
403
404 public static boolean isLambert_cc9() {
405 String code = Main.getProjection().toCode();
406 return Arrays.asList(ProjectionPreference.lambert_cc9.allCodes()).contains(code);
407 }
408
409 public static boolean isCadastreProjection() {
410 return isLambert() || isUtm_france_dom() || isLambert_cc9();
411 }
412
413 public static int getCadastreProjectionLayoutZone() {
414 int zone = -1;
415 Projection proj = Main.getProjection();
416 if (proj instanceof AbstractProjection) {
417 Integer code = ((AbstractProjection) proj).getEpsgCode();
418 if (code != null) {
419 if (code >= 3942 && code <= 3950) { // LambertCC9Zones
420 zone = code - 3942;
421 } else if (code >= 27561 && 27564 <= code) { // Lambert
422 zone = code - 27561;
423 } else { // UTM_France_DOM
424 Map<Integer, Integer> utmfr = new HashMap<>();
425 utmfr.put(2969, 0);
426 utmfr.put(2970, 1);
427 utmfr.put(2973, 2);
428 utmfr.put(2975, 3);
429 utmfr.put(2972, 4);
430 if (utmfr.containsKey(code)) {
431 zone = utmfr.get(code);
432 }
433 }
434 }
435 }
436 return zone;
437 }
438
439 public static void safeSleep(long milliseconds) {
440 try {
441 Thread.sleep(milliseconds);
442 } catch (InterruptedException e) {}
443 }
444
445 // See OptionPaneUtil
446 // FIXME: this is a temporary solution.
447 public static void prepareDialog(JDialog dialog) {
448 if (Main.pref.getBoolean("window-handling.option-pane-always-on-top", true)) {
449 try {
450 dialog.setAlwaysOnTop(true);
451 } catch(SecurityException e) {
452 System.out.println(tr("Warning: failed to put option pane dialog always on top. Exception was: {0}", e.toString()));
453 }
454 }
455 dialog.setModal(true);
456 dialog.toFront();
457 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
458 }
459
460 /**
461 * Adds the WMSLayer following this rule:<br/>
462 * - if a WMSLayer exists place this new layer just before this layer<br/>
463 * - Otherwise place it at the bottom
464 * @param wmsLayer the wmsLayer to add
465 */
466 public static void addWMSLayer(WMSLayer wmsLayer) {
467 if (Main.map != null && Main.map.mapView != null) {
468 int wmsNewLayerPos = Main.map.mapView.getAllLayers().size();
469 for(Layer l : Main.map.mapView.getLayersOfType(WMSLayer.class)) {
470 int wmsPos = Main.map.mapView.getLayerPos(l);
471 if (wmsPos < wmsNewLayerPos) wmsNewLayerPos = wmsPos;
472 }
473 Main.main.addLayer(wmsLayer);
474 // Move the layer to its new position
475 Main.map.mapView.moveLayer(wmsLayer, wmsNewLayerPos);
476 } else
477 Main.main.addLayer(wmsLayer);
478 }
479
480 private static String checkSourceMillesime() {
481 java.util.Calendar calendar = java.util.Calendar.getInstance();
482 int currentYear = calendar.get(java.util.Calendar.YEAR);
483 String src = Main.pref.get("cadastrewms.source",
484 "cadastre-dgi-fr source : Direction G\u00e9n\u00e9rale des Imp\u00f4ts - Cadastre. Mise \u00e0 jour : AAAA");
485 String srcYear = src.substring(src.lastIndexOf(" ")+1);
486 Integer year = null;
487 try {
488 year = Integer.decode(srcYear);
489 } catch (NumberFormatException e) {}
490 if (srcYear.equals("AAAA") || (year != null && year < currentYear)) {
491 System.out.println("Replace source year "+srcYear+" by current year "+currentYear);
492 src = src.substring(0, src.lastIndexOf(" ")+1)+currentYear;
493 Main.pref.put("cadastrewms.source", src);
494 }
495 return src;
496 }
497
498 public static void askToChangeProjection() {
499 if (JOptionPane.showConfirmDialog(Main.parent,
500 tr("To enable the cadastre WMS plugin, change\n"
501 + "the current projection to one of the cadastre\n"
502 + "projections and retry"),
503 tr("Change the current projection"), JOptionPane.OK_CANCEL_OPTION)
504 == JOptionPane.OK_OPTION) {
505 PreferenceDialog p = new PreferenceDialog(Main.parent);
506 p.selectPreferencesTabByClass(MapPreference.class);
507 p.getTabbedPane().getSetting(ProjectionPreference.class).selectProjection(ProjectionPreference.lambert_cc9);
508 p.setVisible(true);
509 }
510 }
511}
Note: See TracBrowser for help on using the repository browser.