Changeset 18805 in osm for applications/editors/josm/plugins/slippymap
- Timestamp:
- 2009-11-25T20:01:09+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java
r18355 r18805 11 11 import javax.swing.JSpinner; 12 12 import javax.swing.SpinnerNumberModel; 13 import java.awt.event.ActionListener; 14 import java.awt.event.ActionEvent; 13 15 import java.util.Collection; 14 16 … … 75 77 slippymapTab.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 76 78 79 tileSourceCombo.addActionListener(new ActionListener() { 80 public void actionPerformed(ActionEvent e) { 81 //Main.debug("updating spinner models because of tileSourceCombo"); 82 updateSpinnerModels(); 83 } 84 }); 85 77 86 this.loadSettings(); 87 updateSpinnerModels(); 78 88 } 79 89 90 91 void updateSpinnerModel(JSpinner s, int min, int max) 92 { 93 int val = (Integer)s.getValue(); 94 //Main.debug("updating spinner model val: " + val + " " + min + "->" + max); 95 val = Math.min(max, val); 96 val = Math.max(min, val); 97 SpinnerNumberModel model = new SpinnerNumberModel(val, min, max, 1); 98 s.setModel(model); 99 } 100 101 void updateSpinnerModels() 102 { 103 TileSource ts = (TileSource)this.tileSourceCombo.getSelectedItem(); 104 int min = ts.getMinZoom(); 105 int max = ts.getMaxZoom(); 106 updateSpinnerModel(minZoomLvl, min, max); 107 updateSpinnerModel(maxZoomLvl, min, max); 108 } 80 109 81 110 /** -
applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java
r18741 r18805 38 38 { 39 39 String name = Main.pref.get(PREFERENCE_TILE_SOURCE); 40 return getMapSource(name); 41 } 42 public static TileSource getMapSource(String name) 43 { 40 44 List<TileSource> sources = SlippyMapPreferences.getAllMapSources(); 41 45 TileSource source = sources.get(0); … … 185 189 maxZoomLvl = SlippyMapPreferences.__getMinZoomLvl(); 186 190 } 191 TileSource ts = getMapSource(); 192 if (ts != null && ts.getMaxZoom() < SlippyMapPreferences.__getMinZoomLvl()) { 193 System.err.println("decreasing maxZoomLvl to match new tile source"); 194 maxZoomLvl = ts.getMaxZoom(); 195 } 187 196 return maxZoomLvl; 188 197 }
Note:
See TracChangeset
for help on using the changeset viewer.