Changeset 26253 in osm for applications
- Timestamp:
- 2011-07-03T01:00:30+02:00 (13 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r25369 r26253 10 10 import java.awt.Insets; 11 11 import java.awt.Point; 12 import java.awt.Rectangle; 12 13 import java.awt.event.ActionEvent; 13 14 import java.awt.event.ActionListener; … … 86 87 public static final Font ATTR_FONT = new Font("Arial", Font.PLAIN, 10); 87 88 public static final Font ATTR_LINK_FONT; 89 90 protected Rectangle attrTextBounds = null; 91 protected Rectangle attrToUBounds = null; 92 protected Rectangle attrImageBounds = null; 88 93 89 94 static { … … 753 758 754 759 Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds("Background Terms of Use", g); 755 int textHeight = (int) termsStringBounds.getHeight() - 5; 760 int textRealHeight = (int) termsStringBounds.getHeight(); 761 int textHeight = textRealHeight - 5; 762 int textWidth = (int) termsStringBounds.getWidth(); 756 763 int termsTextY = getHeight() - textHeight; 757 764 if (attrTermsUrl != null) { 758 765 int x = 2; 759 766 int y = getHeight() - textHeight; 767 attrToUBounds = new Rectangle(x, y-textHeight, textWidth, textRealHeight); 760 768 g.setColor(Color.black); 761 769 g.drawString("Background Terms of Use", x + 1, y + 1); … … 767 775 if (attrImage != null) { 768 776 int x = 2; 777 int imgWidth = attrImage.getWidth(this); 769 778 int height = attrImage.getHeight(null); 770 779 int y = termsTextY - height - textHeight - 5; 780 attrImageBounds = new Rectangle(x, y, imgWidth, height); 771 781 g.drawImage(attrImage, x, y, null); 772 782 } … … 784 794 g.setColor(Color.white); 785 795 g.drawString(attributionText, x, y); 796 attrTextBounds = new Rectangle(x, y-textHeight, textWidth, textRealHeight); 786 797 } 787 798 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java
r26249 r26253 26 26 @Override 27 27 public boolean requiresAttribution() { 28 return false;28 return true; 29 29 } 30 30 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
r26249 r26253 1 1 package org.openstreetmap.gui.jmapviewer.tilesources; 2 2 3 import java.awt.Image; 4 5 import org.openstreetmap.gui.jmapviewer.Coordinate; 3 6 4 7 public class TMSTileSource extends AbstractTSMTileSource { 5 8 protected int maxZoom; 6 9 protected int minZoom = 0; 10 protected String attributionText; 11 protected Image attributionImage; 12 protected String attributionLinkURL; 13 protected String termsOfUseURL; 7 14 8 15 public TMSTileSource(String name, String url, int maxZoom) { … … 30 37 return TileUpdate.IfNoneMatch; 31 38 } 39 40 @Override 41 public boolean requiresAttribution() { 42 return attributionText != null; 43 } 44 45 @Override 46 public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { 47 return attributionText; 48 } 49 50 @Override 51 public Image getAttributionImage() { 52 return attributionImage; 53 } 54 55 @Override 56 public String getAttributionLinkURL() { 57 return attributionLinkURL; 58 } 59 60 @Override 61 public String getTermsOfUseURL() { 62 return termsOfUseURL; 63 } 64 65 public void setAttributionText(String text) { 66 attributionText = text; 67 } 68 69 public void setAttributionImage(Image img) { 70 attributionImage = img; 71 } 72 73 public void setAttributionLinkURL(String text) { 74 attributionLinkURL = text; 75 } 76 77 public void setTermsOfUseURL(String text) { 78 termsOfUseURL = text; 79 } 32 80 }
Note:
See TracChangeset
for help on using the changeset viewer.