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

Last change on this file since 18207 was 18207, checked in by pieren, 15 years ago

Use the new cadastre projection LambertCC9Zones

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1package cadastre_fr;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4
5import java.awt.GridBagLayout;
6import java.awt.event.ActionEvent;
7
8import javax.swing.JComboBox;
9import javax.swing.JLabel;
10import javax.swing.JOptionPane;
11import javax.swing.JPanel;
12
13import org.openstreetmap.josm.Main;
14import org.openstreetmap.josm.actions.JosmAction;
15import org.openstreetmap.josm.data.projection.Lambert;
16import org.openstreetmap.josm.data.projection.LambertCC9Zones;
17import org.openstreetmap.josm.tools.GBC;
18
19public class MenuActionLambertZone extends JosmAction {
20
21 private static final long serialVersionUID = 1L;
22
23 public static String name = "Change Lambert zone";
24
25 public static String[] lambert4zones = { "", "1 (51.30 to 48.15 degrees)", "2 (48.15 to 45.45 degrees)", "3 (45.45 to 42.76 degrees)", "4 (Corsica)" };
26 public static String[] lambert9zones = { "", "1 (41 to 43 degrees)", "2 (42 to 44 degrees)",
27 "3 (43 to 45 degrees)", "4 (44 to 46 degrees)", "5 (45 to 47 degrees)",
28 "6 (46 to 48 degrees)", "7 (47 to 49 degrees)", "8 (48 to 50 degrees)",
29 "9 (49 to 51 degrees)" };
30
31 public MenuActionLambertZone() {
32 super(tr(name), "cadastre_small", tr("Set manually the Lambert zone"),
33 null, false);
34 }
35
36 public void actionPerformed(ActionEvent e) {
37 JPanel p = new JPanel(new GridBagLayout());
38 final JComboBox inputLambertZone;
39 if (Main.proj instanceof LambertCC9Zones)
40 inputLambertZone = new JComboBox(lambert9zones);
41 else
42 inputLambertZone = new JComboBox(lambert4zones);
43 JLabel newLambertZone = new JLabel(tr("Zone"));
44 p.add(newLambertZone, GBC.std());
45 p.add(inputLambertZone, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 0));
46 JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null) {
47 private static final long serialVersionUID = 1L;
48
49 @Override
50 public void selectInitialValue() {
51 inputLambertZone.setSelectedIndex(0);
52 }
53 };
54 pane.createDialog(Main.parent, tr("Lambert zone")).setVisible(true);
55 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
56 return;
57 if (inputLambertZone.getSelectedIndex() > 0) {
58 Lambert.layoutZone = inputLambertZone.getSelectedIndex() - 1;
59 LambertCC9Zones.layoutZone = Lambert.layoutZone;
60 }
61 }
62}
Note: See TracBrowser for help on using the repository browser.