Changeset 3715 in josm
- Timestamp:
- 2010-12-12T01:47:03+01:00 (14 years ago)
- Location:
- trunk
- Files:
-
- 32 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r3425 r3715 16 16 <classpathentry kind="lib" path="test/lib/fest/MRJToolkitStubs-1.0.jar"/> 17 17 <classpathentry kind="lib" path="test/lib/jfcunit.jar"/> 18 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 6"/>18 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 19 19 <classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/> 20 20 <classpathentry kind="lib" path="lib/signpost-core-1.2.1.1.jar"/> -
trunk/src/org/openstreetmap/josm/Main.java
r3669 r3715 62 62 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 63 63 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; 64 import org.openstreetmap.josm.gui.preferences.ImageryPreference; 64 65 import org.openstreetmap.josm.gui.preferences.MapPaintPreference; 65 66 import org.openstreetmap.josm.gui.preferences.ProjectionPreference; … … 220 221 TaggingPresetPreference.initialize(); 221 222 MapPaintPreference.initialize(); 223 ImageryPreference.initialize(); 222 224 223 225 validator = new OsmValidator(); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r3707 r3715 221 221 monitor.worked(1); 222 222 223 if (RemoteControl. on && RemoteControl.PROP_REMOTECONTROL_ENABLED.get()) {223 if (RemoteControl.PROP_REMOTECONTROL_ENABLED.get()) { 224 224 RemoteControl.start(); 225 225 } … … 266 266 dialog.setContent( 267 267 trn("JOSM found {0} unsaved osm data layer. ", 268 "JOSM found {0} unsaved osm data layers. ", unsavedLayerFiles.size(), unsavedLayerFiles.size()) +269 tr("It looks like JOSM crashed last time. Do you like to restore the data?"));268 "JOSM found {0} unsaved osm data layers. ", unsavedLayerFiles.size(), unsavedLayerFiles.size()) + 269 tr("It looks like JOSM crashed last time. Do you like to restore the data?")); 270 270 dialog.setButtonIcons(new String[] {"ok", "cancel", "dialogs/remove"}); 271 271 int selection = dialog.showDialog().getValue(); … … 278 278 autosaveTask.schedule(); 279 279 } 280 280 281 281 main.postConstructorProcessCmdLine(args); 282 282 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r3710 r3715 5 5 import static org.openstreetmap.josm.tools.I18n.marktr; 6 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 7 import static org.openstreetmap.josm.tools.I18n.trc; 8 9 import java.awt.Component; 10 import java.awt.event.ActionEvent; 8 11 import java.awt.event.KeyEvent; 12 import java.util.List; 9 13 10 14 import javax.swing.JCheckBoxMenuItem; … … 16 20 import org.openstreetmap.josm.Main; 17 21 import org.openstreetmap.josm.actions.AboutAction; 22 import org.openstreetmap.josm.actions.AddImageryLayerAction; 18 23 import org.openstreetmap.josm.actions.AddNodeAction; 19 24 import org.openstreetmap.josm.actions.AlignInCircleAction; … … 42 47 import org.openstreetmap.josm.actions.JosmAction; 43 48 import org.openstreetmap.josm.actions.JumpToAction; 49 import org.openstreetmap.josm.actions.Map_Rectifier_WMSmenuAction; 44 50 import org.openstreetmap.josm.actions.MergeLayerAction; 45 51 import org.openstreetmap.josm.actions.MergeNodesAction; … … 85 91 import org.openstreetmap.josm.actions.audio.AudioSlowerAction; 86 92 import org.openstreetmap.josm.actions.search.SearchAction; 93 import org.openstreetmap.josm.data.imagery.ImageryInfo; 94 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 87 95 import org.openstreetmap.josm.gui.io.RecentlyOpenedFilesMenu; 96 import org.openstreetmap.josm.gui.layer.ImageryLayer; 88 97 import org.openstreetmap.josm.gui.layer.Layer; 98 import org.openstreetmap.josm.gui.layer.WMSLayer; 89 99 import org.openstreetmap.josm.gui.tagging.TaggingPresetSearchAction; 90 100 import org.openstreetmap.josm.tools.Shortcut; … … 180 190 public final JMenu toolsMenu = addMenu(marktr("Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools")); 181 191 public final JMenu presetsMenu = addMenu(marktr("Presets"), KeyEvent.VK_P, 4, ht("/Menu/Presets")); 192 public final JMenu imageryMenu = addMenu(marktr("Imagery"), KeyEvent.VK_I, 5, ht("/Menu/Imagery")); 182 193 public JMenu audioMenu = null; 183 public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 5, ht("/Menu/Help"));184 public final int defaultMenuPos = 5;194 public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 6, ht("/Menu/Help")); 195 public final int defaultMenuPos = 6; 185 196 186 197 public final JosmAction moveUpAction = new MoveAction(MoveAction.Direction.UP); … … 191 202 192 203 public final TaggingPresetSearchAction presetSearchAction = new TaggingPresetSearchAction(); 193 204 public final ImageryMenuUpdater imageryMenuUpdater; 194 205 195 206 /** … … 329 340 330 341 if (!Main.pref.getBoolean("audio.menuinvisible", false)) { 331 audioMenu = addMenu(marktr("Audio"), KeyEvent.VK_A, 5, ht("/Menu/Audio"));342 audioMenu = addMenu(marktr("Audio"), KeyEvent.VK_A, defaultMenuPos, ht("/Menu/Audio")); 332 343 add(audioMenu, audioPlayPause); 333 344 add(audioMenu, audioNext); … … 347 358 348 359 new PresetsMenuEnabler(presetsMenu).refreshEnabled(); 360 imageryMenuUpdater = new ImageryMenuUpdater(); 349 361 } 350 362 … … 378 390 } 379 391 } 392 393 public class ImageryMenuUpdater implements MapView.LayerChangeListener { 394 JMenu offsetSubMenu = new JMenu(trc("layer","Offset")); 395 396 public ImageryMenuUpdater() { 397 MapView.addLayerChangeListener(this); 398 } 399 400 public void refreshImageryMenu() { 401 imageryMenu.removeAll(); 402 403 // for each configured WMSInfo, add a menu entry. 404 for (final ImageryInfo u : ImageryLayerInfo.instance.getLayers()) { 405 imageryMenu.add(new JMenuItem(new AddImageryLayerAction(u))); 406 } 407 imageryMenu.addSeparator(); 408 imageryMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction())); 409 410 imageryMenu.addSeparator(); 411 imageryMenu.add(offsetSubMenu); 412 imageryMenu.addSeparator(); 413 imageryMenu.add(new JMenuItem(new 414 JosmAction(tr("Blank Layer"), "blankmenu", tr("Open a blank WMS layer to load data from a file"), null, false) { 415 @Override 416 public void actionPerformed(ActionEvent ev) { 417 Main.main.addLayer(new WMSLayer()); 418 } 419 })); 420 refreshEnabled(); 421 } 422 423 public void refreshEnabled() { 424 imageryMenu.setEnabled(Main.map != null 425 && Main.map.mapView !=null 426 ); 427 } 428 429 public void refreshOffsetMenu() { 430 offsetSubMenu.removeAll(); 431 if (Main.map == null || Main.map.mapView == null) { 432 offsetSubMenu.setEnabled(false); 433 return; 434 } 435 List<ImageryLayer> layers = Main.map.mapView.getLayersOfType(ImageryLayer.class); 436 if (layers.isEmpty()) { 437 offsetSubMenu.setEnabled(false); 438 return; 439 } 440 offsetSubMenu.setEnabled(true); 441 if (layers.size() == 1) { 442 for (Component c : layers.get(0).getOffsetMenu()) { 443 offsetSubMenu.add(c); 444 } 445 return; 446 } 447 for (ImageryLayer layer : layers) { 448 JMenu subMenu = new JMenu(layer.getName()); 449 subMenu.setIcon(layer.getIcon()); 450 for (Component c : layer.getOffsetMenu()) { 451 subMenu.add(c); 452 } 453 offsetSubMenu.add(subMenu); 454 } 455 } 456 457 @Override 458 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 459 } 460 461 @Override 462 public void layerAdded(Layer newLayer) { 463 if (newLayer instanceof ImageryLayer) { 464 refreshOffsetMenu(); 465 } 466 refreshEnabled(); 467 } 468 469 @Override 470 public void layerRemoved(Layer oldLayer) { 471 if (oldLayer instanceof ImageryLayer) { 472 refreshOffsetMenu(); 473 } 474 refreshEnabled(); 475 } 476 } 380 477 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r3687 r3715 12 12 import java.util.ArrayList; 13 13 import java.util.Arrays; 14 import java.util.Collections; 15 import java.util.HashSet; 14 16 import java.util.List; 15 17 import java.util.Vector; … … 30 32 import org.openstreetmap.josm.data.Bounds; 31 33 import org.openstreetmap.josm.data.coor.LatLon; 34 import org.openstreetmap.josm.data.imagery.ImageryInfo; 35 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 32 36 import org.openstreetmap.josm.data.preferences.StringProperty; 37 import org.openstreetmap.josm.gui.layer.TMSLayer; 33 38 34 39 public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser{ … … 65 70 66 71 @Override public Image getAttributionImage() { return source.getAttributionImage(); } 67 68 @Override public String getAttributionText(int zoom, LatLon topLeft, LatLonbotRight) { return source.getAttributionText(zoom, topLeft, botRight); }72 73 @Override public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { return source.getAttributionText(zoom, topLeft, botRight); } 69 74 70 75 @Override public boolean requiresAttribution() { return source.requiresAttribution(); } … … 74 79 @Override public String getTermsOfUseURL() { return source.getTermsOfUseURL(); } 75 80 } 81 82 /** 83 * TMS TileSource provider for the slippymap chooser 84 */ 85 public static class TMSTileSourceProvider implements TileSourceProvider { 86 static final HashSet<String> existingSlippyMapUrls = new HashSet<String>(); 87 static { 88 // Urls that already exist in the slippymap chooser and shouldn't be copied from TMS layer list 89 existingSlippyMapUrls.add("http://tile.openstreetmap.org/"); 90 existingSlippyMapUrls.add("http://tah.openstreetmap.org/Tiles/tile/"); 91 existingSlippyMapUrls.add("http://tile.opencyclemap.org/cycle/"); 92 } 93 94 @Override 95 public List<TileSource> getTileSources() { 96 if (!TMSLayer.PROP_ADD_TO_SLIPPYMAP_CHOOSER.get()) return Collections.<TileSource>emptyList(); 97 List<TileSource> sources = new ArrayList<TileSource>(); 98 for (ImageryInfo info : ImageryLayerInfo.instance.getLayers()) { 99 if (existingSlippyMapUrls.contains(info.getURL())) { 100 continue; 101 } 102 TileSource source = TMSLayer.getTileSource(info); 103 if (source != null) { 104 sources.add(source); 105 } 106 } 107 return sources; 108 } 109 110 public static void addExistingSlippyMapUrl(String url) { 111 existingSlippyMapUrls.add(url); 112 } 113 } 114 76 115 77 116 /** … … 96 135 } 97 136 }); 137 addTileSourceProvider(new TMSTileSourceProvider()); 98 138 } 99 139 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r3707 r3715 26 26 27 27 import org.openstreetmap.josm.Main; 28 import org.openstreetmap.josm.io.remotecontrol.RemoteControl;29 28 import org.openstreetmap.josm.plugins.PluginDownloadTask; 30 29 import org.openstreetmap.josm.plugins.PluginHandler; … … 45 44 46 45 /** 47 * Allows PreferenceSettings to do validation of entered values when ok was pressed. 46 * Allows PreferenceSettings to do validation of entered values when ok was pressed. 48 47 * If data is invalid then event can return false to cancel closing of preferences dialog. 49 48 * … … 278 277 settingsFactory.add(new ShortcutPreference.Factory()); 279 278 settingsFactory.add(new ValidatorPreference.Factory()); 280 if (RemoteControl.on) { 281 settingsFactory.add(new RemoteControlPreference.Factory()); 282 } 279 settingsFactory.add(new RemoteControlPreference.Factory()); 280 settingsFactory.add(new ImageryPreference.Factory()); 283 281 284 282 PluginHandler.getPreferenceSetting(settingsFactory); -
trunk/src/org/openstreetmap/josm/gui/preferences/RemoteControlPreference.java
r3707 r3715 7 7 import java.awt.Font; 8 8 import java.awt.GridBagLayout; 9 10 9 import java.awt.event.ActionEvent; 11 10 import java.awt.event.ActionListener; 11 12 12 import javax.swing.BorderFactory; 13 13 import javax.swing.Box; … … 15 15 import javax.swing.JLabel; 16 16 import javax.swing.JPanel; 17 18 17 import javax.swing.JSeparator; 19 18 import javax.swing.UIManager; 19 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.gui.util.GuiHelper; 22 22 import org.openstreetmap.josm.io.remotecontrol.RemoteControl; 23 23 import org.openstreetmap.josm.io.remotecontrol.handler.AddNodeHandler; 24 import org.openstreetmap.josm.io.remotecontrol.handler.ImageryHandler; 24 25 import org.openstreetmap.josm.io.remotecontrol.handler.ImportHandler; 25 26 import org.openstreetmap.josm.io.remotecontrol.handler.LoadAndZoomHandler; … … 46 47 private JCheckBox permissionLoadData = new JCheckBox(tr("load data from API")); 47 48 private JCheckBox permissionImportData = new JCheckBox(tr("import data from URL")); 49 private JCheckBox permissionLoadImagery = new JCheckBox(tr("load imagery layers")); 48 50 private JCheckBox permissionCreateObjects = new JCheckBox(tr("create new objects")); 49 51 private JCheckBox permissionChangeSelection = new JCheckBox(tr("change the selection")); … … 75 77 wrapper.add(permissionLoadData, GBC.eol().insets(INDENT,5,0,0).fill(GBC.HORIZONTAL)); 76 78 wrapper.add(permissionImportData, GBC.eol().insets(INDENT,5,0,0).fill(GBC.HORIZONTAL)); 79 wrapper.add(permissionLoadImagery, GBC.eol().insets(INDENT,5,0,0).fill(GBC.HORIZONTAL)); 77 80 wrapper.add(permissionChangeSelection, GBC.eol().insets(INDENT,5,0,0).fill(GBC.HORIZONTAL)); 78 81 wrapper.add(permissionChangeViewport, GBC.eol().insets(INDENT,5,0,0).fill(GBC.HORIZONTAL)); … … 94 97 permissionLoadData.setSelected(Main.pref.getBoolean(LoadAndZoomHandler.loadDataPermissionKey, LoadAndZoomHandler.loadDataPermissionDefault)); 95 98 permissionImportData.setSelected(Main.pref.getBoolean(ImportHandler.permissionKey, ImportHandler.permissionDefault)); 99 permissionLoadImagery.setSelected(Main.pref.getBoolean(ImageryHandler.permissionKey, ImageryHandler.permissionDefault)); 96 100 permissionChangeSelection.setSelected(Main.pref.getBoolean(LoadAndZoomHandler.changeSelectionPermissionKey, LoadAndZoomHandler.changeSelectionPermissionDefault)); 97 101 permissionChangeViewport.setSelected(Main.pref.getBoolean(LoadAndZoomHandler.changeViewportPermissionKey, LoadAndZoomHandler.changeViewportPermissionDefault)); … … 120 124 Main.pref.put(LoadAndZoomHandler.loadDataPermissionKey, permissionLoadData.isSelected()); 121 125 Main.pref.put(ImportHandler.permissionKey, permissionImportData.isSelected()); 126 Main.pref.put(ImageryHandler.permissionKey, permissionLoadImagery.isSelected()); 122 127 Main.pref.put(LoadAndZoomHandler.changeSelectionPermissionKey, permissionChangeSelection.isSelected()); 123 128 Main.pref.put(LoadAndZoomHandler.changeViewportPermissionKey, permissionChangeViewport.isSelected()); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java
r3707 r3715 15 15 public class RemoteControl 16 16 { 17 // deactivate the remote control code for now. FIXME: Remove this completely if it gets turned on.18 static final public boolean on = false;19 20 17 /** 21 18 * If the remote cotrol feature is enabled or disabled. If disabled, -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r3707 r3715 16 16 17 17 import org.openstreetmap.josm.io.remotecontrol.handler.AddNodeHandler; 18 import org.openstreetmap.josm.io.remotecontrol.handler.ImageryHandler; 18 19 import org.openstreetmap.josm.io.remotecontrol.handler.ImportHandler; 19 20 import org.openstreetmap.josm.io.remotecontrol.handler.LoadAndZoomHandler; … … 112 113 addRequestHandlerClass(LoadAndZoomHandler.command2, 113 114 LoadAndZoomHandler.class, true); 115 addRequestHandlerClass(ImageryHandler.command, ImageryHandler.class, true); 114 116 addRequestHandlerClass(AddNodeHandler.command, AddNodeHandler.class, true); 115 117 addRequestHandlerClass(ImportHandler.command, ImportHandler.class, true); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r3704 r3715 89 89 {"usertools", IN_CORE}, 90 90 {"AgPifoJ", IN_CORE}, {"utilsplugin", IN_CORE}, {"ghost", IN_CORE}, 91 {"validator", IN_CORE}, {"multipoly", IN_CORE}}) { 91 {"validator", IN_CORE}, {"multipoly", IN_CORE}, 92 {"remotecontrol", IN_CORE}, 93 {"imagery", IN_CORE}, {"slippymap", IN_CORE}, {"wmsplugin", IN_CORE}}) { 92 94 DEPRECATED_PLUGINS.put(depr[0], depr.length >= 2 ? depr[1] : null); 93 95 }
Note:
See TracChangeset
for help on using the changeset viewer.