Changeset 34466 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
- Timestamp:
- 2018-08-15T02:05:27+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r34095 r34466 35 35 import javax.swing.border.EmptyBorder; 36 36 37 import org.openstreetmap.josm.Main;38 37 import org.openstreetmap.josm.data.Bounds; 39 38 import org.openstreetmap.josm.data.UserIdentityManager; … … 43 42 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 44 43 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 44 import org.openstreetmap.josm.spi.preferences.Config; 45 45 import org.openstreetmap.josm.tools.HttpClient; 46 46 import org.openstreetmap.josm.tools.ImageProvider; … … 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("iodb.max.offsets", 4);59 private static final int MAX_OFFSETS = Config.getPref().getInt("iodb.max.offsets", 4); 60 60 61 61 /** … … 75 75 */ 76 76 public OffsetDialog(List<ImageryOffsetBase> offsets) { 77 super(JOptionPane.getFrameForComponent(Main .parent), ImageryOffsetTools.DIALOG_TITLE,77 super(JOptionPane.getFrameForComponent(MainApplication.getMainFrame()), ImageryOffsetTools.DIALOG_TITLE, 78 78 MODAL ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS); 79 79 setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); … … 93 93 updateButtonPanel(); 94 94 final JCheckBox calibrationBox = new JCheckBox(tr("Calibration geometries")); 95 calibrationBox.setSelected( Main.pref.getBoolean(PREF_CALIBRATION, true));95 calibrationBox.setSelected(Config.getPref().getBoolean(PREF_CALIBRATION, true)); 96 96 calibrationBox.addActionListener(new ActionListener() { 97 97 @Override 98 98 public void actionPerformed(ActionEvent e) { 99 Main.pref.putBoolean(PREF_CALIBRATION, calibrationBox.isSelected());99 Config.getPref().putBoolean(PREF_CALIBRATION, calibrationBox.isSelected()); 100 100 updateButtonPanel(); 101 101 } 102 102 }); 103 103 final JCheckBox deprecatedBox = new JCheckBox(tr("Deprecated offsets")); 104 deprecatedBox.setSelected( Main.pref.getBoolean(PREF_DEPRECATED, false));104 deprecatedBox.setSelected(Config.getPref().getBoolean(PREF_DEPRECATED, false)); 105 105 deprecatedBox.addActionListener(new ActionListener() { 106 106 @Override 107 107 public void actionPerformed(ActionEvent e) { 108 Main.pref.putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected());108 Config.getPref().putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected()); 109 109 updateButtonPanel(); 110 110 } … … 128 128 setContentPane(dialog); 129 129 pack(); 130 setLocationRelativeTo(Main .parent);130 setLocationRelativeTo(MainApplication.getMainFrame()); 131 131 } 132 132 … … 163 163 */ 164 164 private List<ImageryOffsetBase> filterOffsets() { 165 boolean showCalibration = Main.pref.getBoolean(PREF_CALIBRATION, true);166 boolean showDeprecated = Main.pref.getBoolean(PREF_DEPRECATED, false);165 boolean showCalibration = Config.getPref().getBoolean(PREF_CALIBRATION, true); 166 boolean showDeprecated = Config.getPref().getBoolean(PREF_DEPRECATED, false); 167 167 List<ImageryOffsetBase> filteredOffsets = new ArrayList<>(); 168 168 for (ImageryOffsetBase offset : offsets) { … … 246 246 boolean closeDialog = MODAL || selectedOffset == null 247 247 || selectedOffset instanceof CalibrationObject 248 || Main.pref.getBoolean("iodb.close.on.select", true);248 || Config.getPref().getBoolean("iodb.close.on.select", true); 249 249 if (closeDialog) { 250 250 MapView.removeZoomChangeListener(this); … … 275 275 ImageryOffsetWatcher.getInstance().markGood(); 276 276 MainApplication.getMap().repaint(); 277 if (! Main.pref.getBoolean("iodb.offset.message", false)) {278 JOptionPane.showMessageDialog(Main .parent,277 if (!Config.getPref().getBoolean("iodb.offset.message", false)) { 278 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 279 279 tr("The topmost imagery layer has been shifted to presumably match\n" 280 280 + "OSM data in the area. Please check that the offset is still valid\n" 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.putBoolean("iodb.offset.message", true);283 Config.getPref().putBoolean("iodb.offset.message", true); 284 284 } 285 285 } else if (selectedOffset instanceof CalibrationObject) { … … 287 287 MainApplication.getLayerManager().addLayer(clayer); 288 288 clayer.panToCenter(); 289 if (! Main.pref.getBoolean("iodb.calibration.message", false)) {290 JOptionPane.showMessageDialog(Main .parent,289 if (!Config.getPref().getBoolean("iodb.calibration.message", false)) { 290 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 291 291 tr("A layer has been added with a calibration geometry. Hide data layers,\n" 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.putBoolean("iodb.calibration.message", true);294 Config.getPref().putBoolean("iodb.calibration.message", true); 295 295 } 296 296 } … … 332 332 @Override 333 333 public void actionPerformed(ActionEvent e) { 334 String base = Main.pref.get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/");334 String base = Config.getPref().get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/"); 335 335 String lang = LanguageInfo.getWikiLanguagePrefix(); 336 336 String page = "Imagery_Offset_Database";
Note:
See TracChangeset
for help on using the changeset viewer.
