Changeset 24487 in osm for applications/editors
- Timestamp:
- 2010-12-01T05:23:56+01:00 (14 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/SlippyMapLayer.java
r24486 r24487 15 15 import java.awt.event.MouseEvent; 16 16 import java.awt.image.ImageObserver; 17 import java.io.IOException; 18 import java.net.URI; 19 import java.net.URISyntaxException; 17 20 import java.util.ArrayList; 18 21 import java.util.HashSet; … … 106 109 Tile showMetadataTile; 107 110 private Image attrImage; 111 private Rectangle attrImageBounds; 108 112 private Font attrFont = Font.decode("Arial-10"); 109 113 … … 256 260 @Override 257 261 public void mouseClicked(MouseEvent e) { 258 if (e.getButton() != MouseEvent.BUTTON3) 259 return; 260 clickedTile = getTileForPixelpos(e.getX(), e.getY()); 261 tileOptionMenu.show(e.getComponent(), e.getX(), e.getY()); 262 if (e.getButton() == MouseEvent.BUTTON3) { 263 clickedTile = getTileForPixelpos(e.getX(), e.getY()); 264 tileOptionMenu.show(e.getComponent(), e.getX(), e.getY()); 265 } else if (e.getButton() == MouseEvent.BUTTON1) { 266 if(attrImageBounds.contains(e.getPoint()) && tileSource.requiresAttribution()) { 267 try { 268 java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); 269 desktop.browse(new URI(tileSource.getAttributionLinkURL())); 270 } catch (IOException e1) { 271 e1.printStackTrace(); 272 } catch (URISyntaxException e1) { 273 e1.printStackTrace(); 274 } 275 } 276 } 262 277 } 263 278 }); … … 933 948 // Draw attribution logo 934 949 if(attrImage != null) { 935 g.drawImage(attrImage, 5, mv.getHeight() - attrImage.getHeight(this) - 5, this); 950 int x = 5; 951 int y = mv.getHeight() - attrImage.getHeight(this) - 5; 952 attrImageBounds = new Rectangle(x, y, attrImage.getWidth(this), attrImage.getHeight(this)); 953 g.drawImage(attrImage, x, y, this); 936 954 } 937 955 } -
applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java
r24486 r24487 406 406 } 407 407 408 public String getAttributionLinkURL() { 409 return "http://bing.com/maps"; 410 } 411 408 412 public String getAttributionText(int zoom, LatLon topLeft, LatLon botRight) { 409 413 Bounds windowBounds = new Bounds(topLeft, botRight); … … 418 422 a.append(attr.attribution); 419 423 a.append(" "); 420 } else {421 424 } 422 425 }
Note:
See TracChangeset
for help on using the changeset viewer.