Changeset 13182 in josm for trunk/src/org


Ignore:
Timestamp:
2017-12-02T18:51:17+01:00 (7 years ago)
Author:
Don-vip
Message:

see #15310 - cacheDir is unused, deprecate new methods

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r13173 r13182  
    6363    protected String name;
    6464    protected String code;
    65     protected String cacheDir;
    6665    protected Bounds bounds;
    6766    private double metersPerUnitWMTS;
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/AbstractProjectionChoice.java

    r13173 r13182  
    1111 * Super class for ProjectionChoice implementations.
    1212 * <p>
    13  * Handles common parameters <code>name</code>, <code>id</code> and <code>cacheDir</code>.
     13 * Handles common parameters <code>name</code> and <code>id</code>.
    1414 */
    1515public abstract class AbstractProjectionChoice implements ProjectionChoice {
     
    1717    protected String name;
    1818    protected String id;
    19     protected String cacheDir;
    2019
    2120    /**
     
    2423     * @param name short name of the projection choice as shown in the GUI
    2524     * @param id unique identifier for the projection choice
    26      * @param cacheDir a cache directory name
     25     * @param cacheDir unused
     26     * @deprecated use {@link #AbstractProjectionChoice(String, String)} instead
    2727     */
     28    @Deprecated
    2829    public AbstractProjectionChoice(String name, String id, String cacheDir) {
    29         this.name = name;
    30         this.id = id;
    31         this.cacheDir = cacheDir;
     30        this(name, id);
    3231    }
    3332
     
    3534     * Constructs a new {@code AbstractProjectionChoice}.
    3635     *
    37      * Only for core projection choices, where chacheDir is the same as
    38      * the second part of the id.
    3936     * @param name short name of the projection choice as shown in the GUI
    4037     * @param id unique identifier for the projection choice
    4138     */
    4239    public AbstractProjectionChoice(String name, String id) {
    43         this(name, id, null);
    44         if (!id.startsWith("core:")) throw new IllegalArgumentException(id+" does not start with core:");
    45         this.cacheDir = id.substring(5);
     40        this.name = name;
     41        this.id = id;
    4642    }
    4743
     
    5652    }
    5753
     54    /**
     55     * Returns current projection code.
     56     * @return current projection code
     57     */
    5858    public abstract String getCurrentCode();
    5959
     60    /**
     61     * Returns projection name.
     62     * @return projection name
     63     */
    6064    public abstract String getProjectionName();
    6165
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r12846 r13182  
    8080     * WGS84: Directly use latitude / longitude values as x/y.
    8181     */
    82     public static final ProjectionChoice wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326, "epsg4326");
     82    public static final ProjectionChoice wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326);
    8383
    8484    /**
     
    272272    }
    273273
     274    /**
     275     * Registers a new projection choice.
     276     * @param name short name of the projection choice as shown in the GUI
     277     * @param id short name of the projection choice as shown in the GUI
     278     * @param epsg the unique numeric EPSG identifier for the projection
     279     * @param cacheDir unused
     280     * @return the registered {@link ProjectionChoice}
     281     * @deprecated use {@link #registerProjectionChoice(String, String, Integer)} instead
     282     */
     283    @Deprecated
    274284    public static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg, String cacheDir) {
    275         ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg, cacheDir);
    276         registerProjectionChoice(pc);
    277         return pc;
    278     }
    279 
     285        return registerProjectionChoice(name, id, epsg);
     286    }
     287
     288    /**
     289     * Registers a new projection choice.
     290     * @param name short name of the projection choice as shown in the GUI
     291     * @param id short name of the projection choice as shown in the GUI
     292     * @param epsg the unique numeric EPSG identifier for the projection
     293     * @return the registered {@link ProjectionChoice}
     294     */
    280295    private static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg) {
    281296        ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg);
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/SingleProjectionChoice.java

    r10173 r13182  
    2323     * @param id unique identifier for the projection choice, e.g. "core:thisproj"
    2424     * @param code the unique identifier for the projection, e.g. "EPSG:1234"
    25      * @param cacheDir a cache directory name
     25     * @param cacheDir unused
     26     * @deprecated use {@link #SingleProjectionChoice(String, String, String)} instead
    2627     */
     28    @Deprecated
    2729    public SingleProjectionChoice(String name, String id, String code, String cacheDir) {
    28         super(name, id, cacheDir);
    29         this.code = code;
     30        this(name, id, code);
    3031    }
    3132
Note: See TracChangeset for help on using the changeset viewer.