| 1 | package cadastre_fr;
|
|---|
| 2 |
|
|---|
| 3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 4 |
|
|---|
| 5 | import java.awt.GridBagLayout;
|
|---|
| 6 | import java.awt.event.ActionEvent;
|
|---|
| 7 |
|
|---|
| 8 | import javax.swing.JComboBox;
|
|---|
| 9 | import javax.swing.JLabel;
|
|---|
| 10 | import javax.swing.JOptionPane;
|
|---|
| 11 | import javax.swing.JPanel;
|
|---|
| 12 |
|
|---|
| 13 | import org.openstreetmap.josm.Main;
|
|---|
| 14 | import org.openstreetmap.josm.actions.JosmAction;
|
|---|
| 15 | import org.openstreetmap.josm.data.projection.Lambert;
|
|---|
| 16 | import org.openstreetmap.josm.tools.GBC;
|
|---|
| 17 |
|
|---|
| 18 | public class MenuActionLambertZone extends JosmAction {
|
|---|
| 19 |
|
|---|
| 20 | private static final long serialVersionUID = 1L;
|
|---|
| 21 |
|
|---|
| 22 | public static String name = "Change Lambert zone";
|
|---|
| 23 |
|
|---|
| 24 | public MenuActionLambertZone() {
|
|---|
| 25 | super(tr(name), "cadastre_small", tr("Set manually the Lambert zone (e.g. for locations between two zones)"),
|
|---|
| 26 | null, false);
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | public void actionPerformed(ActionEvent e) {
|
|---|
| 30 | JPanel p = new JPanel(new GridBagLayout());
|
|---|
| 31 | String[] zones = { "", "1 (51.30 to 48.15 degrees)", "2 (48.15 to 45.45 degrees)", "3 (45.45 to 42.76 degrees)", "4 (Corsica)" };
|
|---|
| 32 | final JComboBox inputLambertZone = new JComboBox(zones);
|
|---|
| 33 | JLabel newLambertZone = new JLabel(tr("Zone"));
|
|---|
| 34 | p.add(newLambertZone, GBC.std());
|
|---|
| 35 | p.add(inputLambertZone, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 0));
|
|---|
| 36 | JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null) {
|
|---|
| 37 | private static final long serialVersionUID = 1L;
|
|---|
| 38 |
|
|---|
| 39 | @Override
|
|---|
| 40 | public void selectInitialValue() {
|
|---|
| 41 | inputLambertZone.setSelectedIndex(0);
|
|---|
| 42 | }
|
|---|
| 43 | };
|
|---|
| 44 | pane.createDialog(Main.parent, tr("Lambert zone")).setVisible(true);
|
|---|
| 45 | if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
|
|---|
| 46 | return;
|
|---|
| 47 | if (inputLambertZone.getSelectedIndex() > 0) {
|
|---|
| 48 | Lambert.layoutZone = inputLambertZone.getSelectedIndex() - 1;
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|