Changeset 16894 in josm for trunk/src/org/openstreetmap/josm/gui/bbox
- Timestamp:
- 2020-08-15T00:15:18+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r16893 r16894 35 35 import org.openstreetmap.josm.data.preferences.StringProperty; 36 36 import org.openstreetmap.josm.gui.MainApplication; 37 import org.openstreetmap.josm.gui.MapScaler; 38 import org.openstreetmap.josm.gui.NavigatableComponent; 37 39 import org.openstreetmap.josm.gui.layer.ImageryLayer; 38 40 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; … … 119 121 add(iSizeButton); 120 122 123 MapScaler scaler = new MapScaler(this::getDist100Pixel, () -> Color.BLACK); 124 add(scaler); 125 springLayout.putConstraint(SpringLayout.SOUTH, scaler, 5, SpringLayout.SOUTH, this); 126 121 127 String mapStyle = PROP_MAPSTYLE.get(); 122 128 boolean foundSource = false; … … 149 155 LinkedHashMap::new 150 156 )); 157 } 158 159 /** 160 * Get the distance in meter that correspond to 100 px on screen. 161 * @return the distance in meter that correspond to 100 px on screen 162 * @see NavigatableComponent#getDist100Pixel 163 */ 164 private double getDist100Pixel() { 165 int w = getWidth() / 2; 166 int h = getHeight() / 2; 167 ICoordinate c1 = getPosition(w - 50, h); 168 ICoordinate c2 = getPosition(w + 50, h); 169 final LatLon ll1 = new LatLon(c1.getLat(), c1.getLon()); 170 final LatLon ll2 = new LatLon(c2.getLat(), c2.getLon()); 171 double gcd = ll1.greatCircleDistance(ll2); 172 return gcd <= 0 ? 0.1 : gcd; 151 173 } 152 174
Note:
See TracChangeset
for help on using the changeset viewer.