Ticket #6642: tmslayer.patch
| File tmslayer.patch, 4.7 KB (added by , 14 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/layer/TMSLayer.java
89 89 90 90 public static final BooleanProperty PROP_DEFAULT_AUTOZOOM = new BooleanProperty(PREFERENCE_PREFIX + ".default_autozoom", true); 91 91 public static final BooleanProperty PROP_DEFAULT_AUTOLOAD = new BooleanProperty(PREFERENCE_PREFIX + ".default_autoload", true); 92 public static final BooleanProperty PROP_DEFAULT_SHOWERRORS = new BooleanProperty(PREFERENCE_PREFIX + ".default_showerrors", true); 92 93 public static final IntegerProperty PROP_MIN_ZOOM_LVL = new IntegerProperty(PREFERENCE_PREFIX + ".min_zoom_lvl", DEFAULT_MIN_ZOOM); 93 94 public static final IntegerProperty PROP_MAX_ZOOM_LVL = new IntegerProperty(PREFERENCE_PREFIX + ".max_zoom_lvl", DEFAULT_MAX_ZOOM); 94 95 //public static final BooleanProperty PROP_DRAW_DEBUG = new BooleanProperty(PREFERENCE_PREFIX + ".draw_debug", false); … … 155 156 private JPopupMenu tileOptionMenu; 156 157 JCheckBoxMenuItem autoZoomPopup; 157 158 JCheckBoxMenuItem autoLoadPopup; 159 JCheckBoxMenuItem showErrorsPopup; 158 160 Tile showMetadataTile; 159 161 private Image attrImage; 160 162 private String attrTermsUrl; … … 170 172 171 173 protected boolean autoZoom; 172 174 protected boolean autoLoad; 175 protected boolean showErrors; 173 176 174 177 void redraw() 175 178 { … … 320 323 super(info); 321 324 322 325 if(!isProjectionSupported(Main.getProjection())) { 323 JOptionPane.showMessageDialog(Main.parent,324 tr("TMS layers do not support the projection {0}.\n{1}\n"325 + "Change the projection or remove the layer.",326 Main.getProjection().toCode(), nameSupportedProjections()),327 tr("Warning"),328 JOptionPane.WARNING_MESSAGE);326 JOptionPane.showMessageDialog(Main.parent, 327 tr("TMS layers do not support the projection {0}.\n{1}\n" 328 + "Change the projection or remove the layer.", 329 Main.getProjection().toCode(), nameSupportedProjections()), 330 tr("Warning"), 331 JOptionPane.WARNING_MESSAGE); 329 332 } 330 333 331 334 setBackgroundLayer(true); … … 360 363 autoLoadPopup.setSelected(autoLoad); 361 364 tileOptionMenu.add(autoLoadPopup); 362 365 366 showErrors = PROP_DEFAULT_SHOWERRORS.get(); 367 showErrorsPopup = new JCheckBoxMenuItem(); 368 showErrorsPopup.setAction(new AbstractAction(tr("Show Errors")) { 369 @Override 370 public void actionPerformed(ActionEvent ae) { 371 showErrors = !showErrors; 372 } 373 }); 374 showErrorsPopup.setSelected(showErrors); 375 tileOptionMenu.add(showErrorsPopup); 376 363 377 tileOptionMenu.add(new JMenuItem(new AbstractAction(tr("Load Tile")) { 364 378 @Override 365 379 public void actionPerformed(ActionEvent ae) { … … 460 474 return; 461 475 462 476 if((attrImageBounds != null && attrImageBounds.contains(e.getPoint())) 463 || (attrTextBounds != null && attrTextBounds.contains(e.getPoint()))) {477 || (attrTextBounds != null && attrTextBounds.contains(e.getPoint()))) { 464 478 try { 465 479 java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); 466 480 desktop.browse(new URI(tileSource.getAttributionLinkURL())); … … 586 600 }*/ 587 601 currentZoomLevel--; 588 602 zoomChanged(); 589 } else {603 } else 590 604 /*Main.debug("Current zoom level could not be decreased. Min. zoom level "+minZoom+" reached.");*/ 591 605 return false; 592 }593 606 return true; 594 607 } 595 608 … … 853 866 texty += 1 + fontHeight; 854 867 }*/ 855 868 856 if (tile.hasError() ) {869 if (tile.hasError() && showErrors) { 857 870 myDrawString(g, tr("Error") + ": " + tr(tile.getErrorMessage()), p.x + 2, texty); 858 871 texty += 1 + fontHeight; 859 872 } … … 1084 1097 EastNorth topLeft = mv.getEastNorth(0, 0); 1085 1098 EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight()); 1086 1099 1087 if (botRight.east() == 0.0 || botRight.north() == 0) {1100 if (botRight.east() == 0.0 || botRight.north() == 0) 1088 1101 /*Main.debug("still initializing??");*/ 1089 1102 // probably still initializing 1090 1103 return; 1091 }1092 1104 1093 1105 needRedraw = false; 1094 1106
