Changeset 4195 in josm for trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
- Timestamp:
- 2011-07-03T01:02:51+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r4188 r4195 159 159 private Image attrImage; 160 160 private String attrTermsUrl; 161 private Rectangle attrImageBounds, attrToUBounds; 161 private Rectangle attrImageBounds, attrToUBounds, attrTextBounds; 162 162 private static final Font InfoFont = new Font("sansserif", Font.BOLD, 13); 163 163 private static final Font ATTR_FONT = new Font("Arial", Font.PLAIN, 10); … … 233 233 public static TileSource getTileSource(ImageryInfo info) { 234 234 if (info.getImageryType() == ImageryType.TMS) { 235 if(ImageryInfo.isUrlWithPatterns(info.getUrl())) 236 return new TemplatedTMSTileSource(info.getName(), info.getUrl(), info.getMinZoom(), info.getMaxZoom()); 237 else 238 return new TMSTileSource(info.getName(),info.getUrl(), info.getMinZoom(), info.getMaxZoom()); 235 if(ImageryInfo.isUrlWithPatterns(info.getUrl())) { 236 TMSTileSource t = new TemplatedTMSTileSource(info.getName(), info.getUrl(), info.getMinZoom(), info.getMaxZoom()); 237 info.setAttribution(t); 238 return t; 239 } else { 240 TMSTileSource t = new TMSTileSource(info.getName(),info.getUrl(), info.getMinZoom(), info.getMaxZoom()); 241 info.setAttribution(t); 242 return t; 243 } 239 244 } else if (info.getImageryType() == ImageryType.BING) 240 245 return new BingAerialTileSource(); … … 317 322 if(!isProjectionSupported(Main.getProjection())) { 318 323 JOptionPane.showMessageDialog(Main.parent, 319 tr("TMS layers do not support the projection { 1}.\n{2}\n"324 tr("TMS layers do not support the projection {0}.\n{1}\n" 320 325 + "Change the projection or remove the layer.", 321 326 Main.getProjection().toCode(), nameSupportedProjections()), … … 455 460 return; 456 461 457 if(attrImageBounds != null && attrImageBounds.contains(e.getPoint())) { 462 if((attrImageBounds != null && attrImageBounds.contains(e.getPoint())) 463 || (attrTextBounds != null && attrTextBounds.contains(e.getPoint()))) { 458 464 try { 459 465 java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); … … 1200 1206 // Draw terms of use text 1201 1207 Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds("Background Terms of Use", g); 1202 int textHeight = (int) termsStringBounds.getHeight() - 5; 1208 int textRealHeight = (int) termsStringBounds.getHeight(); 1209 int textHeight = textRealHeight - 5; 1203 1210 int textWidth = (int) termsStringBounds.getWidth(); 1204 1211 int termsTextY = mv.getHeight() - textHeight; … … 1206 1213 int x = 2; 1207 1214 int y = mv.getHeight() - textHeight; 1208 attrToUBounds = new Rectangle(x, y, textWidth, textHeight); 1215 attrToUBounds = new Rectangle(x, y-textHeight, textWidth, textRealHeight); 1209 1216 myDrawString(g, "Background Terms of Use", x, y); 1210 1217 } … … 1228 1235 int y = mv.getHeight() - textHeight; 1229 1236 myDrawString(g, attributionText, x, y); 1237 attrTextBounds = new Rectangle(x, y-textHeight, textWidth, textRealHeight); 1230 1238 } 1231 1239
Note:
See TracChangeset
for help on using the changeset viewer.
