Changeset 20214 in osm for applications/editors
- Timestamp:
- 2010-02-28T17:49:37+01:00 (14 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
r19928 r20214 91 91 * 1.7 12-Dec-2009 - Change URL's changes for cookie and downgrade imgs resolution due to WMS changes 92 92 * 1.8 xxx - filter the mouse button 1 during georeferencing 93 * - possibility to modify the auto-sourcing text just before upload94 93 * - retry if getting a new cookie failed (10 times during 30 seconds) 95 94 * - cookie expiration automatically detected and renewed (after 30 minutes) 96 95 * - proper WMS layer cleanup at destruction (workaround for memory leak) 97 96 * - new cache format (v3) storing original image and cropped image bbox + angle 98 * - cache management compatible with previous v2 format 99 * - raster image rotation using shift+ctrl key instead of ctrl 97 * - new cache format (v4) storing original image size for later rotation 98 * - cache files read compatible with previous formats 99 * - raster image rotation issues fixed, now using shift+ctrl key instead of ctrl 100 100 * - raster image adjustment using default system menu modifier (ctrl for windows) for Mac support 101 * - from Clément Ménier, new option allowing an auto-selection of the first cadastre layer for grab 101 * - from Erik Amzallag: 102 * - possibility to modify the auto-sourcing text just before upload 103 * - from Clément Ménier: 104 * - new option allowing an auto-selection of the first cadastre layer for grab 105 * - non-modal JDialog in MenuActionGrabPlanImage 102 106 */ 103 107 public class CadastrePlugin extends Plugin { … … 184 188 cadastreJMenu.add(menuSettings); 185 189 cadastreJMenu.add(menuSource); 186 cadastreJMenu.add(menuResetCookie);190 //cadastreJMenu.add(menuResetCookie); not required any more 187 191 //cadastreJMenu.add(menuLambertZone); 188 192 cadastreJMenu.add(menuLoadFromCache); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
r19267 r20214 8 8 import java.awt.event.MouseEvent; 9 9 import java.awt.event.MouseListener; 10 import java.beans.PropertyChangeEvent; 11 import java.beans.PropertyChangeListener; 10 12 import java.util.ArrayList; 11 13 14 import javax.swing.JDialog; 12 15 import javax.swing.JLabel; 13 16 import javax.swing.JOptionPane; … … 37 40 private int cGetLambertCrosspieces = 2; 38 41 private EastNorth ea1; 42 private EastNorth ea2; 39 43 private long mouseClickedTime = 0; 40 44 private EastNorth georefpoint1; 41 45 private EastNorth georefpoint2; 46 private boolean ignoreMouseClick = false; 47 42 48 /** 43 49 * The time which needs to pass between two clicks during georeferencing, in milliseconds … … 126 132 if (e.getButton() != MouseEvent.BUTTON1) 127 133 return; 134 if (ignoreMouseClick) return; // In case we are currently just allowing zooming to read lambert coordinates 128 135 countMouseClicked++; 129 136 EastNorth ea = Main.proj.latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY())); … … 146 153 if (countMouseClicked == 1) { 147 154 ea1 = ea; 148 if (inputLambertPosition()) 149 continueGeoreferencing(); 155 inputLambertPosition(); // This will automatically asks for second point and continue the georeferencing 150 156 } 151 157 if (countMouseClicked == 2) { 152 if (inputLambertPosition()) { 153 Main.map.mapView.removeMouseListener(this); 154 affineTransform(ea1, ea, georefpoint1, georefpoint2); 155 wmsLayer.saveNewCache(); 156 Main.map.mapView.repaint(); 157 actionCompleted(); 158 } 158 ea2 = ea; 159 inputLambertPosition(); // This will automatically ends the georeferencing 159 160 } 160 161 } … … 237 238 } 238 239 return true; 240 } 241 242 /** 243 * Ends the georeferencing by computing the affine transformation 244 */ 245 private void endGeoreferencing() { 246 Main.map.mapView.removeMouseListener(this); 247 affineTransform(ea1, ea2, georefpoint1, georefpoint2); 248 wmsLayer.saveNewCache(); 249 Main.map.mapView.repaint(); 250 actionCompleted(); 239 251 } 240 252 … … 261 273 } 262 274 263 private boolean inputLambertPosition() { 264 JLabel labelEnterPosition = new JLabel(tr("Enter cadastre east,north position")); 265 JLabel labelWarning = new JLabel(tr("(Warning: verify north with arrow !!)")); 275 private void inputLambertPosition() { 276 JLabel labelEnterPosition = new JLabel( 277 tr("Enter cadastre east,north position")); 278 JLabel labelWarning = new JLabel( 279 tr("(Warning: verify north with arrow !!)")); 266 280 JPanel p = new JPanel(new GridBagLayout()); 267 281 JLabel labelEast = new JLabel(tr("East")); … … 275 289 p.add(labelNorth, GBC.std().insets(0, 0, 10, 0)); 276 290 p.add(inputNorth, GBC.eol().fill(GBC.HORIZONTAL).insets(10, 5, 0, 5)); 277 JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null); 291 final JOptionPane pane = new JOptionPane(p, 292 JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, 293 null); 278 294 String number; 279 if (countMouseClicked == 1) number = "first"; 280 else number = "second"; 281 pane.createDialog(Main.parent, tr("Set {0} Lambert coordinates",number)).setVisible(true); 282 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) { 283 if (canceledOrRestartCurrAction("georeferencing")) 284 startGeoreferencing(); 285 return false; 286 } 287 if (inputEast.getText().length() != 0 && inputNorth.getText().length() != 0) { 288 try { 289 double e = Double.parseDouble(inputEast.getText()); 290 double n = Double.parseDouble(inputNorth.getText()); 291 if (countMouseClicked == 1) 292 georefpoint1 = new EastNorth(e, n); 293 else 294 georefpoint2 = new EastNorth(e, n); 295 return true; 296 } catch (NumberFormatException e) { 297 return false; 298 } 299 } 300 return false; 295 if (countMouseClicked == 1) 296 number = "first"; 297 else 298 number = "second"; 299 JDialog dialog = pane.createDialog(Main.parent, tr( 300 "Set {0} Lambert coordinates", number)); 301 dialog.setModal(false); 302 ignoreMouseClick = true; // To avoid mouseClicked from being called 303 // during coordinates reading 304 dialog.setAlwaysOnTop(true); 305 dialog.setVisible(true); 306 pane.addPropertyChangeListener(new PropertyChangeListener() { 307 public void propertyChange(PropertyChangeEvent evt) { 308 if (JOptionPane.VALUE_PROPERTY.equals(evt.getPropertyName())) { 309 ignoreMouseClick = false; 310 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals( 311 pane.getValue())) { 312 if (canceledOrRestartCurrAction("georeferencing")) 313 startGeoreferencing(); 314 } 315 if (inputEast.getText().length() != 0 316 && inputNorth.getText().length() != 0) { 317 try { 318 double e = Double.parseDouble(inputEast.getText()); 319 double n = Double.parseDouble(inputNorth.getText()); 320 if (countMouseClicked == 1) { 321 georefpoint1 = new EastNorth(e, n); 322 continueGeoreferencing(); 323 } else { 324 georefpoint2 = new EastNorth(e, n); 325 endGeoreferencing(); 326 } 327 } catch (NumberFormatException e) { 328 return; 329 } 330 } 331 } 332 } 333 }); 301 334 } 302 335
Note:
See TracChangeset
for help on using the changeset viewer.