Ignore:
Timestamp:
2012-11-01T16:52:19+01:00 (14 years ago)
Author:
bastiK
Message:

remove Projection classes (replaced by data/epsg file)

concludes the projection rework from ealier this year

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/SingleProjectionChoice.java

    r5546 r5548  
    88import javax.swing.JPanel;
    99
    10 import org.openstreetmap.josm.data.projection.Projection;
    11 
    1210/**
    1311 * ProjectionChoice, that offers just one projection as choice.
     
    1513 * The GUI is an empty panel.
    1614 */
    17 public class SingleProjectionChoice implements ProjectionChoice {
     15public class SingleProjectionChoice extends AbstractProjectionChoice {
    1816
    19     private String id;
    20     private String name;
    21     private Projection projection;
     17    protected String code;
    2218
    23     public SingleProjectionChoice(String id, String name, Projection projection) {
    24         this.id = id;
    25         this.name = name;
    26         this.projection = projection;
     19    /**
     20     * Constructor.
     21     *
     22     * @param name short name of the projection choice as shown in the GUI
     23     * @param id unique identifier for the projection choice, e.g. "core:thisproj"
     24     * @param code the unique identifier for the projection, e.g. "EPSG:1234"
     25     * @param cacheDir a cache directory name
     26     */
     27    public SingleProjectionChoice(String name, String id, String code, String cacheDir) {
     28        super(name, id, cacheDir);
     29        this.code = code;
    2730    }
    2831
    29     public SingleProjectionChoice(String id, Projection projection) {
    30         this(id, projection.toString(), projection);
     32    public SingleProjectionChoice(String name, String id, String code) {
     33        super(name, id);
     34        this.code = code;
    3135    }
    3236
     
    3741
    3842    @Override
    39     public String getId() {
    40         return id;
    41     }
    42 
    43     @Override
    4443    public String[] allCodes() {
    45         return new String[] { projection.toCode() };
     44        return new String[] { code };
    4645    }
    4746
     
    5655
    5756    @Override
    58     public Projection getProjection() {
    59         return projection;
    60     }
    61 
    62     @Override
    6357    public String toString() {
    6458        return name;
     
    6761    @Override
    6862    public Collection<String> getPreferencesFromCode(String code) {
    69         if (code.equals(projection.toCode()))
     63        if (code.equals(this.code))
    7064            return Collections.emptyList();
    7165        else
    7266            return null;
    7367    }
     68
     69    @Override
     70    public String getCurrentCode() {
     71        return code;
     72    }
     73
     74    @Override
     75    public String getProjectionName() {
     76        return name; // the same name as the projection choice
     77    }
     78
    7479}
Note: See TracChangeset for help on using the changeset viewer.