Changeset 17215 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
- Timestamp:
- 2009-08-23T21:23:13+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
r17181 r17215 4 4 5 5 import java.awt.GridBagLayout; 6 import java.awt.Point;7 6 import java.awt.event.ActionEvent; 8 7 import java.awt.event.MouseEvent; … … 37 36 private int cGetLambertCrosspieces = 2; 38 37 private EastNorth ea1; 39 private Point mousePrevious = new Point();38 private long mouseClickedTime = 0; 40 39 private EastNorth georefpoint1; 41 40 private EastNorth georefpoint2; 41 /** 42 * The time which needs to pass between two clicks during georeferencing, in milliseconds 43 */ 44 private int initialClickDelay; 42 45 43 46 public MenuActionGrabPlanImage() { … … 48 51 countMouseClicked = 0; 49 52 mode = 0; 50 mouse Previous.setLocation(0, 0);53 mouseClickedTime = System.currentTimeMillis(); 51 54 } 52 55 … … 75 78 downloadWMSPlanImage = new DownloadWMSPlanImage(); 76 79 downloadWMSPlanImage.download(wmsLayer); 80 initialClickDelay = Main.pref.getInteger("cadastrewms.georef-click-delay",200); 77 81 // download sub-images of the cadastre scan and join them into one single 78 82 Main.worker.execute(this); … … 90 94 boolean loadedFromCache = downloadWMSPlanImage.waitFinished(); 91 95 if (wmsLayer.images.size() == 1 && !loadedFromCache) { 96 mouseClickedTime = System.currentTimeMillis(); 92 97 Main.map.mapView.addMouseListener(this); 93 98 if (Main.pref.getBoolean("cadastrewms.noImageCropping", false) == false) … … 95 100 else 96 101 startGeoreferencing(); 97 102 } else // action cancelled or image loaded from cache (and already georeferenced) 98 103 Main.map.repaint(); 99 104 } 100 105 101 106 public void mouseClicked(MouseEvent e) { 102 if (e.getX() == mousePrevious.getX() && e.getY() == mousePrevious.getY()) 103 return; // double click filtered 107 if (System.currentTimeMillis() - mouseClickedTime < initialClickDelay) { 108 System.out.println("mouse click bounce detected"); 109 return; // mouse click anti-bounce 110 } 104 111 else 105 mouse Previous.setLocation(e.getX(), e.getY());112 mouseClickedTime = System.currentTimeMillis(); 106 113 countMouseClicked++; 107 114 EastNorth ea = Main.proj.latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY())); 108 System.out.println("clic:"+countMouseClicked+" ,"+ea); 115 System.out.println("clic:"+countMouseClicked+" ,"+ea+", mode:"+mode); 109 116 // ignore clicks outside the image 110 117 if (ea.east() < wmsLayer.images.get(0).min.east() || ea.east() > wmsLayer.images.get(0).max.east() … … 153 160 null, options, options[0]); 154 161 if (ret == JOptionPane.OK_OPTION) { 155 mouse Previous.setLocation(0, 0);162 mouseClickedTime = System.currentTimeMillis(); 156 163 } else 157 164 if (canceledOrRestartCurrAction("image cropping")) … … 192 199 null, options, options[0]); 193 200 if (ret == JOptionPane.OK_OPTION) { 194 mouse Previous.setLocation(0, 0);201 mouseClickedTime = System.currentTimeMillis(); 195 202 } else 196 203 if (canceledOrRestartCurrAction("georeferencing")) … … 257 264 if (countMouseClicked == 1) number = "first"; 258 265 else number = "second"; 259 pane.createDialog(Main.parent, tr("Set "+number+" Lambert coordinate")).setVisible(true); 266 pane.createDialog(Main.parent, tr("Set "+number+" Lambert coordinates")).setVisible(true); 260 267 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) { 261 268 if (canceledOrRestartCurrAction("georeferencing"))
Note:
See TracChangeset
for help on using the changeset viewer.