Changeset 6364 in josm
- Timestamp:
- 2013-11-03T03:01:01+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r6361 r6364 147 147 @pref String icon; 148 148 149 /** 150 * Constructs a new {@code ImageryPreferenceEntry}. 151 */ 149 152 public ImageryPreferenceEntry() { 150 153 } … … 191 194 } 192 195 } 193 } 194 196 197 @Override 198 public String toString() { 199 return "ImageryPreferenceEntry [name=" + name + "]"; 200 } 201 } 202 203 /** 204 * Constructs a new {@code ImageryInfo}. 205 */ 195 206 public ImageryInfo() { 196 207 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r6316 r6364 42 42 import org.openstreetmap.josm.gui.layer.TMSLayer; 43 43 44 public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser{ 44 public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser { 45 45 46 46 public interface TileSourceProvider { … … 139 139 } 140 140 141 142 141 /** 143 142 * Plugins that wish to add custom tile sources to slippy map choose should call this method … … 175 174 private Bounds bbox; 176 175 177 // upper left and lower right corners of the selection rectangle (x/y on 178 // ZOOM_MAX) 176 // upper left and lower right corners of the selection rectangle (x/y on ZOOM_MAX) 179 177 Point iSelectionRectStart; 180 178 Point iSelectionRectEnd; 181 179 180 /** 181 * Constructs a new {@code SlippyMapBBoxChooser}. 182 */ 182 183 public SlippyMapBBoxChooser() { 183 super();184 184 TMSLayer.setMaxWorkers(); 185 185 cachedLoader = TMSLayer.loaderFactory.makeTileLoader(this); … … 191 191 setMinimumSize(new Dimension(350, 350 / 2)); 192 192 // We need to set an initial size - this prevents a wrong zoom selection 193 // for 194 // the area before the component has been displayed the first time 193 // for the area before the component has been displayed the first time 195 194 setBounds(new Rectangle(getMinimumSize())); 196 195 if (cachedLoader == null) { … … 201 200 setMaxTilesInMemory(Main.pref.getInteger("slippy_map_chooser.max_tiles", 1000)); 202 201 203 List<TileSource> tileSources = new ArrayList<TileSource>(); 204 for (TileSourceProvider provider: providers) { 205 tileSources.addAll(provider.getTileSources()); 206 } 202 List<TileSource> tileSources = getTileSources(); 207 203 208 204 iSourceButton = new SourceButton(tileSources); … … 224 220 225 221 new SlippyMapControler(this, this, iSizeButton, iSourceButton); 222 } 223 224 private List<TileSource> getTileSources() { 225 List<TileSource> tileSources = new ArrayList<TileSource>(); 226 for (TileSourceProvider provider: providers) { 227 tileSources.addAll(provider.getTileSources()); 228 } 229 return tileSources; 226 230 } 227 231 … … 390 394 repaint(); 391 395 } 396 397 /** 398 * Refreshes the tile sources 399 * @since 6364 400 */ 401 public final void refreshTileSources() { 402 iSourceButton.setSources(getTileSources()); 403 } 392 404 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SourceButton.java
r3719 r6364 8 8 import java.awt.Point; 9 9 import java.awt.RenderingHints; 10 import java.util. List;10 import java.util.Collection; 11 11 12 12 import javax.swing.ImageIcon; 13 13 14 14 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 15 import org.openstreetmap.josm.tools.CheckParameterUtil; 15 16 import org.openstreetmap.josm.tools.ImageProvider; 16 17 … … 23 24 private int layerHeight; 24 25 25 private finalTileSource[] sources;26 private TileSource[] sources; 26 27 27 28 private ImageIcon enlargeImage; … … 34 35 public static final int HIDE_OR_SHOW = 1; 35 36 36 public SourceButton( List<TileSource> sources) {37 this.sources= sources.toArray(new TileSource[sources.size()]);37 public SourceButton(Collection<TileSource> sources) { 38 setSources(sources); 38 39 this.currentMap = 2; 39 40 enlargeImage = ImageProvider.get("layer-switcher-maximize.png"); 40 41 shrinkImage = ImageProvider.get("layer-switcher-minimize.png"); 42 } 43 44 /** 45 * Set the tile sources. 46 * @param sources The tile sources to display 47 * @since 6364 48 */ 49 public final void setSources(Collection<TileSource> sources) { 50 CheckParameterUtil.ensureParameterNotNull(sources, "sources"); 51 this.sources = sources.toArray(new TileSource[sources.size()]); 41 52 } 42 53 -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r6296 r6364 66 66 } 67 67 68 protected SlippyMapChooser slippyMapChooser; 68 69 protected final List<DownloadSelection> downloadSelections = new ArrayList<DownloadSelection>(); 69 70 protected final JTabbedPane tpDownloadAreaSelectors = new JTabbedPane(); … … 102 103 103 104 // predefined download selections 104 downloadSelections.add(new SlippyMapChooser()); 105 downloadSelections.add(slippyMapChooser = new SlippyMapChooser()); 105 106 downloadSelections.add(new BookmarkSelection()); 106 107 downloadSelections.add(new BoundingBoxSelection()); … … 293 294 } 294 295 296 /** 297 * Refreshes the tile sources 298 * @since 6364 299 */ 300 public final void refreshTileSources() { 301 if (slippyMapChooser != null) { 302 slippyMapChooser.refreshTileSources(); 303 } 304 } 305 295 306 /** 296 307 * Remembers the current settings in the download dialog -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r6084 r6364 22 22 * 23 23 */ 24 public class SlippyMapChooser extends JPanel implements DownloadSelection, PropertyChangeListener{ 24 public class SlippyMapChooser extends JPanel implements DownloadSelection, PropertyChangeListener { 25 25 26 26 private DownloadDialog iGui; … … 81 81 } 82 82 } 83 84 /** 85 * Refreshes the tile sources 86 * @since 6364 87 */ 88 public final void refreshTileSources() { 89 if (pnlSlippyMapBBoxChooser != null) { 90 pnlSlippyMapBBoxChooser.refreshTileSources(); 91 } 92 } 83 93 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r6362 r6364 57 57 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 58 58 import org.openstreetmap.josm.data.imagery.Shape; 59 import org.openstreetmap.josm.gui.download.DownloadDialog; 59 60 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 60 61 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; … … 141 142 Main.main.menu.imageryMenu.refreshOffsetMenu(); 142 143 OffsetBookmark.saveBookmarks(); 144 145 DownloadDialog.getInstance().refreshTileSources(); 143 146 144 147 boolean commonRestartRequired = commonSettings.saveSettings();
Note:
See TracChangeset
for help on using the changeset viewer.