[32556] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
[13497] | 2 | package cadastre_fr;
|
---|
| 3 |
|
---|
[30701] | 4 | import static org.openstreetmap.josm.tools.I18n.marktr;
|
---|
[13497] | 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 6 |
|
---|
| 7 | import java.awt.event.ActionEvent;
|
---|
| 8 | import java.awt.event.KeyEvent;
|
---|
| 9 |
|
---|
| 10 | import org.openstreetmap.josm.Main;
|
---|
| 11 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
| 12 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
| 13 |
|
---|
[30701] | 14 | /**
|
---|
| 15 | * Action calling the wms grabber for cadastre.gouv.fr
|
---|
| 16 | */
|
---|
[13497] | 17 | public class MenuActionGrab extends JosmAction {
|
---|
| 18 |
|
---|
[33047] | 19 | public static final String NAME = marktr("Cadastre grab");
|
---|
[13497] | 20 |
|
---|
[33047] | 21 | /**
|
---|
| 22 | * Constructs a new {@code MenuActionGrab}.
|
---|
| 23 | */
|
---|
[13497] | 24 | public MenuActionGrab() {
|
---|
[33047] | 25 | super(tr(NAME), "cadastre_small", tr("Download Image from French Cadastre WMS"),
|
---|
[16007] | 26 | Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")),
|
---|
[27906] | 27 | KeyEvent.VK_F10, Shortcut.DIRECT), false, "cadastrefr/grab", true);
|
---|
[13497] | 28 | }
|
---|
| 29 |
|
---|
[32556] | 30 | @Override
|
---|
[13497] | 31 | public void actionPerformed(ActionEvent e) {
|
---|
[18838] | 32 | if (Main.map != null) {
|
---|
[16929] | 33 | if (CadastrePlugin.isCadastreProjection()) {
|
---|
| 34 | WMSLayer wmsLayer = WMSDownloadAction.getLayer();
|
---|
| 35 | if (wmsLayer != null)
|
---|
[24907] | 36 | DownloadWMSVectorImage.download(wmsLayer);
|
---|
[16929] | 37 | } else {
|
---|
[29101] | 38 | CadastrePlugin.askToChangeProjection();
|
---|
[16929] | 39 | }
|
---|
[18838] | 40 | } else
|
---|
| 41 | new MenuActionNewLocation().actionPerformed(e);
|
---|
[13497] | 42 | }
|
---|
| 43 | }
|
---|