source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java @ 12841

Last change on this file since 12841 was 12841, checked in by bastiK, 5 weeks ago

see #15229 - fix deprecations caused by [12840]

  • Property svn:eol-style set to native
File size: 23.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.preferences.projection;
3
4import static org.openstreetmap.josm.data.SystemOfMeasurement.ALL_SYSTEMS;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.Component;
8import java.awt.GridBagLayout;
9import java.awt.event.ActionListener;
10import java.util.ArrayList;
11import java.util.Collection;
12import java.util.Collections;
13import java.util.HashMap;
14import java.util.List;
15import java.util.Map;
16
17import javax.swing.BorderFactory;
18import javax.swing.JButton;
19import javax.swing.JLabel;
20import javax.swing.JOptionPane;
21import javax.swing.JPanel;
22import javax.swing.JSeparator;
23
24import org.openstreetmap.josm.Main;
25import org.openstreetmap.josm.actions.ExpertToggleAction;
26import org.openstreetmap.josm.data.Bounds;
27import org.openstreetmap.josm.data.SystemOfMeasurement;
28import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
29import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat;
30import org.openstreetmap.josm.data.preferences.ListProperty;
31import org.openstreetmap.josm.data.preferences.StringProperty;
32import org.openstreetmap.josm.data.projection.CustomProjection;
33import org.openstreetmap.josm.data.projection.Projection;
34import org.openstreetmap.josm.data.projection.Projections;
35import org.openstreetmap.josm.gui.ExtendedDialog;
36import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
37import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
38import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
39import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
40import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
41import org.openstreetmap.josm.gui.widgets.JosmComboBox;
42import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
43import org.openstreetmap.josm.tools.GBC;
44import org.openstreetmap.josm.tools.JosmRuntimeException;
45import org.openstreetmap.josm.tools.Logging;
46
47/**
48 * Projection preferences.
49 *
50 * How to add new Projections:
51 *  - Find EPSG code for the projection.
52 *  - Look up the parameter string for Proj4, e.g. on http://spatialreference.org/
53 *      and add it to the file 'data/projection/epsg' in JOSM trunk
54 *  - Search for official references and verify the parameter values. These
55 *      documents are often available in the local language only.
56 *  - Use {@link #registerProjectionChoice}, to make the entry known to JOSM.
57 *
58 * In case there is no EPSG code:
59 *  - override {@link AbstractProjectionChoice#getProjection()} and provide
60 *    a manual implementation of the projection. Use {@link CustomProjection}
61 *    if possible.
62 */
63public class ProjectionPreference implements SubPreferenceSetting {
64
65    /**
66     * Factory used to create a new {@code ProjectionPreference}.
67     */
68    public static class Factory implements PreferenceSettingFactory {
69        @Override
70        public PreferenceSetting createPreferenceSetting() {
71            return new ProjectionPreference();
72        }
73    }
74
75    private static final List<ProjectionChoice> projectionChoices = new ArrayList<>();
76    private static final Map<String, ProjectionChoice> projectionChoicesById = new HashMap<>();
77
78    /**
79     * WGS84: Directly use latitude / longitude values as x/y.
80     */
81    public static final ProjectionChoice wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326, "epsg4326");
82
83    /**
84     * Mercator Projection.
85     *
86     * The center of the mercator projection is always the 0 grad coordinate.
87     *
88     * See also USGS Bulletin 1532 (http://pubs.usgs.gov/bul/1532/report.pdf)
89     * initially EPSG used 3785 but that has been superseded by 3857, see https://www.epsg-registry.org/
90     */
91    public static final ProjectionChoice mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 3857);
92
93    /**
94     * Lambert conic conform 4 zones using the French geodetic system NTF.
95     *
96     * This newer version uses the grid translation NTF&lt;-&gt;RGF93 provided by IGN for a submillimetric accuracy.
97     * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal)
98     *
99     * Source: http://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf
100     */
101    public static final ProjectionChoice lambert = new LambertProjectionChoice();
102
103    /**
104     * French departements in the Caribbean Sea and Indian Ocean.
105     *
106     * Using the UTM transvers Mercator projection and specific geodesic settings.
107     */
108    public static final ProjectionChoice utm_france_dom = new UTMFranceDOMProjectionChoice();
109
110    /**
111     * Lambert Conic Conform 9 Zones projection.
112     *
113     * As specified by the IGN in this document
114     * http://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf
115     */
116    public static final ProjectionChoice lambert_cc9 = new LambertCC9ZonesProjectionChoice();
117
118    static {
119
120        /************************
121         * Global projections.
122         */
123
124        /**
125         * UTM.
126         */
127        registerProjectionChoice(new UTMProjectionChoice());
128
129        /************************
130         * Regional - alphabetical order by country code.
131         */
132
133        /**
134         * Belgian Lambert 72 projection.
135         *
136         * As specified by the Belgian IGN in this document:
137         * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf
138         *
139         * @author Don-vip
140         */
141        registerProjectionChoice(tr("Belgian Lambert 1972"), "core:belgianLambert1972", 31370);     // BE
142
143        /**
144         * Belgian Lambert 2008 projection.
145         *
146         * As specified by the Belgian IGN in this document:
147         * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf
148         *
149         * @author Don-vip
150         */
151        registerProjectionChoice(tr("Belgian Lambert 2008"), "core:belgianLambert2008", 3812);      // BE
152
153        /**
154         * SwissGrid CH1903 / L03, see https://en.wikipedia.org/wiki/Swiss_coordinate_system.
155         *
156         * Actually, what we have here, is CH1903+ (EPSG:2056), but without
157         * the additional false easting of 2000km and false northing 1000 km.
158         *
159         * To get to CH1903, a shift file is required. So currently, there are errors
160         * up to 1.6m (depending on the location).
161         */
162        registerProjectionChoice(new SwissGridProjectionChoice());                                  // CH
163
164        registerProjectionChoice(new GaussKruegerProjectionChoice());                               // DE
165
166        /**
167         * Estonian Coordinate System of 1997.
168         *
169         * Thanks to Johan Montagnat and its geoconv java converter application
170         * (https://www.i3s.unice.fr/~johan/gps/ , published under GPL license)
171         * from which some code and constants have been reused here.
172         */
173        registerProjectionChoice(tr("Lambert Zone (Estonia)"), "core:lambertest", 3301);            // EE
174
175        /**
176         * Lambert conic conform 4 zones using the French geodetic system NTF.
177         *
178         * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy.
179         * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal)
180         *
181         * Source: http://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf
182         * @author Pieren
183         */
184        registerProjectionChoice(lambert);                                                          // FR
185
186        /**
187         * Lambert 93 projection.
188         *
189         * As specified by the IGN in this document
190         * http://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/Lambert-93.pdf
191         * @author Don-vip
192         */
193        registerProjectionChoice(tr("Lambert 93 (France)"), "core:lambert93", 2154);                // FR
194
195        /**
196         * Lambert Conic Conform 9 Zones projection.
197         *
198         * As specified by the IGN in this document
199         * http://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf
200         * @author Pieren
201         */
202        registerProjectionChoice(lambert_cc9);                                                      // FR
203
204        /**
205         * French departements in the Caribbean Sea and Indian Ocean.
206         *
207         * Using the UTM transvers Mercator projection and specific geodesic settings.
208         */
209        registerProjectionChoice(utm_france_dom);                                                   // FR
210
211        /**
212         * LKS-92/ Latvia TM projection.
213         *
214         * Based on data from spatialreference.org.
215         * http://spatialreference.org/ref/epsg/3059/
216         *
217         * @author Viesturs Zarins
218         */
219        registerProjectionChoice(tr("LKS-92 (Latvia TM)"), "core:tmerclv", 3059);                   // LV
220
221        /**
222         * Netherlands RD projection
223         *
224         * @author vholten
225         */
226        registerProjectionChoice(tr("Rijksdriehoekscoördinaten (Netherlands)"), "core:dutchrd", 28992); // NL
227
228        /**
229         * PUWG 1992 and 2000 are the official cordinate systems in Poland.
230         *
231         * They use the same math as UTM only with different constants.
232         *
233         * @author steelman
234         */
235        registerProjectionChoice(new PuwgProjectionChoice());                                       // PL
236
237        /**
238         * SWEREF99 13 30 projection. Based on data from spatialreference.org.
239         * http://spatialreference.org/ref/epsg/3008/
240         *
241         * @author Hanno Hecker
242         */
243        registerProjectionChoice(tr("SWEREF99 13 30 / EPSG:3008 (Sweden)"), "core:sweref99", 3008); // SE
244
245        /************************
246         * Projection by Code.
247         */
248        registerProjectionChoice(new CodeProjectionChoice());
249
250        /************************
251         * Custom projection.
252         */
253        registerProjectionChoice(new CustomProjectionChoice());
254    }
255
256    public static void registerProjectionChoice(ProjectionChoice c) {
257        projectionChoices.add(c);
258        projectionChoicesById.put(c.getId(), c);
259        for (String code : c.allCodes()) {
260            Projections.registerProjectionSupplier(code, () -> {
261                Collection<String> pref = c.getPreferencesFromCode(code);
262                c.setPreferences(pref);
263                try {
264                    return c.getProjection();
265                } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
266                    Logging.log(Logging.LEVEL_WARN, "Unable to get projection "+code+" with "+c+':', e);
267                    return null;
268                }
269            });
270        }
271    }
272
273    public static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg, String cacheDir) {
274        ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg, cacheDir);
275        registerProjectionChoice(pc);
276        return pc;
277    }
278
279    private static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg) {
280        ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg);
281        registerProjectionChoice(pc);
282        return pc;
283    }
284
285    public static List<ProjectionChoice> getProjectionChoices() {
286        return Collections.unmodifiableList(projectionChoices);
287    }
288
289    private static String projectionChoice;
290
291    private static final StringProperty PROP_PROJECTION_DEFAULT = new StringProperty("projection.default", mercator.getId());
292    private static final StringProperty PROP_COORDINATES = new StringProperty("coordinates", null);
293    private static final ListProperty PROP_SUB_PROJECTION_DEFAULT = new ListProperty("projection.default.sub", null);
294    private static final String[] unitsValues = ALL_SYSTEMS.keySet().toArray(new String[ALL_SYSTEMS.size()]);
295    private static final String[] unitsValuesTr = new String[unitsValues.length];
296    static {
297        for (int i = 0; i < unitsValues.length; ++i) {
298            unitsValuesTr[i] = tr(unitsValues[i]);
299        }
300    }
301
302    /**
303     * Combobox with all projections available
304     */
305    private final JosmComboBox<ProjectionChoice> projectionCombo;
306
307    /**
308     * Combobox with all coordinate display possibilities
309     */
310    private final JosmComboBox<ICoordinateFormat> coordinatesCombo;
311
312    private final JosmComboBox<String> unitsCombo = new JosmComboBox<>(unitsValuesTr);
313
314    /**
315     * This variable holds the JPanel with the projection's preferences. If the
316     * selected projection does not implement this, it will be set to an empty
317     * Panel.
318     */
319    private JPanel projSubPrefPanel;
320    private final JPanel projSubPrefPanelWrapper = new JPanel(new GridBagLayout());
321
322    private final JLabel projectionCodeLabel = new JLabel(tr("Projection code"));
323    private final Component projectionCodeGlue = GBC.glue(5, 0);
324    private final JLabel projectionCode = new JLabel();
325    private final JLabel projectionNameLabel = new JLabel(tr("Projection name"));
326    private final Component projectionNameGlue = GBC.glue(5, 0);
327    private final JLabel projectionName = new JLabel();
328    private final JLabel bounds = new JLabel();
329
330    /**
331     * This is the panel holding all projection preferences
332     */
333    private final VerticallyScrollablePanel projPanel = new VerticallyScrollablePanel(new GridBagLayout());
334
335    /**
336     * The GridBagConstraints for the Panel containing the ProjectionSubPrefs.
337     * This is required twice in the code, creating it here keeps both occurrences
338     * in sync
339     */
340    private static final GBC projSubPrefPanelGBC = GBC.std().fill(GBC.BOTH).weight(1.0, 1.0);
341
342    public ProjectionPreference() {
343        this.projectionCombo = new JosmComboBox<>(
344            projectionChoices.toArray(new ProjectionChoice[projectionChoices.size()]));
345        this.coordinatesCombo = new JosmComboBox<>(
346                CoordinateFormatManager.getCoordinateFormats().toArray(new ICoordinateFormat[0]));
347    }
348
349    @Override
350    public void addGui(PreferenceTabbedPane gui) {
351        final ProjectionChoice pc = setupProjectionCombo();
352
353        for (int i = 0; i < coordinatesCombo.getItemCount(); ++i) {
354            if (coordinatesCombo.getItemAt(i).getId().equals(PROP_COORDINATES.get())) {
355                coordinatesCombo.setSelectedIndex(i);
356                break;
357            }
358        }
359
360        for (int i = 0; i < unitsValues.length; ++i) {
361            if (unitsValues[i].equals(SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.get())) {
362                unitsCombo.setSelectedIndex(i);
363                break;
364            }
365        }
366
367        projPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
368        projPanel.add(new JLabel(tr("Projection method")), GBC.std().insets(5, 5, 0, 5));
369        projPanel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
370        projPanel.add(projectionCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
371        projPanel.add(projectionCodeLabel, GBC.std().insets(25, 5, 0, 5));
372        projPanel.add(projectionCodeGlue, GBC.std().fill(GBC.HORIZONTAL));
373        projPanel.add(projectionCode, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
374        projPanel.add(projectionNameLabel, GBC.std().insets(25, 5, 0, 5));
375        projPanel.add(projectionNameGlue, GBC.std().fill(GBC.HORIZONTAL));
376        projPanel.add(projectionName, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
377        projPanel.add(new JLabel(tr("Bounds")), GBC.std().insets(25, 5, 0, 5));
378        projPanel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
379        projPanel.add(bounds, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
380        projPanel.add(projSubPrefPanelWrapper, GBC.eol().fill(GBC.HORIZONTAL).insets(20, 5, 5, 5));
381
382        projectionCodeLabel.setLabelFor(projectionCode);
383        projectionNameLabel.setLabelFor(projectionName);
384
385        JButton btnSetAsDefault = new JButton(tr("Set as default"));
386        projPanel.add(btnSetAsDefault, GBC.eol().insets(5, 10, 5, 5));
387        btnSetAsDefault.addActionListener(e -> {
388            ProjectionChoice pc2 = (ProjectionChoice) projectionCombo.getSelectedItem();
389            String id = pc2.getId();
390            Collection<String> prefs = pc2.getPreferences(projSubPrefPanel);
391            setProjection(id, prefs, true);
392            pc2.setPreferences(prefs);
393            Projection proj = pc2.getProjection();
394            new ExtendedDialog(gui, tr("Default projection"), tr("OK"))
395                    .setButtonIcons("ok")
396                    .setIcon(JOptionPane.INFORMATION_MESSAGE)
397                    .setContent(tr("Default projection has been set to ''{0}''", proj.toCode()))
398                    .showDialog();
399        });
400        ExpertToggleAction.addVisibilitySwitcher(btnSetAsDefault);
401
402        projPanel.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 10));
403        projPanel.add(new JLabel(tr("Display coordinates as")), GBC.std().insets(5, 5, 0, 5));
404        projPanel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
405        projPanel.add(coordinatesCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
406        projPanel.add(new JLabel(tr("System of measurement")), GBC.std().insets(5, 5, 0, 5));
407        projPanel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
408        projPanel.add(unitsCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5));
409        projPanel.add(GBC.glue(1, 1), GBC.std().fill(GBC.HORIZONTAL).weight(1.0, 1.0));
410
411        gui.getMapPreference().addSubTab(this, tr("Map Projection"), projPanel.getVerticalScrollPane());
412
413        selectedProjectionChanged(pc);
414    }
415
416    private void updateMeta(ProjectionChoice pc) {
417        pc.setPreferences(pc.getPreferences(projSubPrefPanel));
418        Projection proj = pc.getProjection();
419        projectionCode.setText(proj.toCode());
420        projectionName.setText(proj.toString());
421        Bounds b = proj.getWorldBoundsLatLon();
422        ICoordinateFormat cf = CoordinateFormatManager.getDefaultFormat();
423        bounds.setText(cf.lonToString(b.getMin()) + ", " + cf.latToString(b.getMin()) + " : " +
424                cf.lonToString(b.getMax()) + ", " + cf.latToString(b.getMax()));
425        boolean showCode = true;
426        boolean showName = false;
427        if (pc instanceof SubPrefsOptions) {
428            showCode = ((SubPrefsOptions) pc).showProjectionCode();
429            showName = ((SubPrefsOptions) pc).showProjectionName();
430        }
431        projectionCodeLabel.setVisible(showCode);
432        projectionCodeGlue.setVisible(showCode);
433        projectionCode.setVisible(showCode);
434        projectionNameLabel.setVisible(showName);
435        projectionNameGlue.setVisible(showName);
436        projectionName.setVisible(showName);
437    }
438
439    @Override
440    public boolean ok() {
441        ProjectionChoice pc = (ProjectionChoice) projectionCombo.getSelectedItem();
442
443        String id = pc.getId();
444        Collection<String> prefs = pc.getPreferences(projSubPrefPanel);
445
446        setProjection(id, prefs, false);
447
448        if (PROP_COORDINATES.put(((ICoordinateFormat) coordinatesCombo.getSelectedItem()).getId())) {
449            CoordinateFormatManager.setCoordinateFormat((ICoordinateFormat) coordinatesCombo.getSelectedItem());
450        }
451
452        int i = unitsCombo.getSelectedIndex();
453        SystemOfMeasurement.setSystemOfMeasurement(unitsValues[i]);
454
455        return false;
456    }
457
458    public static void setProjection() {
459        setProjection(PROP_PROJECTION_DEFAULT.get(), PROP_SUB_PROJECTION_DEFAULT.get(), false);
460    }
461
462    /**
463     * Set projection.
464     * @param id id of the selected projection choice
465     * @param pref the configuration for the selected projection choice
466     * @param makeDefault true, if it is to be set as permanent default
467     * false, if it is to be set for the current session
468     * @since 12306
469     */
470    public static void setProjection(String id, Collection<String> pref, boolean makeDefault) {
471        ProjectionChoice pc = projectionChoicesById.get(id);
472
473        if (pc == null) {
474            JOptionPane.showMessageDialog(
475                    Main.parent,
476                    tr("The projection {0} could not be activated. Using Mercator", id),
477                    tr("Error"),
478                    JOptionPane.ERROR_MESSAGE
479            );
480            pref = null;
481            pc = mercator;
482        }
483        id = pc.getId();
484        Main.pref.putList("projection.sub."+id, pref == null ? null : new ArrayList<>(pref));
485        if (makeDefault) {
486            PROP_PROJECTION_DEFAULT.put(id);
487            PROP_SUB_PROJECTION_DEFAULT.put(pref == null ? null : new ArrayList<>(pref));
488        } else {
489            projectionChoice = id;
490        }
491        pc.setPreferences(pref);
492        Projection proj = pc.getProjection();
493        Main.setProjection(proj);
494    }
495
496    /**
497     * Handles all the work related to update the projection-specific
498     * preferences
499     * @param pc the choice class representing user selection
500     */
501    private void selectedProjectionChanged(final ProjectionChoice pc) {
502        // Don't try to update if we're still starting up
503        int size = projPanel.getComponentCount();
504        if (size < 1)
505            return;
506
507        final ActionListener listener = e -> updateMeta(pc);
508
509        // Replace old panel with new one
510        projSubPrefPanelWrapper.removeAll();
511        projSubPrefPanel = pc.getPreferencePanel(listener);
512        projSubPrefPanelWrapper.add(projSubPrefPanel, projSubPrefPanelGBC);
513        projPanel.revalidate();
514        projSubPrefPanel.repaint();
515        updateMeta(pc);
516    }
517
518    /**
519     * Sets up projection combobox with default values and action listener
520     * @return the choice class for user selection
521     */
522    private ProjectionChoice setupProjectionCombo() {
523        String pcId = getCurrentProjectionChoiceId();
524        ProjectionChoice pc = null;
525        for (int i = 0; i < projectionCombo.getItemCount(); ++i) {
526            ProjectionChoice pc1 = projectionCombo.getItemAt(i);
527            pc1.setPreferences(getSubprojectionPreference(pc1.getId()));
528            if (pc1.getId().equals(pcId)) {
529                projectionCombo.setSelectedIndex(i);
530                selectedProjectionChanged(pc1);
531                pc = pc1;
532            }
533        }
534        // If the ProjectionChoice from the preferences is not available, it
535        // should have been set to Mercator at JOSM start.
536        if (pc == null)
537            throw new JosmRuntimeException("Couldn't find the current projection in the list of available projections!");
538
539        projectionCombo.addActionListener(e -> {
540            ProjectionChoice pc1 = (ProjectionChoice) projectionCombo.getSelectedItem();
541            selectedProjectionChanged(pc1);
542        });
543        return pc;
544    }
545
546    /**
547     * Get the id of the projection choice that is currently set.
548     * @return id of the projection choice that is currently set
549     */
550    public static String getCurrentProjectionChoiceId() {
551        return projectionChoice != null ? projectionChoice : PROP_PROJECTION_DEFAULT.get();
552    }
553
554    /**
555     * Get the preferences that have been selected the last time for the given
556     * projection choice.
557     * @param pcId id of the projection choice
558     * @return projection choice parameters that have been selected by the user
559     * the last time; null if user has never selected the given projection choice
560     */
561    public static Collection<String> getSubprojectionPreference(String pcId) {
562        return Main.pref.getList("projection.sub."+pcId, null);
563    }
564
565    @Override
566    public boolean isExpert() {
567        return false;
568    }
569
570    @Override
571    public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {
572        return gui.getMapPreference();
573    }
574
575    /**
576     * Selects the given projection.
577     * @param projection The projection to select.
578     * @since 5604
579     */
580    public void selectProjection(ProjectionChoice projection) {
581        if (projectionCombo != null && projection != null) {
582            projectionCombo.setSelectedItem(projection);
583        }
584    }
585}
Note: See TracBrowser for help on using the repository browser.