Changeset 24620 in osm for applications/editors
- Timestamp:
- 2010-12-06T16:59:19+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayerInfo.java
r24510 r24620 12 12 import java.util.Collections; 13 13 import java.util.LinkedList; 14 import java.util.List; 14 15 15 16 import org.openstreetmap.josm.Main; … … 102 103 Main.pref.putArray("imagery.layers", coll); 103 104 } 105 106 public List<ImageryInfo> getLayers() { 107 return Collections.unmodifiableList(layers); 108 } 104 109 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPlugin.java
r24615 r24620 21 21 import org.openstreetmap.josm.gui.MainMenu; 22 22 import org.openstreetmap.josm.gui.MapFrame; 23 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; 23 24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 24 25 import org.openstreetmap.josm.plugins.Plugin; … … 26 27 import org.openstreetmap.josm.plugins.PluginInformation; 27 28 import org.openstreetmap.josm.plugins.PluginProxy; 29 import org.openstreetmap.josm.plugins.imagery.tms.TMSTileSourceProvider; 28 30 import org.openstreetmap.josm.plugins.imagery.wms.Map_Rectifier_WMSmenuAction; 29 31 import org.openstreetmap.josm.plugins.imagery.wms.WMSAdapter; … … 207 209 refreshMenu(); 208 210 initRemoteControl(); 211 SlippyMapBBoxChooser.addTileSourceProvider(new TMSTileSourceProvider()); 209 212 } 210 213 -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferenceEditor.java
r24615 r24620 61 61 private JSpinner minZoomLvl; 62 62 private JSpinner maxZoomLvl; 63 private JCheckBox addToSlippyMapChosser = new JCheckBox(); 63 64 64 65 private JPanel buildCommonSettingsPanel(final PreferenceTabbedPane gui) { … … 156 157 private JPanel buildTMSSettingsPanel() { 157 158 JPanel tmsTab = new JPanel(new GridBagLayout()); 159 158 160 minZoomLvl = new JSpinner(new SpinnerNumberModel(TMSPreferences.DEFAULT_MIN_ZOOM, TMSPreferences.MIN_ZOOM, TMSPreferences.MAX_ZOOM, 1)); 159 161 maxZoomLvl = new JSpinner(new SpinnerNumberModel(TMSPreferences.DEFAULT_MAX_ZOOM, TMSPreferences.MIN_ZOOM, TMSPreferences.MAX_ZOOM, 1)); … … 175 177 tmsTab.add(this.maxZoomLvl, GBC.eol().fill(GBC.HORIZONTAL)); 176 178 177 tmsTab.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 179 tmsTab.add(new JLabel(tr("Add to slippymap chooser: ")), GBC.std()); 180 tmsTab.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL)); 181 tmsTab.add(addToSlippyMapChosser, GBC.eol().fill(GBC.HORIZONTAL)); 178 182 179 183 this.autozoomActive.setSelected(TMSPreferences.PROP_DEFAULT_AUTOZOOM.get()); 180 184 this.autoloadTiles.setSelected(TMSPreferences.PROP_DEFAULT_AUTOLOAD.get()); 185 this.addToSlippyMapChosser.setSelected(TMSPreferences.PROP_ADD_TO_SLIPPYMAP_CHOOSER.get()); 181 186 this.maxZoomLvl.setValue(TMSPreferences.getMaxZoomLvl(null)); 182 187 this.minZoomLvl.setValue(TMSPreferences.getMinZoomLvl(null)); … … 220 225 @Override 221 226 public boolean ok() { 227 boolean restartRequired = false; 222 228 plugin.info.save(); 223 229 plugin.refreshMenu(); … … 232 238 Main.pref.put("imagery.wms.browser", browser.getEditor().getItem().toString()); 233 239 240 if (TMSPreferences.PROP_ADD_TO_SLIPPYMAP_CHOOSER.get() != this.addToSlippyMapChosser.isSelected()) 241 restartRequired = true; 242 TMSPreferences.PROP_ADD_TO_SLIPPYMAP_CHOOSER.put(this.addToSlippyMapChosser.isSelected()); 234 243 TMSPreferences.PROP_DEFAULT_AUTOZOOM.put(this.autozoomActive.isSelected()); 235 244 TMSPreferences.PROP_DEFAULT_AUTOLOAD.put(this.autoloadTiles.isSelected()); … … 242 251 ImageryPreferences.PROP_SHARPEN_LEVEL.put(sharpen.getSelectedIndex()); 243 252 244 return false;253 return restartRequired; 245 254 } 246 255 -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferences.java
r24615 r24620 24 24 Main.pref.putColor("imagery.fade", color); 25 25 } 26 27 public static boolean isUrlWithPatterns(String url) { 28 return url != null && url.contains("{") && url.contains("}"); 29 } 26 30 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java
r24615 r24620 53 53 import org.openstreetmap.josm.gui.layer.Layer; 54 54 import org.openstreetmap.josm.plugins.imagery.ImageryInfo; 55 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;56 55 import org.openstreetmap.josm.plugins.imagery.ImageryLayer; 57 56 import org.openstreetmap.josm.plugins.imagery.ImageryPreferences; … … 184 183 this.setVisible(true); 185 184 186 if (info.getImageryType() == ImageryType.TMS) { 187 if(isUrlWithPatterns(info.getURL())) { 188 initTileSource(new TemplatedTMSTileSource(info.getName(), info.getURL(), info.getMaxZoom())); 189 } else { 190 initTileSource(new TMSTileSource(info.getName(),info.getURL(), info.getMaxZoom())); 191 } 192 } else if (info.getImageryType() == ImageryType.BING) { 193 initTileSource(new BingAerialTileSource()); 194 } else throw new IllegalStateException("cannot create TMSLayer with non-TMS ImageryInfo"); 185 TileSource source = TMSPreferences.getTileSource(info); 186 if (source == null) 187 throw new IllegalStateException("cannot create TMSLayer with non-TMS ImageryInfo"); 188 initTileSource(source); 195 189 196 190 tileOptionMenu = new JPopupMenu(); … … 364 358 } 365 359 }); 366 }367 368 public static boolean isUrlWithPatterns(String url) {369 return url != null && url.contains("{") && url.contains("}");370 360 } 371 361 -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSPreferences.java
r24552 r24620 4 4 import org.openstreetmap.josm.data.preferences.BooleanProperty; 5 5 import org.openstreetmap.josm.data.preferences.IntegerProperty; 6 import org.openstreetmap.josm.plugins.imagery.ImageryInfo; 7 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType; 8 import org.openstreetmap.josm.plugins.imagery.ImageryPreferences; 6 9 7 10 /** … … 27 30 public static final IntegerProperty PROP_MAX_ZOOM_LVL = new IntegerProperty(PREFERENCE_PREFIX + ".max_zoom_lvl", DEFAULT_MAX_ZOOM); 28 31 public static final BooleanProperty PROP_DRAW_DEBUG = new BooleanProperty(PREFERENCE_PREFIX + ".draw_debug", false); 32 public static final BooleanProperty PROP_ADD_TO_SLIPPYMAP_CHOOSER = new BooleanProperty(PREFERENCE_PREFIX + ".add_to_slippymap_chooser", true); 29 33 30 34 static int checkMaxZoomLvl(int maxZoomLvl, TileSource ts) … … 80 84 PROP_MIN_ZOOM_LVL.put(minZoomLvl); 81 85 } 86 87 public static TileSource getTileSource(ImageryInfo info) { 88 if (info.getImageryType() == ImageryType.TMS) { 89 if(ImageryPreferences.isUrlWithPatterns(info.getURL())) { 90 return new TemplatedTMSTileSource(info.getName(), info.getURL(), info.getMaxZoom()); 91 } else { 92 return new TMSTileSource(info.getName(),info.getURL(), info.getMaxZoom()); 93 } 94 } else if (info.getImageryType() == ImageryType.BING) { 95 return new BingAerialTileSource(); 96 } 97 return null; 98 } 82 99 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java
r24615 r24620 31 31 import org.openstreetmap.josm.io.OsmTransferException; 32 32 import org.openstreetmap.josm.io.ProgressInputStream; 33 import org.openstreetmap.josm.plugins.imagery.ImageryPreferences; 33 34 import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State; 34 35 35 36 36 37 public class WMSGrabber extends Grabber { 37 public static boolean isUrlWithPatterns(String url) {38 return url != null && url.contains("{") && url.contains("}");39 }40 38 41 39 protected String baseURL; … … 46 44 this.baseURL = layer.getInfo().getURL(); 47 45 /* URL containing placeholders? */ 48 urlWithPatterns = isUrlWithPatterns(baseURL); 46 urlWithPatterns = ImageryPreferences.isUrlWithPatterns(baseURL); 49 47 } 50 48 -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java
r24615 r24620 30 30 import org.openstreetmap.josm.actions.SaveActionBase; 31 31 import org.openstreetmap.josm.data.Bounds; 32 import org.openstreetmap.josm.data.ProjectionBounds;33 32 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 34 33 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 34 import org.openstreetmap.josm.data.ProjectionBounds; 35 35 import org.openstreetmap.josm.data.coor.EastNorth; 36 36 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; … … 42 42 import org.openstreetmap.josm.io.CacheFiles; 43 43 import org.openstreetmap.josm.plugins.imagery.ImageryInfo; 44 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType; 44 45 import org.openstreetmap.josm.plugins.imagery.ImageryLayer; 45 46 import org.openstreetmap.josm.plugins.imagery.ImageryPlugin; 46 import org.openstreetmap.josm.plugins.imagery.Imagery Info.ImageryType;47 import org.openstreetmap.josm.plugins.imagery.ImageryPreferences; 47 48 import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State; 48 49 import org.openstreetmap.josm.tools.ImageProvider; … … 112 113 WMSGrabber.getProjection(info.getURL(), true); 113 114 startGrabberThreads(); 114 if(info.getImageryType() == ImageryType.WMS && ! WMSGrabber.isUrlWithPatterns(info.getURL())) {115 if(info.getImageryType() == ImageryType.WMS && !ImageryPreferences.isUrlWithPatterns(info.getURL())) { 115 116 if (!(info.getURL().endsWith("&") || info.getURL().endsWith("?"))) { 116 117 if (!confirmMalformedUrl(info.getURL())) {
Note:
See TracChangeset
for help on using the changeset viewer.