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

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

[josm_plugins] fix various compilation warnings

  • Property svn:eol-style set to native
File size: 2.0 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.tools.I18n.tr;
5
6//import java.awt.event.ActionEvent;
7import java.util.ArrayList;
8
9import javax.swing.JOptionPane;
10
11import org.openstreetmap.josm.Main;
12//import org.openstreetmap.josm.actions.JosmAction;
13import org.openstreetmap.josm.gui.layer.Layer;
14
15public class WMSDownloadAction /*extends JosmAction */{
16
17// public WMSDownloadAction(String layerName) {
18// super(layerName, "wmsmenu", tr("Download WMS tile from {0}",layerName), null, false);
19// }
20//
21// public void actionPerformed(ActionEvent e) {
22// DownloadWMSVectorImage.download(getLayer());
23// }
24
25 public static WMSLayer getLayer() {
26 // check if we already have a layer created. if not, create; if yes, reuse.
27 ArrayList<WMSLayer> existingWMSlayers = new ArrayList<WMSLayer>();
28 if (Main.map != null) {
29 Layer activeLayer = Main.map.mapView.getActiveLayer();
30 if (activeLayer instanceof WMSLayer)
31 return (WMSLayer) activeLayer;
32 for (Layer l : Main.map.mapView.getAllLayers()) {
33 if (l instanceof WMSLayer) {
34 existingWMSlayers.add((WMSLayer)l);
35 }
36 }
37 if (existingWMSlayers.size() == 1)
38 return existingWMSlayers.get(0);
39 if (existingWMSlayers.size() == 0)
40 return new MenuActionNewLocation().addNewLayer(existingWMSlayers);
41 if (Main.pref.getBoolean("cadastrewms.autoFirstLayer", false)) {
42 return existingWMSlayers.get(0);
43 } else {
44 JOptionPane.showMessageDialog(Main.parent,
45 tr("More than one WMS layer present\nSelect one of them first, then retry"));
46 }
47 } else {
48 return new MenuActionNewLocation().addNewLayer(existingWMSlayers);
49 }
50 return null;
51 }
52};
53
Note: See TracBrowser for help on using the repository browser.