source: subversion/applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/actions/MenuActionGrab.java

Last change on this file was 34668, checked in by donvip, 7 months ago

fix warnings

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins.fr.cadastre.actions;
3
4import static org.openstreetmap.josm.tools.I18n.marktr;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.actions.JosmAction;
11import org.openstreetmap.josm.gui.MainApplication;
12import org.openstreetmap.josm.plugins.fr.cadastre.CadastrePlugin;
13import org.openstreetmap.josm.plugins.fr.cadastre.wms.DownloadWMSVectorImage;
14import org.openstreetmap.josm.plugins.fr.cadastre.wms.WMSLayer;
15import org.openstreetmap.josm.tools.Shortcut;
16
17/**
18 * Action calling the wms grabber for cadastre.gouv.fr
19 */
20public class MenuActionGrab extends JosmAction {
21
22    private static final String NAME = marktr("Cadastre grab");
23
24    /**
25     * Constructs a new {@code MenuActionGrab}.
26     */
27    public MenuActionGrab() {
28        super(tr(NAME), "cadastre_small", tr("Download Image from French Cadastre WMS"),
29                Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")),
30                KeyEvent.VK_F10, Shortcut.DIRECT), false, "cadastrefr/grab", true);
31    }
32
33    @Override
34    public void actionPerformed(ActionEvent e) {
35        if (MainApplication.getMap() != null) {
36            if (CadastrePlugin.isCadastreProjection()) {
37                WMSLayer wmsLayer = WMSDownloadAction.getLayer();
38                if (wmsLayer != null)
39                    DownloadWMSVectorImage.download(wmsLayer);
40            } else {
41                CadastrePlugin.askToChangeProjection();
42            }
43        } else
44            new MenuActionNewLocation().actionPerformed(e);
45    }
46}
Note: See TracBrowser for help on using the repository browser.