1 | package cadastre_fr;
|
---|
2 |
|
---|
3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
4 |
|
---|
5 | import java.awt.event.ActionEvent;
|
---|
6 | import java.awt.event.KeyEvent;
|
---|
7 |
|
---|
8 | import javax.swing.JOptionPane;
|
---|
9 |
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
12 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
13 |
|
---|
14 | public class MenuActionGrab extends JosmAction {
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Action calling the wms grabber for cadastre.gouv.fr
|
---|
18 | */
|
---|
19 | private static final long serialVersionUID = 1L;
|
---|
20 |
|
---|
21 | public static String name = "Cadastre grab";
|
---|
22 |
|
---|
23 | public MenuActionGrab() {
|
---|
24 | super(tr(name), "cadastre_small", tr("Download Image from French Cadastre WMS"),
|
---|
25 | Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")),
|
---|
26 | KeyEvent.VK_F11, Shortcut.GROUP_DIRECT), false);
|
---|
27 | }
|
---|
28 |
|
---|
29 | public void actionPerformed(ActionEvent e) {
|
---|
30 | if (Main.map != null) {
|
---|
31 | if (CadastrePlugin.isCadastreProjection()) {
|
---|
32 | WMSLayer wmsLayer = WMSDownloadAction.getLayer();
|
---|
33 | if (wmsLayer != null)
|
---|
34 | DownloadWMSVectorImage.download(wmsLayer);
|
---|
35 | } else {
|
---|
36 | JOptionPane.showMessageDialog(Main.parent,
|
---|
37 | tr("To enable the cadastre WMS plugin, change\n"
|
---|
38 | + "the current projection to one of the cadastre\n"
|
---|
39 | + "projection and retry"));
|
---|
40 | }
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|