Ignore:
Timestamp:
2017-11-05T19:09:17+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12840

Location:
applications/editors/josm/plugins/imagery_offset_db
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/build.xml

    r33547 r33774  
    55    <property name="commit.message" value="Imagery Offset Database"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12643"/>
     7    <property name="plugin.main.version" value="12840"/>
    88    <property name="plugin.canloadatruntime" value="true"/>
    99
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java

    r33547 r33774  
    1212
    1313import org.openstreetmap.josm.Main;
    14 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
     14import org.openstreetmap.josm.data.UserIdentityManager;
    1515import org.openstreetmap.josm.gui.MainApplication;
    1616import org.openstreetmap.josm.tools.ImageProvider;
     
    7979     */
    8080    public static void deprecateOffset(ImageryOffsetBase offset, QuerySuccessListener listener) {
    81         String userName = JosmUserIdentityManager.getInstance().getUserName();
     81        String userName = UserIdentityManager.getInstance().getUserName();
    8282        if (userName == null) {
    8383            JOptionPane.showMessageDialog(Main.parent, tr("To store imagery offsets you must be a registered OSM user."),
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java

    r33547 r33774  
    1818import org.openstreetmap.josm.Main;
    1919import org.openstreetmap.josm.actions.JosmAction;
    20 import org.openstreetmap.josm.data.coor.CoordinateFormat;
    2120import org.openstreetmap.josm.data.coor.LatLon;
     21import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;
    2222import org.openstreetmap.josm.data.projection.Projection;
    2323import org.openstreetmap.josm.gui.MainApplication;
     
    5959        Projection proj = MainApplication.getMap().mapView.getProjection();
    6060        LatLon center = proj.eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
    61         AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     61        AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    6262        String imagery = ImageryOffsetTools.getImageryID(layer);
    6363        if (imagery == null)
     
    7777        if (!MainApplication.isDisplayingMapView() || !MainApplication.getMap().isVisible())
    7878            state = false;
    79         AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     79        AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    8080        if (ImageryOffsetTools.getImageryID(layer) == null)
    8181            state = false;
     
    131131         * @param imagery Imagery ID for the layer.
    132132         */
    133         DownloadOffsetsTask(LatLon center, AbstractTileSourceLayer layer, String imagery) {
     133        DownloadOffsetsTask(LatLon center, AbstractTileSourceLayer<?> layer, String imagery) {
    134134            super(null, tr("Loading imagery offsets..."));
    135135            try {
    136                 String query = "get?lat=" + center.latToString(CoordinateFormat.DECIMAL_DEGREES)
    137                 + "&lon=" + center.lonToString(CoordinateFormat.DECIMAL_DEGREES)
     136                String query = "get?lat=" + DecimalDegreesCoordinateFormat.INSTANCE.latToString(center)
     137                + "&lon=" + DecimalDegreesCoordinateFormat.INSTANCE.lonToString(center)
    138138                + "&imagery=" + URLEncoder.encode(imagery, "UTF8");
    139                 int radius = Main.pref.getInteger("iodb.radius", -1);
     139                int radius = Main.pref.getInt("iodb.radius", -1);
    140140                if (radius > 0)
    141141                    query = query + "&radius=" + radius;
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffset.java

    r33547 r33774  
    44import java.util.Map;
    55
    6 import org.openstreetmap.josm.data.coor.CoordinateFormat;
    76import org.openstreetmap.josm.data.coor.LatLon;
     7import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;
    88
    99/**
     
    5555        super.putServerParams(map);
    5656        map.put("imagery", imagery);
    57         map.put("imlat", imageryPos.latToString(CoordinateFormat.DECIMAL_DEGREES));
    58         map.put("imlon", imageryPos.lonToString(CoordinateFormat.DECIMAL_DEGREES));
     57        map.put("imlat", DecimalDegreesCoordinateFormat.INSTANCE.latToString(imageryPos));
     58        map.put("imlon", DecimalDegreesCoordinateFormat.INSTANCE.lonToString(imageryPos));
    5959        if (minZoom > 0)
    6060            map.put("minzoom", String.valueOf(minZoom));
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java

    r32528 r33774  
    55import java.util.Map;
    66
    7 import org.openstreetmap.josm.data.coor.CoordinateFormat;
    87import org.openstreetmap.josm.data.coor.LatLon;
     8import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;
    99
    1010/**
     
    107107
    108108    public void putServerParams(Map<String, String> map) {
    109         map.put("lat", position.latToString(CoordinateFormat.DECIMAL_DEGREES));
    110         map.put("lon", position.lonToString(CoordinateFormat.DECIMAL_DEGREES));
     109        map.put("lat", DecimalDegreesCoordinateFormat.INSTANCE.latToString(position));
     110        map.put("lon", DecimalDegreesCoordinateFormat.INSTANCE.lonToString(position));
    111111        map.put("author", author);
    112112        map.put("description", description);
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java

    r33547 r33774  
    55
    66import java.awt.event.KeyEvent;
    7 import java.util.Collection;
    87import java.util.LinkedList;
     8import java.util.List;
    99
    1010import javax.swing.JMenu;
     
    5050                // an ugly hack to add this plugin to the toolbar
    5151                if (Main.pref.getBoolean("iodb.modify.toolbar", true)) {
    52                     Collection<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString());
     52                    List<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString());
    5353                    if (!toolbar.contains("getoffset")) {
    5454                        toolbar.add("getoffset");
    55                         Main.pref.putCollection("toolbar", toolbar);
     55                        Main.pref.putList("toolbar", toolbar);
    5656                        MainApplication.getToolbar().refreshToolbarControl();
    5757                    }
    58                     Main.pref.put("iodb.modify.toolbar", false);
     58                    Main.pref.putBoolean("iodb.modify.toolbar", false);
    5959                }
    6060    }
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java

    r33547 r33774  
    33
    44import java.util.ArrayList;
    5 import java.util.Collection;
    65import java.util.Iterator;
    76import java.util.LinkedList;
     
    116115            return;
    117116        }
    118         AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     117        AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    119118        if (layer == null) {
    120119            setOffsetGood(true);
     
    158157     */
    159158    public void markGood() {
    160         AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     159        AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    161160        if (layer != null) {
    162161            TileSourceDisplaySettings displaySettings = layer.getDisplaySettings();
     
    205204        Layer newLayer = e.getAddedLayer();
    206205        if (newLayer instanceof AbstractTileSourceLayer)
    207             loadLayerOffset((AbstractTileSourceLayer) newLayer);
     206            loadLayerOffset((AbstractTileSourceLayer<?>) newLayer);
    208207        checkOffset();
    209208    }
     
    223222     * projections: nobody uses them anyway.
    224223     */
    225     private void storeLayerOffset(AbstractTileSourceLayer layer) {
     224    private void storeLayerOffset(AbstractTileSourceLayer<?> layer) {
    226225        String id = ImageryOffsetTools.getImageryID(layer);
    227226        if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null)
    228227            return;
    229         Collection<String> offsets = new LinkedList<>(Main.pref.getCollection("iodb.stored.offsets"));
     228        List<String> offsets = new LinkedList<>(Main.pref.getList("iodb.stored.offsets"));
    230229        for (Iterator<String> iter = offsets.iterator(); iter.hasNext();) {
    231230            String[] offset = iter.next().split(":");
     
    236235        offsets.add(id + ":" + center.lat() + ":" + center.lon() + ":" +
    237236                layer.getDisplaySettings().getDx() + ":" + layer.getDisplaySettings().getDy());
    238         Main.pref.putCollection("iodb.stored.offsets", offsets);
     237        Main.pref.putList("iodb.stored.offsets", offsets);
    239238    }
    240239
     
    242241     * Loads the current imagery layer offset from preferences.
    243242     */
    244     private void loadLayerOffset(AbstractTileSourceLayer layer) {
     243    private void loadLayerOffset(AbstractTileSourceLayer<?> layer) {
    245244        String id = ImageryOffsetTools.getImageryID(layer);
    246245        if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null)
    247246            return;
    248         Collection<String> offsets = Main.pref.getCollection("iodb.stored.offsets");
     247        List<String> offsets = Main.pref.getList("iodb.stored.offsets");
    249248        for (String offset : offsets) {
    250249            String[] parts = offset.split(":");
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java

    r33547 r33774  
    3737import org.openstreetmap.josm.Main;
    3838import org.openstreetmap.josm.data.Bounds;
    39 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
     39import org.openstreetmap.josm.data.UserIdentityManager;
    4040import org.openstreetmap.josm.gui.MainApplication;
    4141import org.openstreetmap.josm.gui.MapView;
     
    5757    protected static final String PREF_CALIBRATION = "iodb.show.calibration";
    5858    protected static final String PREF_DEPRECATED = "iodb.show.deprecated";
    59     private static final int MAX_OFFSETS = Main.pref.getInteger("iodb.max.offsets", 4);
     59    private static final int MAX_OFFSETS = Main.pref.getInt("iodb.max.offsets", 4);
    6060
    6161    /**
     
    9797            @Override
    9898            public void actionPerformed(ActionEvent e) {
    99                 Main.pref.put(PREF_CALIBRATION, calibrationBox.isSelected());
     99                Main.pref.putBoolean(PREF_CALIBRATION, calibrationBox.isSelected());
    100100                updateButtonPanel();
    101101            }
     
    106106            @Override
    107107            public void actionPerformed(ActionEvent e) {
    108                 Main.pref.put(PREF_DEPRECATED, deprecatedBox.isSelected());
     108                Main.pref.putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected());
    109109                updateButtonPanel();
    110110            }
     
    271271    public void applyOffset() {
    272272        if (selectedOffset instanceof ImageryOffset) {
    273             AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     273            AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    274274            ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset) selectedOffset);
    275275            ImageryOffsetWatcher.getInstance().markGood();
     
    281281                                + "by downloading GPS tracks and comparing them and OSM data to the imagery."),
    282282                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
    283                 Main.pref.put("iodb.offset.message", true);
     283                Main.pref.putBoolean("iodb.offset.message", true);
    284284            }
    285285        } else if (selectedOffset instanceof CalibrationObject) {
     
    292292                                + "find the corresponding feature on the imagery layer and move it accordingly."),
    293293                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
    294                 Main.pref.put("iodb.calibration.message", true);
     294                Main.pref.putBoolean("iodb.calibration.message", true);
    295295            }
    296296        }
     
    315315        @Override
    316316        public void queryPassed() {
    317             offset.setDeprecated(new Date(), JosmUserIdentityManager.getInstance().getUserName(), "");
     317            offset.setDeprecated(new Date(), UserIdentityManager.getInstance().getUserName(), "");
    318318            updateButtonPanel();
    319319        }
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java

    r33547 r33774  
    1515import org.openstreetmap.josm.Main;
    1616import org.openstreetmap.josm.actions.JosmAction;
     17import org.openstreetmap.josm.data.UserIdentityManager;
    1718import org.openstreetmap.josm.data.coor.LatLon;
    1819import org.openstreetmap.josm.data.osm.Node;
    1920import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2021import org.openstreetmap.josm.data.osm.Way;
    21 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
    2222import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer;
     
    5454            return;
    5555
    56         AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();
     56        AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer();
    5757        if (layer == null)
    5858            return;
    5959
    60         String userName = JosmUserIdentityManager.getInstance().getUserName();
     60        String userName = UserIdentityManager.getInstance().getUserName();
    6161        if (userName == null || userName.length() == 0) {
    6262            JOptionPane.showMessageDialog(Main.parent,
Note: See TracChangeset for help on using the changeset viewer.