Changeset 33774 in osm for applications
- Timestamp:
- 2017-11-05T19:09:17+01:00 (7 years ago)
- 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 5 5 <property name="commit.message" value="Imagery Offset Database"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="12 643"/>7 <property name="plugin.main.version" value="12840"/> 8 8 <property name="plugin.canloadatruntime" value="true"/> 9 9 -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java
r33547 r33774 12 12 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm. gui.JosmUserIdentityManager;14 import org.openstreetmap.josm.data.UserIdentityManager; 15 15 import org.openstreetmap.josm.gui.MainApplication; 16 16 import org.openstreetmap.josm.tools.ImageProvider; … … 79 79 */ 80 80 public static void deprecateOffset(ImageryOffsetBase offset, QuerySuccessListener listener) { 81 String userName = JosmUserIdentityManager.getInstance().getUserName();81 String userName = UserIdentityManager.getInstance().getUserName(); 82 82 if (userName == null) { 83 83 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 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.actions.JosmAction; 20 import org.openstreetmap.josm.data.coor.CoordinateFormat;21 20 import org.openstreetmap.josm.data.coor.LatLon; 21 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 22 22 import org.openstreetmap.josm.data.projection.Projection; 23 23 import org.openstreetmap.josm.gui.MainApplication; … … 59 59 Projection proj = MainApplication.getMap().mapView.getProjection(); 60 60 LatLon center = proj.eastNorth2latlon(MainApplication.getMap().mapView.getCenter()); 61 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();61 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 62 62 String imagery = ImageryOffsetTools.getImageryID(layer); 63 63 if (imagery == null) … … 77 77 if (!MainApplication.isDisplayingMapView() || !MainApplication.getMap().isVisible()) 78 78 state = false; 79 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();79 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 80 80 if (ImageryOffsetTools.getImageryID(layer) == null) 81 81 state = false; … … 131 131 * @param imagery Imagery ID for the layer. 132 132 */ 133 DownloadOffsetsTask(LatLon center, AbstractTileSourceLayer layer, String imagery) {133 DownloadOffsetsTask(LatLon center, AbstractTileSourceLayer<?> layer, String imagery) { 134 134 super(null, tr("Loading imagery offsets...")); 135 135 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) 138 138 + "&imagery=" + URLEncoder.encode(imagery, "UTF8"); 139 int radius = Main.pref.getInt eger("iodb.radius", -1);139 int radius = Main.pref.getInt("iodb.radius", -1); 140 140 if (radius > 0) 141 141 query = query + "&radius=" + radius; -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffset.java
r33547 r33774 4 4 import java.util.Map; 5 5 6 import org.openstreetmap.josm.data.coor.CoordinateFormat;7 6 import org.openstreetmap.josm.data.coor.LatLon; 7 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 8 8 9 9 /** … … 55 55 super.putServerParams(map); 56 56 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)); 59 59 if (minZoom > 0) 60 60 map.put("minzoom", String.valueOf(minZoom)); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java
r32528 r33774 5 5 import java.util.Map; 6 6 7 import org.openstreetmap.josm.data.coor.CoordinateFormat;8 7 import org.openstreetmap.josm.data.coor.LatLon; 8 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 9 9 10 10 /** … … 107 107 108 108 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)); 111 111 map.put("author", author); 112 112 map.put("description", description); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java
r33547 r33774 5 5 6 6 import java.awt.event.KeyEvent; 7 import java.util.Collection;8 7 import java.util.LinkedList; 8 import java.util.List; 9 9 10 10 import javax.swing.JMenu; … … 50 50 // an ugly hack to add this plugin to the toolbar 51 51 if (Main.pref.getBoolean("iodb.modify.toolbar", true)) { 52 Collection<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString());52 List<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString()); 53 53 if (!toolbar.contains("getoffset")) { 54 54 toolbar.add("getoffset"); 55 Main.pref.put Collection("toolbar", toolbar);55 Main.pref.putList("toolbar", toolbar); 56 56 MainApplication.getToolbar().refreshToolbarControl(); 57 57 } 58 Main.pref.put ("iodb.modify.toolbar", false);58 Main.pref.putBoolean("iodb.modify.toolbar", false); 59 59 } 60 60 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java
r33547 r33774 3 3 4 4 import java.util.ArrayList; 5 import java.util.Collection;6 5 import java.util.Iterator; 7 6 import java.util.LinkedList; … … 116 115 return; 117 116 } 118 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();117 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 119 118 if (layer == null) { 120 119 setOffsetGood(true); … … 158 157 */ 159 158 public void markGood() { 160 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();159 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 161 160 if (layer != null) { 162 161 TileSourceDisplaySettings displaySettings = layer.getDisplaySettings(); … … 205 204 Layer newLayer = e.getAddedLayer(); 206 205 if (newLayer instanceof AbstractTileSourceLayer) 207 loadLayerOffset((AbstractTileSourceLayer ) newLayer);206 loadLayerOffset((AbstractTileSourceLayer<?>) newLayer); 208 207 checkOffset(); 209 208 } … … 223 222 * projections: nobody uses them anyway. 224 223 */ 225 private void storeLayerOffset(AbstractTileSourceLayer layer) {224 private void storeLayerOffset(AbstractTileSourceLayer<?> layer) { 226 225 String id = ImageryOffsetTools.getImageryID(layer); 227 226 if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null) 228 227 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")); 230 229 for (Iterator<String> iter = offsets.iterator(); iter.hasNext();) { 231 230 String[] offset = iter.next().split(":"); … … 236 235 offsets.add(id + ":" + center.lat() + ":" + center.lon() + ":" + 237 236 layer.getDisplaySettings().getDx() + ":" + layer.getDisplaySettings().getDy()); 238 Main.pref.put Collection("iodb.stored.offsets", offsets);237 Main.pref.putList("iodb.stored.offsets", offsets); 239 238 } 240 239 … … 242 241 * Loads the current imagery layer offset from preferences. 243 242 */ 244 private void loadLayerOffset(AbstractTileSourceLayer layer) {243 private void loadLayerOffset(AbstractTileSourceLayer<?> layer) { 245 244 String id = ImageryOffsetTools.getImageryID(layer); 246 245 if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null) 247 246 return; 248 Collection<String> offsets = Main.pref.getCollection("iodb.stored.offsets");247 List<String> offsets = Main.pref.getList("iodb.stored.offsets"); 249 248 for (String offset : offsets) { 250 249 String[] parts = offset.split(":"); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r33547 r33774 37 37 import org.openstreetmap.josm.Main; 38 38 import org.openstreetmap.josm.data.Bounds; 39 import org.openstreetmap.josm. gui.JosmUserIdentityManager;39 import org.openstreetmap.josm.data.UserIdentityManager; 40 40 import org.openstreetmap.josm.gui.MainApplication; 41 41 import org.openstreetmap.josm.gui.MapView; … … 57 57 protected static final String PREF_CALIBRATION = "iodb.show.calibration"; 58 58 protected static final String PREF_DEPRECATED = "iodb.show.deprecated"; 59 private static final int MAX_OFFSETS = Main.pref.getInt eger("iodb.max.offsets", 4);59 private static final int MAX_OFFSETS = Main.pref.getInt("iodb.max.offsets", 4); 60 60 61 61 /** … … 97 97 @Override 98 98 public void actionPerformed(ActionEvent e) { 99 Main.pref.put (PREF_CALIBRATION, calibrationBox.isSelected());99 Main.pref.putBoolean(PREF_CALIBRATION, calibrationBox.isSelected()); 100 100 updateButtonPanel(); 101 101 } … … 106 106 @Override 107 107 public void actionPerformed(ActionEvent e) { 108 Main.pref.put (PREF_DEPRECATED, deprecatedBox.isSelected());108 Main.pref.putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected()); 109 109 updateButtonPanel(); 110 110 } … … 271 271 public void applyOffset() { 272 272 if (selectedOffset instanceof ImageryOffset) { 273 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();273 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 274 274 ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset) selectedOffset); 275 275 ImageryOffsetWatcher.getInstance().markGood(); … … 281 281 + "by downloading GPS tracks and comparing them and OSM data to the imagery."), 282 282 ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE); 283 Main.pref.put ("iodb.offset.message", true);283 Main.pref.putBoolean("iodb.offset.message", true); 284 284 } 285 285 } else if (selectedOffset instanceof CalibrationObject) { … … 292 292 + "find the corresponding feature on the imagery layer and move it accordingly."), 293 293 ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE); 294 Main.pref.put ("iodb.calibration.message", true);294 Main.pref.putBoolean("iodb.calibration.message", true); 295 295 } 296 296 } … … 315 315 @Override 316 316 public void queryPassed() { 317 offset.setDeprecated(new Date(), JosmUserIdentityManager.getInstance().getUserName(), "");317 offset.setDeprecated(new Date(), UserIdentityManager.getInstance().getUserName(), ""); 318 318 updateButtonPanel(); 319 319 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
r33547 r33774 15 15 import org.openstreetmap.josm.Main; 16 16 import org.openstreetmap.josm.actions.JosmAction; 17 import org.openstreetmap.josm.data.UserIdentityManager; 17 18 import org.openstreetmap.josm.data.coor.LatLon; 18 19 import org.openstreetmap.josm.data.osm.Node; 19 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 21 import org.openstreetmap.josm.data.osm.Way; 21 import org.openstreetmap.josm.gui.JosmUserIdentityManager;22 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; … … 54 54 return; 55 55 56 AbstractTileSourceLayer layer = ImageryOffsetTools.getTopImageryLayer();56 AbstractTileSourceLayer<?> layer = ImageryOffsetTools.getTopImageryLayer(); 57 57 if (layer == null) 58 58 return; 59 59 60 String userName = JosmUserIdentityManager.getInstance().getUserName();60 String userName = UserIdentityManager.getInstance().getUserName(); 61 61 if (userName == null || userName.length() == 0) { 62 62 JOptionPane.showMessageDialog(Main.parent,
Note:
See TracChangeset
for help on using the changeset viewer.