Ignore:
Timestamp:
2017-09-08T19:25:12+02:00 (3 years ago)
Author:
bastiK
Message:

see #15182 - remove GUI references from Projections class

File:
1 edited

Legend:

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

    r12735 r12786  
    3232import org.openstreetmap.josm.data.projection.CustomProjection;
    3333import org.openstreetmap.josm.data.projection.Projection;
     34import org.openstreetmap.josm.data.projection.Projections;
    3435import org.openstreetmap.josm.gui.ExtendedDialog;
    3536import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    4243import org.openstreetmap.josm.tools.GBC;
    4344import org.openstreetmap.josm.tools.JosmRuntimeException;
     45import org.openstreetmap.josm.tools.Logging;
    4446
    4547/**
     
    255257        projectionChoices.add(c);
    256258        projectionChoicesById.put(c.getId(), c);
     259        for (String code : c.allCodes()) {
     260            Projections.registerProjectionSupplier(code, () -> {
     261                Collection<String> pref = c.getPreferencesFromCode(code);
     262                c.setPreferences(pref);
     263                try {
     264                    return c.getProjection();
     265                } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
     266                    Logging.log(Logging.LEVEL_WARN, "Unable to get projection "+code+" with "+c+':', e);
     267                    return null;
     268                }
     269            });
     270        }
    257271    }
    258272
Note: See TracChangeset for help on using the changeset viewer.