Changeset 6992 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-04-22T01:06:55+02:00 (11 years ago)
Author:
Don-vip
Message:

cleanup/refactor of NavigatableComponent

Location:
trunk/src/org/openstreetmap/josm
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r6990 r6992  
    5858import org.openstreetmap.josm.data.ServerSidePreferences;
    5959import org.openstreetmap.josm.data.UndoRedoHandler;
     60import org.openstreetmap.josm.data.ViewportData;
    6061import org.openstreetmap.josm.data.coor.CoordinateFormat;
    6162import org.openstreetmap.josm.data.coor.LatLon;
     
    7273import org.openstreetmap.josm.gui.MapFrameListener;
    7374import org.openstreetmap.josm.gui.MapView;
    74 import org.openstreetmap.josm.gui.NavigatableComponent.ViewportData;
    7575import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    7676import org.openstreetmap.josm.gui.help.HelpUtil;
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r6643 r6992  
    1919
    2020import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.data.ViewportData;
    2122import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    22 import org.openstreetmap.josm.gui.NavigatableComponent.ViewportData;
    2323import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    2424import org.openstreetmap.josm.gui.layer.Layer;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r6792 r6992  
    2525import org.openstreetmap.josm.Main;
    2626import org.openstreetmap.josm.data.Bounds;
     27import org.openstreetmap.josm.data.SystemOfMeasurement;
    2728import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    2829import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
     
    3637import org.openstreetmap.josm.gui.MapView;
    3738import org.openstreetmap.josm.gui.NavigatableComponent;
    38 import org.openstreetmap.josm.gui.NavigatableComponent.SystemOfMeasurement;
    3939import org.openstreetmap.josm.gui.layer.Layer;
    4040import org.openstreetmap.josm.gui.layer.MapViewPaintable;
     
    429429            double snapDistance;
    430430            SystemOfMeasurement som = NavigatableComponent.getSystemOfMeasurement();
    431             if (som.equals(NavigatableComponent.CHINESE_SOM)) {
    432                 snapDistance = snapDistanceChinese * NavigatableComponent.CHINESE_SOM.aValue;
    433             } else if (som.equals(NavigatableComponent.IMPERIAL_SOM)) {
    434                 snapDistance = snapDistanceImperial * NavigatableComponent.IMPERIAL_SOM.aValue;
    435             } else if (som.equals(NavigatableComponent.NAUTICAL_MILE_SOM)) {
    436                 snapDistance = snapDistanceNautical * NavigatableComponent.NAUTICAL_MILE_SOM.aValue;
     431            if (som.equals(SystemOfMeasurement.CHINESE)) {
     432                snapDistance = snapDistanceChinese * SystemOfMeasurement.CHINESE.aValue;
     433            } else if (som.equals(SystemOfMeasurement.IMPERIAL)) {
     434                snapDistance = snapDistanceImperial * SystemOfMeasurement.IMPERIAL.aValue;
     435            } else if (som.equals(SystemOfMeasurement.NAUTICAL_MILE)) {
     436                snapDistance = snapDistanceNautical * SystemOfMeasurement.NAUTICAL_MILE.aValue;
    437437            } else {
    438438                snapDistance = snapDistanceMetric; // Metric system by default
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r6957 r6992  
    4848import org.openstreetmap.josm.gui.MapFrame;
    4949import org.openstreetmap.josm.gui.MapView;
    50 import org.openstreetmap.josm.gui.NavigatableComponent;
    5150import org.openstreetmap.josm.gui.SelectionManager;
    5251import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
     
    248247     */
    249248    private boolean giveUserFeedback(MouseEvent e, int modifiers) {
    250         Collection<OsmPrimitive> c = MapView.asColl(
     249        Collection<OsmPrimitive> c = asColl(
    251250                mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true));
    252251
     
    431430            //  if nothing was selected, select primitive under cursor for scaling or rotating
    432431            if (getCurrentDataSet().getSelected().isEmpty()) {
    433                 getCurrentDataSet().setSelected(MapView.asColl(nearestPrimitive));
     432                getCurrentDataSet().setSelected(asColl(nearestPrimitive));
    434433            }
    435434
     
    446445            }
    447446            OsmPrimitive toSelect = cycleManager.cycleSetup(nearestPrimitive, e.getPoint());
    448             selectPrims(NavigatableComponent.asColl(toSelect), false, false);
     447            selectPrims(asColl(toSelect), false, false);
    449448            useLastMoveCommandIfPossible();
    450449            // Schedule a timer to update status line "initialMoveDelay+1" ms in the future
     
    522521                needsRepaint = true;
    523522            }
    524             mv.setNewCursor(getCursor(MapView.asColl(p)), this);
     523            mv.setNewCursor(getCursor(asColl(p)), this);
    525524            // also update the stored mouse event, so we can display the correct cursor
    526525            // when dragging a node onto another one and then press CTRL to merge
     
    953952                if (!(alt || multipleMatchesParameter)) {
    954953                    // no real cycling, just one element in cycle list
    955                     cycleList = MapView.asColl(osm);
     954                    cycleList = asColl(osm);
    956955
    957956                    if (waitForMouseUpParameter) {
     
    10601059            }
    10611060            // return one-element collection with one element to be selected (or added  to selection)
    1062             return MapView.asColl(nxt);
     1061            return asColl(nxt);
    10631062        }
    10641063    }
     
    11621161        }
    11631162    }
     1163
     1164    /**
     1165     * @return o as collection of o's type.
     1166     */
     1167    protected static <T> Collection<T> asColl(T o) {
     1168        if (o == null)
     1169            return Collections.emptySet();
     1170        return Collections.singleton(o);
     1171    }
    11641172}
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r6643 r6992  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.imagery;
    3 
    43
    54import java.awt.Graphics2D;
     
    3534import org.openstreetmap.josm.Main;
    3635import org.openstreetmap.josm.data.ProjectionBounds;
     36import org.openstreetmap.josm.data.SystemOfMeasurement;
    3737import org.openstreetmap.josm.data.coor.EastNorth;
    3838import org.openstreetmap.josm.data.coor.LatLon;
     
    4242import org.openstreetmap.josm.data.preferences.StringProperty;
    4343import org.openstreetmap.josm.data.projection.Projection;
    44 import org.openstreetmap.josm.gui.NavigatableComponent;
    4544import org.openstreetmap.josm.tools.Utils;
    46 
    47 
    4845
    4946public class WmsCache {
     
    454451        int precisionLon = Math.max(0, -(int)Math.ceil(Math.log10(deltaLon)) + 1);
    455452
    456         String zoom = NavigatableComponent.METRIC_SOM.getDistText(ll1.greatCircleDistance(ll2));
     453        String zoom = SystemOfMeasurement.METRIC.getDistText(ll1.greatCircleDistance(ll2));
    457454        String extension;
    458455        if ("image/jpeg".equals(mimeType) || "image/jpg".equals(mimeType)) {
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r6454 r6992  
    5353import org.openstreetmap.josm.actions.mapmode.ZoomAction;
    5454import org.openstreetmap.josm.data.Preferences;
     55import org.openstreetmap.josm.data.ViewportData;
    5556import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    5657import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    5758import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    58 import org.openstreetmap.josm.gui.NavigatableComponent.ViewportData;
    5959import org.openstreetmap.josm.gui.dialogs.ChangesetDialog;
    6060import org.openstreetmap.josm.gui.dialogs.CommandStackDialog;
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r6977 r6992  
    5050
    5151import org.openstreetmap.josm.Main;
     52import org.openstreetmap.josm.data.SystemOfMeasurement;
    5253import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    5354import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
     
    732733
    733734        public MapStatusPopupMenu() {
    734             for (final String key : new TreeSet<String>(NavigatableComponent.SYSTEMS_OF_MEASUREMENT.keySet())) {
     735            for (final String key : new TreeSet<String>(SystemOfMeasurement.ALL_SYSTEMS.keySet())) {
    735736                JCheckBoxMenuItem item = new JCheckBoxMenuItem(new AbstractAction(key) {
    736737                    @Override
     
    829830        if (Main.pref.getBoolean("statusbar.change-system-of-measurement-on-click", true)) {
    830831            distText.addMouseListener(new MouseAdapter() {
    831                 private final List<String> soms = new ArrayList<String>(new TreeSet<String>(NavigatableComponent.SYSTEMS_OF_MEASUREMENT.keySet()));
     832                private final List<String> soms = new ArrayList<String>(new TreeSet<String>(SystemOfMeasurement.ALL_SYSTEMS.keySet()));
    832833   
    833834                @Override
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r6883 r6992  
    4040import org.openstreetmap.josm.actions.mapmode.MapMode;
    4141import org.openstreetmap.josm.data.Bounds;
     42import org.openstreetmap.josm.data.ViewportData;
    4243import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    4344import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r6873 r6992  
    11// License: GPL. See LICENSE file for details.
    22package org.openstreetmap.josm.gui;
    3 
    4 import static org.openstreetmap.josm.tools.I18n.marktr;
    53
    64import java.awt.Cursor;
     
    119import java.awt.geom.AffineTransform;
    1210import java.awt.geom.Point2D;
    13 import java.text.NumberFormat;
    1411import java.util.ArrayList;
    1512import java.util.Collection;
     
    1714import java.util.Date;
    1815import java.util.HashSet;
    19 import java.util.LinkedHashMap;
    2016import java.util.LinkedList;
    2117import java.util.List;
    22 import java.util.Locale;
    2318import java.util.Map;
    2419import java.util.Map.Entry;
     
    3328import org.openstreetmap.josm.data.Bounds;
    3429import org.openstreetmap.josm.data.ProjectionBounds;
     30import org.openstreetmap.josm.data.SystemOfMeasurement;
    3531import org.openstreetmap.josm.data.coor.CachedLatLon;
    3632import org.openstreetmap.josm.data.coor.EastNorth;
     
    5450
    5551/**
    56  * An component that can be navigated by a mapmover. Used as map view and for the
     52 * A component that can be navigated by a {@link MapMover}. Used as map view and for the
    5753 * zoomer in the download dialog.
    5854 *
    5955 * @author imi
     56 * @since 41
    6057 */
    6158public class NavigatableComponent extends JComponent implements Helpful {
     
    6562     */
    6663    public interface ZoomChangeListener {
     64        /**
     65         * Method called when the zoom area has changed.
     66         */
    6767        void zoomChanged();
    6868    }
     
    8181    }
    8282
    83     /**
    84      * Simple data class that keeps map center and scale in one object.
    85      */
    86     public static class ViewportData {
    87         private EastNorth center;
    88         private Double scale;
    89 
    90         public ViewportData(EastNorth center, Double scale) {
    91             this.center = center;
    92             this.scale = scale;
    93         }
    94 
    95         /**
    96          * Return the projected coordinates of the map center
    97          * @return the center
    98          */
    99         public EastNorth getCenter() {
    100             return center;
    101         }
    102 
    103         /**
    104          * Return the scale factor in east-/north-units per pixel.
    105          * @return the scale
    106          */
    107         public Double getScale() {
    108             return scale;
    109         }
    110     }
    111 
    11283    public static final IntegerProperty PROP_SNAP_DISTANCE = new IntegerProperty("mappaint.node.snap-distance", 10);
    11384
     
    146117    }
    147118
    148     /**
    149      * the SoM listeners
    150      */
    151119    private static final CopyOnWriteArrayList<SoMChangeListener> somChangeListeners = new CopyOnWriteArrayList<SoMChangeListener>();
    152120
     
    185153     */
    186154    private double scale = Main.getProjection().getDefaultZoomInPPD();
     155
    187156    /**
    188157     * Center n/e coordinate of the desired screen center.
     
    233202    }
    234203
    235     public String getDist100PixelText()
    236     {
     204    public String getDist100PixelText() {
    237205        return getDistText(getDist100Pixel());
    238206    }
    239207
    240     public double getDist100Pixel()
    241     {
     208    public double getDist100Pixel() {
    242209        int w = getWidth()/2;
    243210        int h = getHeight()/2;
     
    263230     * @param y Y-Pixelposition to get coordinate from
    264231     *
    265      * @return Geographic coordinates from a specific pixel coordination
    266      *      on the screen.
     232     * @return Geographic coordinates from a specific pixel coordination on the screen.
    267233     */
    268234    public EastNorth getEastNorth(int x, int y) {
     
    549515
    550516    private class ZoomData {
    551         LatLon center;
    552         double scale;
     517        final LatLon center;
     518        final double scale;
    553519
    554520        public ZoomData(EastNorth center, double scale) {
     
    731697     *        give the nearest node that is tagged.
    732698     */
    733     public final Node getNearestNode(Point p, Predicate<OsmPrimitive> predicate, boolean use_selected) {
    734         return getNearestNode(p, predicate, use_selected, null);
     699    public final Node getNearestNode(Point p, Predicate<OsmPrimitive> predicate, boolean useSelected) {
     700        return getNearestNode(p, predicate, useSelected, null);
    735701    }
    736702
     
    811777    /**
    812778     * Convenience method to {@link #getNearestNode(Point, Predicate, boolean)}.
     779     * @param p the screen point
     780     * @param predicate this parameter imposes a condition on the returned object, e.g.
     781     *        give the nearest node that is tagged.
    813782     *
    814783     * @return The nearest node to point p.
     
    940909     * @param p the point for which to search the nearest segment.
    941910     * @param predicate the returned object has to fulfill certain properties.
    942      * @param use_selected whether selected way segments should be preferred.
    943      */
    944     public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate, boolean use_selected) {
     911     * @param useSelected whether selected way segments should be preferred.
     912     */
     913    public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate, boolean useSelected) {
    945914        WaySegment wayseg = null, ntsel = null;
    946915
     
    959928        }
    960929
    961         return (ntsel != null && use_selected) ? ntsel : wayseg;
     930        return (ntsel != null && useSelected) ? ntsel : wayseg;
    962931    }
    963932
     
    1017986    /**
    1018987     * Convenience method to {@link #getNearestWaySegment(Point, Predicate, boolean)}.
     988     * @param p the point for which to search the nearest segment.
     989     * @param predicate the returned object has to fulfill certain properties.
    1019990     *
    1020991     * @return The nearest way segment to point p.
     
    11771148     *      that is chosen by the algorithm described.
    11781149     * @see #getNearestNode(Point, Predicate)
    1179      * @see #getNearestNodesImpl(Point, Predicate)
    11801150     * @see #getNearestWay(Point, Predicate)
    11811151     *
     
    12231193    }
    12241194
    1225     /**
    1226      * @return o as collection of o's type.
    1227      */
    1228     public static <T> Collection<T> asColl(T o) {
    1229         if (o == null)
    1230             return Collections.emptySet();
    1231         return Collections.singleton(o);
    1232     }
    1233 
    12341195    public static double perDist(Point2D pt, Point2D a, Point2D b) {
    12351196        if (pt != null && a != null && b != null) {
     
    13601321    /**
    13611322     * Return a ID which is unique as long as viewport dimensions are the same
     1323     * @return A unique ID, as long as viewport dimensions are the same
    13621324     */
    13631325    public int getViewID() {
     
    13751337     */
    13761338    public static SystemOfMeasurement getSystemOfMeasurement() {
    1377         SystemOfMeasurement som = SYSTEMS_OF_MEASUREMENT.get(ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get());
     1339        SystemOfMeasurement som = SystemOfMeasurement.ALL_SYSTEMS.get(ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get());
    13781340        if (som == null)
    1379             return METRIC_SOM;
     1341            return SystemOfMeasurement.METRIC;
    13801342        return som;
    13811343    }
     
    13831345    /**
    13841346     * Sets the current system of measurement.
    1385      * @param somKey The system of measurement key. Must be defined in {@link NavigatableComponent#SYSTEMS_OF_MEASUREMENT}.
     1347     * @param somKey The system of measurement key. Must be defined in {@link SystemOfMeasurement#ALL_SYSTEMS}.
    13861348     * @since 6056
    13871349     * @throws IllegalArgumentException if {@code somKey} is not known
    13881350     */
    13891351    public static void setSystemOfMeasurement(String somKey) {
    1390         if (!SYSTEMS_OF_MEASUREMENT.containsKey(somKey)) {
     1352        if (!SystemOfMeasurement.ALL_SYSTEMS.containsKey(somKey)) {
    13911353            throw new IllegalArgumentException("Invalid system of measurement: "+somKey);
    13921354        }
     
    13971359    }
    13981360
    1399     /**
    1400      * A system of units used to express length and area measurements.
    1401      * @since 3406
    1402      */
    1403     public static class SystemOfMeasurement {
    1404 
    1405         /** First value, in meters, used to translate unit according to above formula. */
    1406         public final double aValue;
    1407         /** Second value, in meters, used to translate unit according to above formula. */
    1408         public final double bValue;
    1409         /** First unit used to format text. */
    1410         public final String aName;
    1411         /** Second unit used to format text. */
    1412         public final String bName;
    1413         /** Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}. Set to {@code -1} if not used.
    1414          *  @since 5870 */
    1415         public final double areaCustomValue;
    1416         /** Specific optional area unit. Set to {@code null} if not used.
    1417          *  @since 5870 */
    1418         public final String areaCustomName;
    1419 
    1420         /**
    1421          * System of measurement. Currently covers only length (and area) units.
    1422          *
    1423          * If a quantity x is given in m (x_m) and in unit a (x_a) then it translates as
    1424          * x_a == x_m / aValue
    1425          *
    1426          * @param aValue First value, in meters, used to translate unit according to above formula.
    1427          * @param aName First unit used to format text.
    1428          * @param bValue Second value, in meters, used to translate unit according to above formula.
    1429          * @param bName Second unit used to format text.
    1430          */
    1431         public SystemOfMeasurement(double aValue, String aName, double bValue, String bName) {
    1432             this(aValue, aName, bValue, bName, -1, null);
    1433         }
    1434 
    1435         /**
    1436          * System of measurement. Currently covers only length (and area) units.
    1437          *
    1438          * If a quantity x is given in m (x_m) and in unit a (x_a) then it translates as
    1439          * x_a == x_m / aValue
    1440          *
    1441          * @param aValue First value, in meters, used to translate unit according to above formula.
    1442          * @param aName First unit used to format text.
    1443          * @param bValue Second value, in meters, used to translate unit according to above formula.
    1444          * @param bName Second unit used to format text.
    1445          * @param areaCustomValue Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}.
    1446          *                        Set to {@code -1} if not used.
    1447          * @param areaCustomName Specific optional area unit. Set to {@code null} if not used.
    1448          *
    1449          * @since 5870
    1450          */
    1451         public SystemOfMeasurement(double aValue, String aName, double bValue, String bName, double areaCustomValue, String areaCustomName) {
    1452             this.aValue = aValue;
    1453             this.aName = aName;
    1454             this.bValue = bValue;
    1455             this.bName = bName;
    1456             this.areaCustomValue = areaCustomValue;
    1457             this.areaCustomName = areaCustomName;
    1458         }
    1459 
    1460         /**
    1461          * Returns the text describing the given distance in this system of measurement.
    1462          * @param dist The distance in metres
    1463          * @return The text describing the given distance in this system of measurement.
    1464          */
    1465         public String getDistText(double dist) {
    1466             return getDistText(dist, null, 0.01);
    1467         }
    1468 
    1469         /**
    1470          * Returns the text describing the given distance in this system of measurement.
    1471          * @param dist The distance in metres
    1472          * @param format A {@link NumberFormat} to format the area value
    1473          * @param threshold Values lower than this {@code threshold} are displayed as {@code "< [threshold]"}
    1474          * @return The text describing the given distance in this system of measurement.
    1475          * @since 6422
    1476          */
    1477         public String getDistText(final double dist, final NumberFormat format, final double threshold) {
    1478             double a = dist / aValue;
    1479             if (!Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false) && a > bValue / aValue)
    1480                 return formatText(dist / bValue, bName, format);
    1481             else if (a < threshold)
    1482                 return "< " + formatText(threshold, aName, format);
    1483             else
    1484                 return formatText(a, aName, format);
    1485         }
    1486 
    1487         /**
    1488          * Returns the text describing the given area in this system of measurement.
    1489          * @param area The area in square metres
    1490          * @return The text describing the given area in this system of measurement.
    1491          * @since 5560
    1492          */
    1493         public String getAreaText(double area) {
    1494             return getAreaText(area, null, 0.01);
    1495         }
    1496 
    1497         /**
    1498          * Returns the text describing the given area in this system of measurement.
    1499          * @param area The area in square metres
    1500          * @param format A {@link NumberFormat} to format the area value
    1501          * @param threshold Values lower than this {@code threshold} are displayed as {@code "< [threshold]"}
    1502          * @return The text describing the given area in this system of measurement.
    1503          * @since 6422
    1504          */
    1505         public String getAreaText(final double area, final NumberFormat format, final double threshold) {
    1506             double a = area / (aValue*aValue);
    1507             boolean lowerOnly = Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false);
    1508             boolean customAreaOnly = Main.pref.getBoolean("system_of_measurement.use_only_custom_area_unit", false);
    1509             if ((!lowerOnly && areaCustomValue > 0 && a > areaCustomValue / (aValue*aValue) && a < (bValue*bValue) / (aValue*aValue)) || customAreaOnly)
    1510                 return formatText(area / areaCustomValue, areaCustomName, format);
    1511             else if (!lowerOnly && a >= (bValue*bValue) / (aValue*aValue))
    1512                 return formatText(area / (bValue * bValue), bName + "\u00b2", format);
    1513             else if (a < threshold)
    1514                 return "< " + formatText(threshold, aName + "\u00b2", format);
    1515             else
    1516                 return formatText(a, aName + "\u00b2", format);
    1517         }
    1518 
    1519         private static String formatText(double v, String unit, NumberFormat format) {
    1520             if (format != null) {
    1521                 return format.format(v) + " " + unit;
    1522             }
    1523             return String.format(Locale.US, "%." + (v<9.999999 ? 2 : 1) + "f %s", v, unit);
    1524         }
    1525     }
    1526 
    1527     /**
    1528      * Metric system (international standard).
    1529      * @since 3406
    1530      */
    1531     public static final SystemOfMeasurement METRIC_SOM = new SystemOfMeasurement(1, "m", 1000, "km", 10000, "ha");
    1532 
    1533     /**
    1534      * Chinese system.
    1535      * @since 3406
    1536      */
    1537     public static final SystemOfMeasurement CHINESE_SOM = new SystemOfMeasurement(1.0/3.0, "\u5e02\u5c3a" /* chi */, 500, "\u5e02\u91cc" /* li */);
    1538 
    1539     /**
    1540      * Imperial system (British Commonwealth and former British Empire).
    1541      * @since 3406
    1542      */
    1543     public static final SystemOfMeasurement IMPERIAL_SOM = new SystemOfMeasurement(0.3048, "ft", 1609.344, "mi", 4046.86, "ac");
    1544 
    1545     /**
    1546      * Nautical mile system (navigation, polar exploration).
    1547      * @since 5549
    1548      */
    1549     public static final SystemOfMeasurement NAUTICAL_MILE_SOM = new SystemOfMeasurement(185.2, "kbl", 1852, "NM");
    1550 
    1551     /**
    1552      * Known systems of measurement.
    1553      * @since 3406
    1554      */
    1555     public static final Map<String, SystemOfMeasurement> SYSTEMS_OF_MEASUREMENT;
    1556     static {
    1557         SYSTEMS_OF_MEASUREMENT = new LinkedHashMap<String, SystemOfMeasurement>();
    1558         SYSTEMS_OF_MEASUREMENT.put(marktr("Metric"), METRIC_SOM);
    1559         SYSTEMS_OF_MEASUREMENT.put(marktr("Chinese"), CHINESE_SOM);
    1560         SYSTEMS_OF_MEASUREMENT.put(marktr("Imperial"), IMPERIAL_SOM);
    1561         SYSTEMS_OF_MEASUREMENT.put(marktr("Nautical Mile"), NAUTICAL_MILE_SOM);
    1562     }
    1563 
    15641361    private static class CursorInfo {
    1565         public Cursor cursor;
    1566         public Object object;
     1362        final Cursor cursor;
     1363        final Object object;
    15671364        public CursorInfo(Cursor c, Object o) {
    15681365            cursor = c;
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r6920 r6992  
    2424import org.openstreetmap.josm.Main;
    2525import org.openstreetmap.josm.data.Bounds;
     26import org.openstreetmap.josm.data.SystemOfMeasurement;
    2627import org.openstreetmap.josm.data.coor.CoordinateFormat;
    2728import org.openstreetmap.josm.data.preferences.CollectionProperty;
     
    246247    private static final CollectionProperty PROP_SUB_PROJECTION = new CollectionProperty("projection.sub", null);
    247248    public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT = new StringProperty("system_of_measurement", "Metric");
    248     private static final String[] unitsValues = (new ArrayList<String>(NavigatableComponent.SYSTEMS_OF_MEASUREMENT.keySet())).toArray(new String[0]);
     249    private static final String[] unitsValues = (new ArrayList<String>(SystemOfMeasurement.ALL_SYSTEMS.keySet())).toArray(new String[0]);
    249250    private static final String[] unitsValuesTr = new String[unitsValues.length];
    250251    static {
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r6792 r6992  
    3333
    3434import org.openstreetmap.josm.Main;
     35import org.openstreetmap.josm.data.ViewportData;
    3536import org.openstreetmap.josm.data.coor.EastNorth;
    3637import org.openstreetmap.josm.data.coor.LatLon;
     
    3839import org.openstreetmap.josm.data.projection.Projections;
    3940import org.openstreetmap.josm.gui.ExtendedDialog;
    40 import org.openstreetmap.josm.gui.NavigatableComponent.ViewportData;
    4141import org.openstreetmap.josm.gui.layer.Layer;
    4242import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
Note: See TracChangeset for help on using the changeset viewer.