Changeset 5548 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/projection/SingleProjectionChoice.java
- Timestamp:
- 2012-11-01T16:52:19+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/projection/SingleProjectionChoice.java
r5546 r5548 8 8 import javax.swing.JPanel; 9 9 10 import org.openstreetmap.josm.data.projection.Projection;11 12 10 /** 13 11 * ProjectionChoice, that offers just one projection as choice. … … 15 13 * The GUI is an empty panel. 16 14 */ 17 public class SingleProjectionChoice implementsProjectionChoice {15 public class SingleProjectionChoice extends AbstractProjectionChoice { 18 16 19 private String id; 20 private String name; 21 private Projection projection; 17 protected String code; 22 18 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; 27 30 } 28 31 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; 31 35 } 32 36 … … 37 41 38 42 @Override 39 public String getId() {40 return id;41 }42 43 @Override44 43 public String[] allCodes() { 45 return new String[] { projection.toCode()};44 return new String[] { code }; 46 45 } 47 46 … … 56 55 57 56 @Override 58 public Projection getProjection() {59 return projection;60 }61 62 @Override63 57 public String toString() { 64 58 return name; … … 67 61 @Override 68 62 public Collection<String> getPreferencesFromCode(String code) { 69 if (code.equals( projection.toCode()))63 if (code.equals(this.code)) 70 64 return Collections.emptyList(); 71 65 else 72 66 return null; 73 67 } 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 74 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
