- Timestamp:
- 2011-01-07T15:38:27+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r3725 r3777 10 10 import java.awt.Rectangle; 11 11 import java.awt.Toolkit; 12 import java.io.File; 12 13 import java.io.IOException; 13 14 import java.util.ArrayList; … … 158 159 public SlippyMapBBoxChooser() { 159 160 super(); 160 try { 161 cachedLoader = new OsmFileCacheTileLoader(this); 162 } catch (SecurityException e) { 163 // set to null if a SecurityException was thrown 164 // while creating the cachedLoader 165 // 166 cachedLoader = null; 167 } 161 cachedLoader = null; 162 String cachePath = TMSLayer.PROP_TILECACHE_DIR.get(); 163 if (cachePath != null && !cachePath.isEmpty()) { 164 try { 165 cachedLoader = new OsmFileCacheTileLoader(this, new File(cachePath)); 166 } catch (IOException e) { 167 } 168 } 169 168 170 uncachedLoader = new OsmTileLoader(this); 169 171 setZoomContolsVisible(false); -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r3774 r3777 18 18 import java.awt.geom.Rectangle2D; 19 19 import java.awt.image.ImageObserver; 20 import java.io.File; 20 21 import java.io.IOException; 21 22 import java.net.URI; … … 41 42 import org.openstreetmap.gui.jmapviewer.MemoryTileCache; 42 43 import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader; 44 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 43 45 import org.openstreetmap.gui.jmapviewer.TMSTileSource; 44 46 import org.openstreetmap.gui.jmapviewer.TemplatedTMSTileSource; … … 58 60 import org.openstreetmap.josm.data.preferences.BooleanProperty; 59 61 import org.openstreetmap.josm.data.preferences.IntegerProperty; 62 import org.openstreetmap.josm.data.preferences.StringProperty; 60 63 import org.openstreetmap.josm.gui.MapView; 61 64 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; … … 85 88 public static final BooleanProperty PROP_DRAW_DEBUG = new BooleanProperty(PREFERENCE_PREFIX + ".draw_debug", false); 86 89 public static final BooleanProperty PROP_ADD_TO_SLIPPYMAP_CHOOSER = new BooleanProperty(PREFERENCE_PREFIX + ".add_to_slippymap_chooser", true); 90 public static final StringProperty PROP_TILECACHE_DIR; 91 92 static { 93 String defPath = null; 94 try { 95 defPath = OsmFileCacheTileLoader.getDefaultCacheDir().getAbsolutePath(); 96 } catch (SecurityException e) { 97 } 98 PROP_TILECACHE_DIR = new StringProperty(PREFERENCE_PREFIX + ".tileceche_path", defPath); 99 } 87 100 88 101 boolean debug = false; … … 257 270 258 271 clearTileCache(); 259 //tileloader = new OsmTileLoader(this); 260 tileLoader = new OsmFileCacheTileLoader(this); 272 String cachePath = TMSLayer.PROP_TILECACHE_DIR.get(); 273 tileLoader = null; 274 if (cachePath != null && !cachePath.isEmpty()) { 275 try { 276 tileLoader = new OsmFileCacheTileLoader(this, new File(cachePath)); 277 } catch (IOException e) { 278 } 279 } 280 if (tileLoader == null) { 281 tileLoader = new OsmTileLoader(this); 282 } 261 283 } 262 284 -
trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java
r3737 r3777 37 37 import javax.swing.JTabbedPane; 38 38 import javax.swing.JTable; 39 import javax.swing.JTextField; 39 40 import javax.swing.SpinnerNumberModel; 40 41 import javax.swing.table.DefaultTableModel; … … 43 44 import org.openstreetmap.josm.Main; 44 45 import org.openstreetmap.josm.data.imagery.ImageryInfo; 45 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;46 46 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 47 47 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 48 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 48 49 import org.openstreetmap.josm.gui.layer.ImageryLayer; 49 50 import org.openstreetmap.josm.gui.layer.TMSLayer; … … 83 84 private JSpinner maxZoomLvl; 84 85 private JCheckBox addToSlippyMapChosser = new JCheckBox(); 86 private JTextField tilecacheDir = new JTextField(); 85 87 86 88 private JPanel buildCommonSettingsPanel(final PreferenceTabbedPane gui) { … … 191 193 192 194 tmsTab.add(new JLabel(tr("Auto zoom by default: ")), GBC.std()); 193 tmsTab.add(GBC.glue(5, 0), GBC.std() .fill(GBC.HORIZONTAL));195 tmsTab.add(GBC.glue(5, 0), GBC.std()); 194 196 tmsTab.add(autozoomActive, GBC.eol().fill(GBC.HORIZONTAL)); 195 197 196 198 tmsTab.add(new JLabel(tr("Autoload tiles by default: ")), GBC.std()); 197 tmsTab.add(GBC.glue(5, 0), GBC.std() .fill(GBC.HORIZONTAL));199 tmsTab.add(GBC.glue(5, 0), GBC.std()); 198 200 tmsTab.add(autoloadTiles, GBC.eol().fill(GBC.HORIZONTAL)); 199 201 200 202 tmsTab.add(new JLabel(tr("Min zoom lvl: ")), GBC.std()); 201 tmsTab.add(GBC.glue(5, 0), GBC.std() .fill(GBC.HORIZONTAL));202 tmsTab.add(this.minZoomLvl, GBC.eol() .fill(GBC.HORIZONTAL));203 tmsTab.add(GBC.glue(5, 0), GBC.std()); 204 tmsTab.add(this.minZoomLvl, GBC.eol()); 203 205 204 206 tmsTab.add(new JLabel(tr("Max zoom lvl: ")), GBC.std()); 205 tmsTab.add(GBC.glue(5, 0), GBC.std() .fill(GBC.HORIZONTAL));206 tmsTab.add(this.maxZoomLvl, GBC.eol() .fill(GBC.HORIZONTAL));207 tmsTab.add(GBC.glue(5, 0), GBC.std()); 208 tmsTab.add(this.maxZoomLvl, GBC.eol()); 207 209 208 210 tmsTab.add(new JLabel(tr("Add to slippymap chooser: ")), GBC.std()); 209 tmsTab.add(GBC.glue(5, 0), GBC.std() .fill(GBC.HORIZONTAL));211 tmsTab.add(GBC.glue(5, 0), GBC.std()); 210 212 tmsTab.add(addToSlippyMapChosser, GBC.eol().fill(GBC.HORIZONTAL)); 211 213 214 tmsTab.add(new JLabel(tr("Tile cache directory: ")), GBC.std()); 215 tmsTab.add(GBC.glue(5, 0), GBC.std()); 216 tmsTab.add(tilecacheDir, GBC.eol().fill(GBC.HORIZONTAL)); 217 212 218 return tmsTab; 213 219 } 214 220 215 221 private void addSettingsSection(final JPanel p, String name, JPanel section) { 222 addSettingsSection(p, name, section, GBC.eol()); 223 } 224 private void addSettingsSection(final JPanel p, String name, JPanel section, GBC gbc) { 216 225 final JLabel lbl = new JLabel(name); 217 226 lbl.setFont(lbl.getFont().deriveFont(Font.BOLD)); 218 227 p.add(lbl,GBC.std()); 219 228 p.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 0)); 220 p.add(section, GBC.eol().insets(20,5,0,10));229 p.add(section, gbc.insets(20,5,0,10)); 221 230 } 222 231 … … 227 236 addSettingsSection(p, tr("Common Settings"), buildCommonSettingsPanel(gui)); 228 237 addSettingsSection(p, tr("WMS Settings"), buildWMSSettingsPanel()); 229 addSettingsSection(p, tr("TMS Settings"), buildTMSSettingsPanel()); 238 addSettingsSection(p, tr("TMS Settings"), buildTMSSettingsPanel(), 239 GBC.eol().fill(GBC.HORIZONTAL)); 230 240 231 241 p.add(new JPanel(),GBC.eol().fill(GBC.BOTH)); … … 268 278 this.maxZoomLvl.setValue(TMSLayer.getMaxZoomLvl(null)); 269 279 this.minZoomLvl.setValue(TMSLayer.getMinZoomLvl(null)); 280 this.tilecacheDir.setText(TMSLayer.PROP_TILECACHE_DIR.get()); 270 281 } 271 282 … … 293 304 TMSLayer.setMaxZoomLvl((Integer)this.maxZoomLvl.getValue()); 294 305 TMSLayer.setMinZoomLvl((Integer)this.minZoomLvl.getValue()); 306 TMSLayer.PROP_TILECACHE_DIR.put(this.tilecacheDir.getText()); 295 307 296 308 ImageryLayer.PROP_FADE_AMOUNT.put(this.fadeAmount.getValue());
Note:
See TracChangeset
for help on using the changeset viewer.