Ignore:
Timestamp:
2009-11-21T15:48:35+01:00 (15 years ago)
Author:
stoecker
Message:

fix for subprojections

Location:
trunk/src/org/openstreetmap/josm/data/projection
Files:
2 edited

Legend:

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

    r2272 r2491  
    3737    /**
    3838     * Will be called if the preference dialog is dismissed.
     39     * argument may be null to reset everything
    3940     */
    4041    public void setPreferences(Collection<String> args);
  • trunk/src/org/openstreetmap/josm/data/projection/UTM.java

    r2272 r2491  
    2626public class UTM implements Projection, ProjectionSubPrefs {
    2727
    28     private int zone = 33;
     28    public static final int DEFAULT_ZONE = 30;
     29    private int zone = DEFAULT_ZONE;
    2930
    3031    final private double UTMScaleFactor = 0.9996;
     
    410411    public void setPreferences(Collection<String> args)
    411412    {
    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) {}
    414423    }
    415424
    416425    public Collection<String> getPreferencesFromCode(String code)
    417426    {
    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        }
    419438        return null;
    420439    }
Note: See TracChangeset for help on using the changeset viewer.