Changeset 16929 in osm for applications/editors/josm/plugins/cadastre-fr/src
- Timestamp:
- 2009-08-09T00:39:02+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r16007 r16929 24 24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 25 25 import org.openstreetmap.josm.plugins.Plugin; 26 import org.openstreetmap.josm.data.projection. Lambert;26 import org.openstreetmap.josm.data.projection.*; 27 27 28 28 /** … … 125 125 126 126 public void refreshMenu() throws Exception { 127 boolean isLambertProjection = Main.proj.toString().equals(new Lambert().toString());128 127 MainMenu menu = Main.main.menu; 129 128 130 129 if (cadastreJMenu == null) { 131 130 cadastreJMenu = menu.addMenu(marktr("Cadastre"), KeyEvent.VK_C, menu.defaultMenuPos); 132 if (isLambertProjection) { 133 JosmAction grab = new MenuActionGrab(); 134 JMenuItem menuGrab = new JMenuItem(grab); 135 KeyStroke ks = grab.getShortcut().getKeyStroke(); 136 if (ks != null) { 137 menuGrab.setAccelerator(ks); 131 JosmAction grab = new MenuActionGrab(); 132 JMenuItem menuGrab = new JMenuItem(grab); 133 KeyStroke ks = grab.getShortcut().getKeyStroke(); 134 if (ks != null) { 135 menuGrab.setAccelerator(ks); 136 } 137 JMenuItem menuSettings = new JMenuItem(new MenuActionNewLocation()); 138 final JCheckBoxMenuItem menuSource = new JCheckBoxMenuItem(tr("Auto sourcing")); 139 menuSource.setSelected(autoSourcing); 140 menuSource.addActionListener(new ActionListener() { 141 public void actionPerformed(ActionEvent ev) { 142 Main.pref.put("cadastrewms.autosourcing", menuSource.isSelected()); 143 autoSourcing = menuSource.isSelected(); 138 144 } 139 JMenuItem menuSettings = new JMenuItem(new MenuActionNewLocation()); 140 final JCheckBoxMenuItem menuSource = new JCheckBoxMenuItem(tr("Auto sourcing")); 141 menuSource.setSelected(autoSourcing); 142 menuSource.addActionListener(new ActionListener() { 143 public void actionPerformed(ActionEvent ev) { 144 Main.pref.put("cadastrewms.autosourcing", menuSource.isSelected()); 145 autoSourcing = menuSource.isSelected(); 146 } 147 }); 148 149 JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie()); 150 JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone()); 151 JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache()); 152 //JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries()); 153 //JMenuItem menuActionBuildings = new JMenuItem(new MenuActionBuildings()); 154 155 cadastreJMenu.add(menuGrab); 156 cadastreJMenu.add(menuSettings); 157 cadastreJMenu.add(menuSource); 158 cadastreJMenu.add(menuResetCookie); 159 cadastreJMenu.add(menuLambertZone); 160 cadastreJMenu.add(menuLoadFromCache); 161 // all SVG features disabled until official WMS is released 162 //cadastreJMenu.add(menuActionBoundaries); 163 //cadastreJMenu.add(menuActionBuildings); 164 } else { 165 JMenuItem hint = new JMenuItem(tr("Invalid projection")); 166 hint.setToolTipText(tr("Change the projection to {0} first.", new Lambert().toString())); 167 hint.addActionListener(new ActionListener() { 168 public void actionPerformed(ActionEvent ev) { 169 JOptionPane.showMessageDialog(Main.parent, 170 tr("To enable the cadastre WMS plugin, change\nthe JOSM projection to Lambert and restart")); 171 } 172 }); 173 cadastreJMenu.add(hint); 174 } 145 }); 146 147 JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie()); 148 JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone()); 149 JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache()); 150 //JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries()); 151 //JMenuItem menuActionBuildings = new JMenuItem(new MenuActionBuildings()); 152 153 cadastreJMenu.add(menuGrab); 154 cadastreJMenu.add(menuSettings); 155 cadastreJMenu.add(menuSource); 156 cadastreJMenu.add(menuResetCookie); 157 cadastreJMenu.add(menuLambertZone); 158 cadastreJMenu.add(menuLoadFromCache); 159 // all SVG features disabled until official WMS is released 160 //cadastreJMenu.add(menuActionBoundaries); 161 //cadastreJMenu.add(menuActionBuildings); 175 162 } 176 163 setEnabledAll(menuEnabled); … … 250 237 } 251 238 } 239 240 public static boolean isCadastreProjection() { 241 return Main.proj.toString().equals(new Lambert().toString()) 242 || Main.proj.toString().equals(new UTM_20N_Guadeloupe_Fort_Marigot().toString()) 243 || Main.proj.toString().equals(new UTM_20N_Guadeloupe_Ste_Anne().toString()) 244 || Main.proj.toString().equals(new UTM_20N_Martinique_Fort_Desaix().toString()) 245 || Main.proj.toString().equals(new GaussLaborde_Reunion().toString()); 246 } 252 247 253 248 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java
r16007 r16929 5 5 import java.awt.event.ActionEvent; 6 6 import java.awt.event.KeyEvent; 7 8 import javax.swing.JOptionPane; 7 9 8 10 import org.openstreetmap.josm.Main; … … 27 29 public void actionPerformed(ActionEvent e) { 28 30 if (Main.map != null) { 29 WMSLayer wmsLayer = WMSDownloadAction.getLayer(); 30 if (wmsLayer != null) 31 DownloadWMSTask.download(wmsLayer); 31 if (CadastrePlugin.isCadastreProjection()) { 32 WMSLayer wmsLayer = WMSDownloadAction.getLayer(); 33 if (wmsLayer != null) 34 DownloadWMSTask.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 } 32 41 } 33 42 }
Note:
See TracChangeset
for help on using the changeset viewer.