Changeset 5982 in josm
- Timestamp:
- 2013-06-01T22:35:06+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r5960 r5982 24 24 import org.openstreetmap.josm.Main; 25 25 import org.openstreetmap.josm.data.Bounds; 26 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 27 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 26 28 import org.openstreetmap.josm.data.coor.EastNorth; 27 29 import org.openstreetmap.josm.data.osm.Node; … … 79 81 * @author Ole Jørgen Brønner (olejorgenb) 80 82 */ 81 public class ParallelWayAction extends MapMode implements AWTEventListener, MapViewPaintable { 82 83 private static final long serialVersionUID = 1L; 83 public class ParallelWayAction extends MapMode implements AWTEventListener, MapViewPaintable, PreferenceChangedListener { 84 84 85 85 private enum Mode { … … 100 100 private double snapDistanceImperial; 101 101 private double snapDistanceChinese; 102 private double snapDistanceNautical; 102 103 103 104 private ModifiersSpec snapModifierCombo; … … 119 120 private WaySegment referenceSegment; 120 121 private ParallelWays pWays; 121 LinkedHashSet<Way> sourceWays;122 private LinkedHashSet<Way> sourceWays; 122 123 private EastNorth helperLineStart; 123 124 private EastNorth helperLineEnd; … … 131 132 mv = mapFrame.mapView; 132 133 updateModeLocalPreferences(); 134 Main.pref.addPreferenceChangeListener(this); 133 135 } 134 136 … … 199 201 private void updateModeLocalPreferences() { 200 202 // @formatter:off 201 //snapThreshold = Main.pref.getDouble (prefKey("snap-threshold"), 0.35); // Old preference was stored in meters, hence the new name (percent)202 203 snapThreshold = Main.pref.getDouble (prefKey("snap-threshold-percent"), 0.70); 203 204 snapDefault = Main.pref.getBoolean(prefKey("snap-default"), true); … … 207 208 snapDistanceImperial = Main.pref.getDouble(prefKey("snap-distance-imperial"), 1); 208 209 snapDistanceChinese = Main.pref.getDouble(prefKey("snap-distance-chinese"), 1); 210 snapDistanceNautical = Main.pref.getDouble(prefKey("snap-distance-nautical"), 0.1); 209 211 210 212 snapModifierCombo = new ModifiersSpec(getStringPref("snap-modifier-combo", "?sC")); … … 400 402 } 401 403 402 // //Calculate distance to the reference line404 // Calculate distance to the reference line 403 405 EastNorth enp = mv.getEastNorth((int) p.getX(), (int) p.getY()); 404 406 EastNorth nearestPointOnRefLine = Geometry.closestPointToLine(referenceSegment.getFirstNode().getEastNorth(), … … 423 425 } else if (som.equals(NavigatableComponent.IMPERIAL_SOM)) { 424 426 snapDistance = snapDistanceImperial * NavigatableComponent.IMPERIAL_SOM.aValue; 427 } else if (som.equals(NavigatableComponent.NAUTICAL_MILE_SOM)) { 428 snapDistance = snapDistanceNautical * NavigatableComponent.NAUTICAL_MILE_SOM.aValue; 425 429 } else { 426 430 snapDistance = snapDistanceMetric; // Metric system by default … … 577 581 return getStringPref(subKey, null); 578 582 } 583 584 @Override 585 public void preferenceChanged(PreferenceChangeEvent e) { 586 if (e.getKey().startsWith(prefKey(""))) { 587 updateAllPreferences(); 588 } 589 } 579 590 }
Note:
See TracChangeset
for help on using the changeset viewer.