Changeset 2491 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2009-11-21T15:48:35+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/ProjectionSubPrefs.java
r2272 r2491 37 37 /** 38 38 * Will be called if the preference dialog is dismissed. 39 * argument may be null to reset everything 39 40 */ 40 41 public void setPreferences(Collection<String> args); -
trunk/src/org/openstreetmap/josm/data/projection/UTM.java
r2272 r2491 26 26 public class UTM implements Projection, ProjectionSubPrefs { 27 27 28 private int zone = 33; 28 public static final int DEFAULT_ZONE = 30; 29 private int zone = DEFAULT_ZONE; 29 30 30 31 final private double UTMScaleFactor = 0.9996; … … 410 411 public void setPreferences(Collection<String> args) 411 412 { 412 /* TODO: parse args instead of fixed value */ 413 zone = 33; 413 zone = DEFAULT_ZONE; 414 try { 415 for(String s : args) 416 { 417 zone = Integer.parseInt(s); 418 if(zone <= 0 || zone > 60) 419 zone = DEFAULT_ZONE; 420 break; 421 } 422 } catch(NumberFormatException e) {} 414 423 } 415 424 416 425 public Collection<String> getPreferencesFromCode(String code) 417 426 { 418 /* TODO: implement */ 427 if(code.startsWith("EPSG:3258")) 428 { 429 try { 430 String zonestring = code.substring(9); 431 int zoneval = Integer.parseInt(zonestring); 432 if(zoneval > 0 && zone <= 60) 433 { 434 return Collections.singleton(zonestring); 435 } 436 } catch(NumberFormatException e) {} 437 } 419 438 return null; 420 439 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r2327 r2491 164 164 coll = null; 165 165 Main.proj = new Mercator(); 166 name = Main.proj.getClass().getName(); 166 167 } 167 168 if(!Main.proj.equals(oldProj) && b != null) … … 171 172 } 172 173 Main.pref.putCollection("projection.sub", coll); 173 if(coll != null && projHasPrefs(Main.proj)) 174 String sname = name.substring(name.lastIndexOf(".")+1); 175 Main.pref.putCollection("projection.sub."+sname, coll); 176 if(projHasPrefs(Main.proj)) 174 177 ((ProjectionSubPrefs) Main.proj).setPreferences(coll); 175 178 } … … 205 208 for (int i = 0; i < projectionCombo.getItemCount(); ++i) { 206 209 Projection proj = (Projection)projectionCombo.getItemAt(i); 207 if (proj.getClass().getName().equals(Main.pref.get("projection", Mercator.class.getName()))) { 210 String name = proj.getClass().getName(); 211 String sname = name.substring(name.lastIndexOf(".")+1); 212 if(projHasPrefs(proj)) 213 ((ProjectionSubPrefs) proj).setPreferences(Main.pref.getCollection("projection.sub."+sname, null)); 214 if (name.equals(Main.pref.get("projection", Mercator.class.getName()))) { 208 215 projectionCombo.setSelectedIndex(i); 209 216 selectedProjectionChanged(proj);
Note:
See TracChangeset
for help on using the changeset viewer.